/* ==========================================================================
   Affilicart Plugin Styles
   ========================================================================== */

/* Preserve scrollbar space so layout doesn't shift */
html {
    scrollbar-gutter: stable;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Hover Link Styles (Free Version - Non-clickable)
   -------------------------------------------------------------------------- */
.ac-hover-link,
.ac-hover-link a,
.ac-link {
    cursor: default !important;
}

/* 1. Navigation Menu Cart Item 
   -------------------------------------------------------------------------- */
.ac-menu-cart {
    display: inline-flex !important;
    align-items: center !important;
}

.ac-menu-cart a {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-weight: 600 !important;
    transition: color 0.2s ease-in-out;
    cursor: pointer;
    text-decoration: none !important;
}

.ac-menu-cart i {
    font-size: 1.2rem;
    line-height: 1;
}

.ac-menu-cart i.ac-shake {
    animation: shake 0.5s ease-in-out;
}

#cart-count {
    background: var(--ac-accent-color, #007cba); /* WordPress Blue */
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}

/* 1a. Floating Cart for Non-Divi Themes
   -------------------------------------------------------------------------- */
#ac-floating-cart {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    background: #fff;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    width: fit-content;
    height: fit-content;
    display: none !important; /* Hidden by default, Pro plugin shows it */
}

#ac-floating-cart a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    color: #999;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

#ac-floating-cart:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

#ac-floating-cart i {
    font-size: 1.3rem;
    line-height: 1;
}

#ac-floating-cart i.ac-shake {
    animation: shake 0.5s ease-in-out;
}

/* Cart position classes */
#ac-floating-cart.ac-top-left {
    top: 30px !important;
    left: 30px !important;
    bottom: auto !important;
    right: auto !important;
}

#ac-floating-cart.ac-top-right {
    top: 30px !important;
    right: 30px !important;
    bottom: auto !important;
    left: auto !important;
}

#ac-floating-cart.ac-bottom-left {
    bottom: 30px !important;
    left: 30px !important;
    top: auto !important;
    right: auto !important;
}

#ac-floating-cart.ac-bottom-right {
    bottom: 30px !important;
    right: 30px !important;
    top: auto !important;
    left: auto !important;
}

/* 2. Product Grid & Wrapper 
   -------------------------------------------------------------------------- */
.ac-shop-wrapper {
    margin: 2rem 0;
    font-family: system-ui, -apple-system, sans-serif;
}

/* Base grid styles (replace Bootstrap) */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.5rem;
}

/* Column base styling */
.col-md-4 {
    flex: 0 0 calc(33.333333% - 1rem);
    margin: 0.5rem;
    box-sizing: border-box;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

/* Button styles (replace Bootstrap) */
.btn {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.btn:hover {
    filter: brightness(0.85);
}

.btn-primary {
    background-color: var(--ac-accent-color, #007cba) !important;
    border-color: var(--ac-accent-color, #007cba) !important;
    color: #fff !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
}

.btn-success {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: #fff !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
}

.btn-success:hover {
    background-color: #218838 !important;
    border-color: #218838 !important;
}

.btn-outline-secondary {
    color: #6c757d !important;
    border-color: #6c757d !important;
    background-color: transparent !important;
    border-radius: 3px !important;
}

.btn-outline-secondary:hover {
    color: #fff !important;
    background-color: #6c757d !important;
    border-color: #6c757d !important;
}

.btn-sm {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.875rem !important;
}

.btn-add-to-cart {
    background-color: var(--ac-accent-color, #007cba) !important;
    border-color: var(--ac-accent-color, #007cba) !important;
    color: #fff !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    border: 1px solid;
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
    transition: all 0.15s ease-in-out;
}

.btn-add-to-cart:hover {
    filter: brightness(0.85);
}

.btn-add-to-cart.added {
    background-color: var(--ac-accent-color, #007cba) !important;
    border-color: var(--ac-accent-color, #007cba) !important;
}

.w-100 {
    width: 100% !important;
}

.ac-grid-btn {
    width: 100% !important;
    margin-top: auto;
}

.ac-product-card {
    border: 1px solid #e5e5e5 !important;
    border-radius: 12px !important;
    overflow: hidden;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #ffffff;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.ac-product-card:hover {
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.ac-product-card img {
    max-height: 180px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto 15px;
    display: block;
    height: auto !important;
    border-radius: 8px;
}

.ac-card-title {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    margin: 0 0 10px 0 !important;
    line-height: 1.4 !important;
    color: #2c3338;
}

.ac-card-text {
    font-size: 0.85rem;
    color: #646970;
    margin-bottom: 20px;
    line-height: 1.5;
}

.ac-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1d2327;
    margin-top: auto; /* Pushes price to bottom of card */
    margin-bottom: 15px;
}

/* 3. Cart Modal Customization 
   -------------------------------------------------------------------------- */
/* Custom modal implementation (vanilla JS, no Bootstrap) */
.ac-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999998;
}

.ac-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ac-modal-dialog {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.ac-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ac-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ac-modal-title {
    margin: 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ac-modal-title .dashicons {
    width: 24px;
    height: 24px;
    font-size: 24px;
}

.ac-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ac-modal-close:hover {
    color: #000;
}

.ac-modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.ac-modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.ac-alert {
    padding: 12px 16px;
    border-radius: 3px;
    margin-bottom: 15px;
}

.ac-alert-danger {
    background-color: #fdeaea;
    border: 1px solid #fbc3c3;
    color: #9b2c2c;
}

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

.ac-list-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ac-list-group > li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.ac-list-group > li:last-child {
    border-bottom: none;
}

/* Ensure the modal appears above theme headers/footers */
/*.modal {
    z-index: 99999 !important;
}

.modal-backdrop {
    z-index: 99998 !important;
}*/

.ac-remove-item {
    cursor: pointer;
    color: #d63638;
    font-size: 1.1rem;
    padding-left: 10px;
    transition: color 0.2s;
}

.ac-remove-item:hover {
    color: #b32d2e;
}

#grand-total {
    color: #1d2327;
    letter-spacing: -0.01em;
}

/* 4. Responsive Fixes
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    /* 2 columns on tablets */
    .col-md-4 {
        flex: 0 0 calc(50% - 1rem);
    }
    
    .ac-product-card {
        margin-bottom: 20px;
    }
    
    .ac-menu-cart a {
        gap: 4px !important;
    }
    
    .ac-menu-cart a span {
        font-size: 0.9rem;
    }
    
    #ac-top-cart {
        padding: 0 8px !important;
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    /* 1 column on mobile */
    .col-md-4 {
        flex: 0 0 calc(100% - 1rem);
    }
    
    .ac-menu-cart a {
        flex-wrap: nowrap !important;
        gap: 2px !important;
    }
    
    .ac-menu-cart a span {
        font-size: 0.8rem;
        display: none;
    }
    
    #ac-top-cart {
        padding: 0 4px !important;
    }
    
    #ac-floating-cart {
        bottom: 20px;
        right: 20px;
    }
    
    #ac-floating-cart a {
        padding: 16px 20px;
        gap: 6px;
    }
    
    #ac-floating-cart a span:not(#cart-count) {
        display: none;
    }
    
    #ac-floating-cart i {
        font-size: 1.5rem;
    }
    
    #cart-count {
        font-size: 0.65rem;
        padding: 1px 4px;
        min-width: 16px;
        display: inline-block !important;
    }
}

/* 9. Hover Link Card
   -------------------------------------------------------------------------- */
.ac-hover-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.2s ease-out;
    z-index: 100000;
}

.ac-hover-card img {
    cursor: default !important;
}

.ac-hover-card a:not(.btn) {
    cursor: default !important;
}

.ac-hover-card div {
    cursor: default !important;
}

.ac-hover-card select {
    cursor: pointer !important;
}

.ac-hover-card button {
    cursor: pointer !important;
}

/* 9. Divi Overrides
   -------------------------------------------------------------------------- */
.entry-content tr td,
.entry-content table:not(.variations){
    border: 0 !important;
}