/* --------------------------------------------
   1. TRIGGER ICON
-------------------------------------------- */
.wc-slide-cart-trigger-container {
    display: inline-block;
    vertical-align: middle;
}

.wc-slide-cart-trigger {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    color: inherit;
    transition: transform 0.2s;
}

.wc-slide-cart-trigger:hover {
    transform: scale(1.05);
}

.wc-cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e53e3e;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* --------------------------------------------
   2. SLIDE CART SIDEBAR
-------------------------------------------- */
.wc-slide-cart-sidebar {
    position: fixed;
    top: 0;
    right: -450px; /* Hidden by default */
    width: 400px;
    max-width: 100%;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    z-index: 99999;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

.wc-slide-cart-sidebar.active {
    right: 0;
}

/* Header */
.wc-cart-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.wc-cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.wc-cart-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.wc-cart-close:hover {
    color: #333;
}

/* Content Area */
.wc-cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.wc-cart-empty {
    text-align: center;
    padding-top: 50px;
    color: #888;
}

/* Cart Item */
.wc-cart-item {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    border: 1px solid #eee;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wc-cart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.wc-item-thumb img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
}

.wc-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.wc-item-name a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wc-item-meta {
    font-size: 12px;
    color: #777;
    margin-top: 4px;
}

.wc-item-price {
    font-weight: bold;
    color: #555;
    margin-top: 5px;
    font-size: 14px;
}

/* Quantity Controls */
.wc-item-qty-control {
    display: flex;
    align-items: center;
    margin-top: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    width: fit-content;
}

.wc-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: bold;
    color: #555;
}

.wc-qty-btn:hover {
    background: #e0e0e0;
}

.wc-qty-input {
    width: 35px;
    height: 28px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 13px;
    padding: 0;
    -moz-appearance: textfield;
}

.wc-qty-input::-webkit-outer-spin-button,
.wc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Remove Button */
.wc-remove-item {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
}

.wc-remove-item:hover {
    color: #e53e3e;
}

/* Footer */
.wc-cart-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.wc-cart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.wc-cart-actions {
    display: flex;
    gap: 10px;
}

.wc-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s;
}

.wc-btn-view {
    background: #f1f1f1;
    color: #333;
}

.wc-btn-view:hover {
    background: #e1e1e1;
}

.wc-btn-checkout {
    background: #333;
    color: #fff;
}

.wc-btn-checkout:hover {
    background: #000;
}

/* Overlay */
.wc-slide-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.wc-slide-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile */
@media (max-width: 480px) {
    .wc-slide-cart-sidebar {
        width: 100%;
        right: -100%;
    }
}

/* --------------------------------------------
   3. AJAX SEARCH
-------------------------------------------- */
.wc-ajax-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.wc-search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.wc-ajax-search-form .search-field {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wc-ajax-search-form .search-field:focus {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.wc-search-submit {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
}

.wc-search-submit:hover {
    background: #f5f5f5;
    color: #333;
}

.wc-search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    margin-top: 10px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    display: none;
    border: 1px solid #f0f0f0;
}

.wc-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wc-search-list li {
    border-bottom: 1px solid #f9f9f9;
}

.wc-search-list li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.wc-search-list li a:hover {
    background: #f9f9f9;
}

.wc-search-thumb img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 15px;
}

.wc-search-info {
    display: flex;
    flex-direction: column;
}

.wc-search-info .title {
    font-weight: 500;
    font-size: 14px;
}

.wc-search-info .price {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.wc-view-all-results {
    display: block;
    text-align: center;
    padding: 10px;
    background: #f5f5f5;
    color: #666;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.wc-view-all-results:hover {
    background: #eee;
    color: #333;
}

.wc-no-results {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* --------------------------------------------
   4. BARCODE
-------------------------------------------- */
.wc-product-barcode-wrapper {
    margin-top: 15px;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    display: inline-block;
}

.wc-product-barcode-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
}

.wc-product-barcode-wrapper .code-text {
    text-align: center;
    font-family: monospace;
    margin-top: 5px;
    font-size: 12px;
    color: #555;
}

/* --------------------------------------------
   5. AJAX ADD TO CART (SHORTCODE & LOOP)
-------------------------------------------- */
.wc-atc-wrapper {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin: 15px 0;
    flex-wrap: nowrap; /* Prevent wrapping */
}

/* Center in loops */
.wc-atc-wrapper.in-loop {
    justify-content: center;
    margin: 10px 0 0 0;
}

/* Qty Wrapper */
.wc-atc-qty-wrapper {
    display: flex;
    align-items: center;
    background: #f1f1f1;
    border-radius: 6px;
    height: 44px;
    border: 1px solid #ddd;
    overflow: hidden;
}

.wc-atc-qty-btn {
    width: 35px;
    height: 100%;
    border: none;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-atc-qty-btn:hover {
    background: #e0e0e0;
}

.wc-atc-qty-input {
    width: 40px;
    height: 100%;
    border: none;
    background: #fff;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    padding: 0;
    -moz-appearance: textfield;
}
.wc-atc-qty-input::-webkit-outer-spin-button,
.wc-atc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* The Button */
.wc-atc-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #333;
    color: #fff;
    border: none;
    padding: 0 20px;
    height: 44px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    min-width: 100px;
    white-space: nowrap;
}

.wc-atc-submit:hover {
    background: #000;
}

.wc-atc-submit:active {
    transform: translateY(1px);
}

/* Icon Mode */
.wc-atc-submit.icon-mode {
    min-width: 44px;
    width: 44px;
    padding: 0;
}

/* Loading State */
.wc-atc-submit.loading {
    opacity: 0.8;
    cursor: wait;
}
.wc-atc-submit.loading span,
.wc-atc-submit.loading svg {
    display: none;
}
.wc-atc-submit.loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: wc-spin 0.8s linear infinite;
}

@keyframes wc-spin {
    to { transform: rotate(360deg); }
}

/* --------------------------------------------
   6. MOBILE OPTIMIZATIONS (Max Width 480px)
-------------------------------------------- */
@media (max-width: 480px) {
    /* Container: make sure it fits */
    .wc-atc-wrapper {
        gap: 5px;
        align-items: flex-end; /* Align bottom */
    }

    /* Qty Wrapper: Vertical Stack */
    .wc-atc-qty-wrapper {
        flex-direction: column-reverse; /* Minus bottom, Plus top */
        width: 30px;
        height: auto;
        border-radius: 4px;
    }

    /* Input: Middle */
    .wc-atc-qty-input {
        width: 100%;
        height: 24px;
        font-size: 12px;
        border-top: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
    }

    /* Buttons: Top/Bottom */
    .wc-atc-qty-btn {
        width: 100%;
        height: 20px;
        font-size: 12px;
        line-height: 1;
    }

    /* Submit Button: Compact */
    .wc-atc-submit {
        height: 36px; /* Match height of vertical stack roughly (20+24+20 = 64) OR smaller. 
                         Actually, standard button height next to a tall vertical stack looks odd.
                         Let's just align heights. */
        height: 64px; /* Match the vertical stack height */
        font-size: 13px;
        padding: 0 15px;
        min-width: auto;
    }
    
    /* If it's icon mode on mobile, keep it square-ish */
    .wc-atc-submit.icon-mode {
        width: 64px; 
    }
    
    /* In Loop specific mobile tweaks */
    .wc-atc-wrapper.in-loop {
        transform: scale(0.9); /* Slight scale down to fit tight grids */
    }
}