/**
 * ENNU Checkout Products Modal Styles
 * 
 * Full-featured product browser styling for checkout interface.
 * 
 * @package ENNU_Checkout_Payment
 * @version 1.0.0
 */

/* Modal Overlay */
.checkout-products-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.checkout-products-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.checkout-products-modal .modal-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 95vw;
    max-width: 1200px;
    height: 85vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.checkout-products-modal.active .modal-container {
    transform: scale(1);
}

/* Modal Header */
.checkout-products-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: white;
}

.checkout-products-modal .modal-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkout-products-modal .modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.checkout-products-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Body */
.checkout-products-modal .modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Panel - Categories & Products */
.checkout-products-modal .products-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
}

/* Search Bar */
.checkout-products-modal .search-bar {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.checkout-products-modal .search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") 12px center / 20px no-repeat;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.checkout-products-modal .search-input:focus {
    outline: none;
    border-color: #c9a962;
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.2);
}

/* Category Tabs */
.checkout-products-modal .category-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    overflow-x: auto;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
    scrollbar-width: thin;
}

.checkout-products-modal .category-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.checkout-products-modal .category-tab:hover {
    border-color: #c9a962;
    color: #1a365d;
}

.checkout-products-modal .category-tab.active {
    background: linear-gradient(135deg, #c9a962 0%, #d4af37 100%);
    border-color: #c9a962;
    color: #1a365d;
}

.checkout-products-modal .category-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.checkout-products-modal .category-tab.active .category-count {
    background: rgba(255, 255, 255, 0.4);
}

/* Products Grid */
.checkout-products-modal .products-grid {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    align-content: start;
}

/* Product Card */
.checkout-products-modal .product-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkout-products-modal .product-card:hover {
    border-color: #c9a962;
    box-shadow: 0 4px 12px rgba(201, 169, 98, 0.15);
    transform: translateY(-2px);
}

.checkout-products-modal .product-card.selected {
    border-color: #c9a962;
    background: linear-gradient(135deg, rgba(201, 169, 98, 0.1) 0%, rgba(212, 175, 55, 0.05) 100%);
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.2);
}

.checkout-products-modal .product-card.out-of-stock {
    opacity: 0.5;
    pointer-events: none;
}

.checkout-products-modal .product-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.checkout-products-modal .product-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    line-height: 1.3;
}

.checkout-products-modal .product-category {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.checkout-products-modal .product-sku {
    font-size: 11px;
    color: #9ca3af;
    font-family: monospace;
}

.checkout-products-modal .product-pricing {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 8px;
}

.checkout-products-modal .product-price {
    font-size: 16px;
    font-weight: 700;
    color: #1a365d;
}

.checkout-products-modal .product-unit {
    font-size: 12px;
    color: #6b7280;
}

.checkout-products-modal .product-member-price {
    font-size: 12px;
    color: #059669;
    font-weight: 500;
}

/* Right Panel - Product Details */
.checkout-products-modal .details-panel {
    width: 380px;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
}

.checkout-products-modal .details-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.checkout-products-modal .details-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
}

.checkout-products-modal .details-subtitle {
    font-size: 13px;
    color: #6b7280;
}

.checkout-products-modal .details-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Empty State */
.checkout-products-modal .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    text-align: center;
    padding: 40px;
}

.checkout-products-modal .empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.checkout-products-modal .empty-state-text {
    font-size: 14px;
}

/* Quantity Controls */
.checkout-products-modal .quantity-section {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.checkout-products-modal .quantity-label {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 8px;
}

.checkout-products-modal .quantity-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checkout-products-modal .quantity-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    font-size: 18px;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkout-products-modal .quantity-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.checkout-products-modal .quantity-value {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    min-width: 50px;
    text-align: center;
}

.checkout-products-modal .quantity-unit {
    font-size: 13px;
    color: #6b7280;
}

/* Injection Area Selector */
.checkout-products-modal .area-selector {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.checkout-products-modal .area-selector-title {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.checkout-products-modal .area-clear-btn {
    font-size: 12px;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

.checkout-products-modal .area-clear-btn:hover {
    color: #dc2626;
}

.checkout-products-modal .area-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.checkout-products-modal .area-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.checkout-products-modal .area-item:hover {
    border-color: #c9a962;
}

.checkout-products-modal .area-item.selected {
    border-color: #c9a962;
    background: rgba(201, 169, 98, 0.1);
}

.checkout-products-modal .area-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkout-products-modal .area-item.selected .area-checkbox {
    background: #c9a962;
    border-color: #c9a962;
}

.checkout-products-modal .area-item.selected .area-checkbox::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.checkout-products-modal .area-info {
    flex: 1;
    min-width: 0;
}

.checkout-products-modal .area-name {
    font-size: 12px;
    font-weight: 500;
    color: #1f2937;
}

.checkout-products-modal .area-bilateral {
    font-size: 10px;
    color: #6b7280;
}

.checkout-products-modal .area-units-input {
    width: 50px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

/* Custom Units Toggle */
.checkout-products-modal .custom-units-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.checkout-products-modal .custom-units-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
}

.checkout-products-modal .custom-units-input {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    margin-left: auto;
}

/* Price Summary */
.checkout-products-modal .price-summary {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.checkout-products-modal .price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.checkout-products-modal .price-row:last-child {
    margin-bottom: 0;
}

.checkout-products-modal .price-label {
    font-size: 13px;
    color: #6b7280;
}

.checkout-products-modal .price-value {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.checkout-products-modal .price-total {
    padding-top: 12px;
    margin-top: 12px;
    border-top: 2px solid #e5e7eb;
}

.checkout-products-modal .price-total .price-label {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.checkout-products-modal .price-total .price-value {
    font-size: 20px;
    font-weight: 700;
    color: #1a365d;
}

/* Add Button */
.checkout-products-modal .details-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.checkout-products-modal .add-button {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #c9a962 0%, #d4af37 100%);
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #1a365d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.checkout-products-modal .add-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 169, 98, 0.4);
}

.checkout-products-modal .add-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkout-products-modal .add-button .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(26, 54, 93, 0.3);
    border-top-color: #1a365d;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Loading State */
.checkout-products-modal .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6b7280;
}

.checkout-products-modal .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #c9a962;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 900px) {
    .checkout-products-modal .modal-container {
        flex-direction: column;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .checkout-products-modal .modal-body {
        flex-direction: column;
    }
    
    .checkout-products-modal .products-panel {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        max-height: 50vh;
    }
    
    .checkout-products-modal .details-panel {
        width: 100%;
        flex: 1;
    }
    
    .checkout-products-modal .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 600px) {
    .checkout-products-modal .category-tabs {
        padding: 10px 12px;
        gap: 6px;
    }
    
    .checkout-products-modal .category-tab {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .checkout-products-modal .products-grid {
        grid-template-columns: 1fr 1fr;
        padding: 12px;
        gap: 8px;
    }
    
    .checkout-products-modal .product-card {
        padding: 12px;
    }
    
    .checkout-products-modal .product-icon {
        font-size: 24px;
    }
    
    .checkout-products-modal .product-name {
        font-size: 13px;
    }
    
    .checkout-products-modal .area-grid {
        grid-template-columns: 1fr;
    }
}

