/**
 * WooCommerce Tiered Discount Popup - Styles
 * Enhanced styling with customization support
 */

/* ==========================================================================
   Floating Button
   ========================================================================== */
#wctdpp-floating-button {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 12px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 1000;
    border-radius: 5px 0 0 5px;
    box-shadow: -3px 0 8px rgba(0,0,0,0.3);
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#wctdpp-floating-button:hover {
    background-color: #45a049;
    transform: translateY(-50%) translateX(-5px);
    box-shadow: -5px 0 15px rgba(0,0,0,0.4);
}

#wctdpp-floating-button:active {
    transform: translateY(-50%) translateX(-2px);
}

/* ==========================================================================
   Modal Overlay & Container
   ========================================================================== */
#wctdpp-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease;
}

.wctdpp-modal-hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.wctdpp-modal-content {
    background-color: #fefefe;
    padding: 25px;
    border-radius: 12px;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.wctdpp-close-button {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
    line-height: 1;
}

.wctdpp-close-button:hover {
    color: #333;
}

/* ==========================================================================
   Modal Header
   ========================================================================== */
.wctdpp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.wctdpp-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

#wctdpp-search-input {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 25px;
    width: 300px;
    font-size: 14px;
    transition: border-color 0.3s;
}

#wctdpp-search-input:focus {
    outline: none;
    border-color: #0073aa;
}

/* ==========================================================================
   Main Grid Layout
   ========================================================================== */
.wctdpp-grid {
    display: flex;
    flex-grow: 1;
    gap: 30px;
    padding-top: 10px;
    overflow: hidden;
}

.wctdpp-product-selector {
    flex: 3;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eee;
    padding-right: 20px;
    min-width: 0;
}

.wctdpp-cart-summary {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

/* ==========================================================================
   Category Navigation
   ========================================================================== */
.wctdpp-categories-slim {
    border-bottom: 2px solid #ddd;
    margin-bottom: 15px;
    padding-bottom: 5px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.wctdpp-categories-slim::-webkit-scrollbar {
    height: 6px;
}

.wctdpp-categories-slim::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

#wctdpp-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 10px;
}

#wctdpp-category-list li {
    padding: 10px 18px;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.2s ease;
    background-color: #f5f5f5;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

#wctdpp-category-list li:hover {
    background-color: #0073aa;
    color: white;
    transform: translateY(-2px);
}

#wctdpp-category-list li.active {
    background-color: #0073aa;
    color: white;
    box-shadow: 0 2px 8px rgba(0,115,170,0.3);
}

#wctdpp-category-list li .cat-count {
    opacity: 0.8;
    font-size: 12px;
    margin-left: 5px;
}

/* ==========================================================================
   Product List Grid
   ========================================================================== */
#wctdpp-product-list {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    align-content: start;
}

#wctdpp-product-list::-webkit-scrollbar {
    width: 8px;
}

#wctdpp-product-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#wctdpp-product-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#wctdpp-product-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.wctdpp-loading,
.wctdpp-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

/* ==========================================================================
   Product Cards
   ========================================================================== */
.wctdpp-product-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    background: white;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.wctdpp-product-card:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transform: translateY(-3px);
    border-color: #0073aa;
}

.wctdpp-product-image {
    position: relative;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 8px;
}

.wctdpp-product-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.wctdpp-product-card:hover .wctdpp-product-image img {
    transform: scale(1.05);
}

.out-of-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,0,0,0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
}

.wctdpp-product-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.wctdpp-product-title {
    margin: 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    min-height: 42px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wctdpp-product-price {
    margin: 10px 0;
    font-size: 16px;
    font-weight: bold;
    color: #0073aa;
}

.wctdpp-product-price del {
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.wctdpp-add-to-cart {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: auto;
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.wctdpp-add-to-cart:hover {
    background-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

.wctdpp-add-to-cart:active {
    transform: translateY(0);
}

.wctdpp-add-to-cart.disabled,
.wctdpp-add-to-cart:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.wctdpp-add-to-cart .button-loader {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Cart Summary Section
   ========================================================================== */
.wctdpp-cart-summary h2 {
    margin: 0 0 15px 0;
    font-size: 20px;
    color: #333;
}

#wctdpp-cart-items {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    background: #fafafa;
    min-height: 200px;
}

#wctdpp-cart-items::-webkit-scrollbar {
    width: 6px;
}

#wctdpp-cart-items::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

.wctdpp-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    background: white;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.wctdpp-cart-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.wctdpp-cart-item:last-child {
    margin-bottom: 0;
}

.cart-item-details {
    flex-grow: 1;
    text-align: left;
}

.cart-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.cart-item-price {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.cart-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #666;
}

.cart-item-meta .price {
    font-weight: bold;
    color: #0073aa;
    white-space: nowrap;
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f5f5f5;
    border-radius: 5px;
    padding: 2px;
}

.wctdpp-qty-minus,
.wctdpp-qty-plus {
    background: white;
    border: 1px solid #ddd;
    color: #333;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 3px;
    transition: all 0.2s ease;
    line-height: 1;
    min-width: 28px;
}

.wctdpp-qty-minus:hover,
.wctdpp-qty-plus:hover {
    background-color: #0073aa;
    color: white;
    border-color: #0073aa;
}

.wctdpp-qty-minus:active,
.wctdpp-qty-plus:active {
    transform: scale(0.95);
}

.wctdpp-quantity-input {
    width: 50px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 4px 5px;
    font-size: 13px;
    font-weight: 600;
    background: white;
}

.wctdpp-quantity-input:focus {
    outline: none;
    border-color: #0073aa;
}

/* Remove arrows from number input */
.wctdpp-quantity-input::-webkit-inner-spin-button,
.wctdpp-quantity-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wctdpp-quantity-input {
    -moz-appearance: textfield;
}

.wctdpp-remove-item {
    background: none;
    border: none;
    color: #e74c3c;
    font-weight: bold;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    margin-left: 10px;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.wctdpp-remove-item:hover {
    background-color: #e74c3c;
    color: white;
}

.empty-cart-message {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

/* ==========================================================================
   Totals Area
   ========================================================================== */
.wctdpp-totals-area {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.wctdpp-totals-area .total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 15px;
}

.wctdpp-totals-area .discount-row {
    background: #e8f5e9;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    color: #2e7d32;
}

.wctdpp-totals-area .discount-row span {
    font-weight: 600;
}

#wctdpp-discount-amount {
    color: #4CAF50 !important;
    font-weight: bold !important;
}

.wctdpp-totals-area .discount-info {
    background: #e8f5e9;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
}

.wctdpp-totals-area .discount-info strong {
    color: #4CAF50;
}

.wctdpp-totals-area hr {
    border: none;
    border-top: 2px solid #ddd;
    margin: 15px 0;
}

.wctdpp-totals-area .final-total {
    font-size: 18px;
    font-weight: bold;
    padding-top: 10px;
    border-top: 2px solid #333;
}

#wctdpp-next-tier-message {
    font-size: 13px;
    color: #666;
    margin: 10px 0;
    text-align: center;
    padding: 10px;
    background: #fff3cd;
    border-radius: 6px;
    border: 1px solid #ffc107;
}

#wctdpp-next-tier-message strong {
    color: #333;
}

#wctdpp-checkout-button {
    width: 100%;
    padding: 15px;
    background-color: #f7941d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
}

#wctdpp-checkout-button:hover {
    background-color: #e67e00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(247,148,29,0.4);
}

#wctdpp-checkout-button:active {
    transform: translateY(0);
}

#wctdpp-checkout-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

.small-note {
    font-size: 12px;
    text-align: center;
    color: #999;
    margin-top: 10px;
}

#wctdpp-clear-cart {
    background: none;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
    transition: all 0.3s ease;
}

#wctdpp-clear-cart:hover {
    background-color: #e74c3c;
    color: white;
}

/* ==========================================================================
   Notifications
   ========================================================================== */
.wctdpp-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 99999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.wctdpp-notification.show {
    transform: translateX(0);
}

.wctdpp-notification-success {
    background-color: #4CAF50;
}

.wctdpp-notification-error {
    background-color: #e74c3c;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media screen and (max-width: 1200px) {
    .wctdpp-modal-content {
        width: 98%;
        padding: 20px;
    }
    
    #wctdpp-product-list {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
}

@media screen and (max-width: 992px) {
    .wctdpp-grid {
        flex-direction: column;
        gap: 20px;
    }
    
    .wctdpp-product-selector {
        border-right: none;
        padding-right: 0;
        border-bottom: 2px solid #eee;
        padding-bottom: 20px;
        max-height: 60vh;
    }
    
    .wctdpp-cart-summary {
        min-width: auto;
    }
    
    #wctdpp-product-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media screen and (max-width: 768px) {
    .wctdpp-modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        padding: 15px;
    }
    
    #wctdpp-floating-button {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .wctdpp-modal-header h2 {
        font-size: 18px;
    }
    
    #wctdpp-search-input {
        width: 200px;
    }
    
    #wctdpp-product-list {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
    
    .wctdpp-product-card {
        padding: 10px;
    }
    
    .wctdpp-product-title {
        font-size: 13px;
        min-height: 36px;
    }
    
    .wctdpp-add-to-cart {
        padding: 8px 15px;
        font-size: 12px;
    }
    
    .cart-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .quantity-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .wctdpp-quantity-input {
        flex-grow: 1;
    }
}

@media screen and (max-width: 480px) {
    #wctdpp-category-list li {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    #wctdpp-product-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wctdpp-notification {
        right: 10px;
        top: 10px;
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.wctdpp-hidden {
    display: none !important;
}

.wctdpp-fade-in {
    animation: fadeIn 0.3s ease;
}

body.wctdpp-modal-open {
    overflow: hidden;
}
