/* ===================================
   Variant Modal Styles
   Quick view modal for product variants
   =================================== */

.variant-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.variant-modal.active {
    opacity: 1;
    visibility: visible;
}

.variant-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1;
}

.variant-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 1000px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 2;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.variant-modal.active .variant-modal-content {
    transform: scale(1);
}

.variant-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

.variant-modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

.variant-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.variant-modal-close:hover {
    background: #f8f9fa;
    color: #333;
    transform: rotate(90deg);
}

.variant-modal-body {
    padding: 30px;
}

.product-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

/* Product Images */
.product-images {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.main-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-images {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 0;
}

.thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.thumbnail:hover {
    border-color: #667eea;
}

.thumbnail.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Info */
.product-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.3;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.product-price .old-price {
    font-size: 20px;
    color: #999;
    text-decoration: line-through;
}

.product-price .current-price {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
}

.product-price .discount {
    background: #ff4757;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.price-note {
    display: block;
    width: 100%;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.product-description {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

/* Product Options */
.product-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-label {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.option-label .required {
    color: #ff4757;
    font-size: 18px;
}

/* Color Picker */
.color-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-option {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid #e9ecef;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.color-option.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.color-swatch {
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

.color-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.color-name {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

/* Image Select */
.image-select-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.image-option {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid #e9ecef;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.image-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-option.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.image-option.selected::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: #667eea;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.image-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    font-size: 12px;
    color: #999;
    text-align: center;
    padding: 5px;
}

.option-name {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.radio-group.inline {
    flex-direction: row;
}

.radio-option {
    position: relative;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-option label {
    display: inline-block;
    padding: 10px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    background: white;
    color: #333;
    user-select: none;
}

.radio-option label:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.radio-option input[type="radio"]:checked + label {
    border-color: #667eea;
    background: #667eea;
    color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.radio-option .extra-price {
    font-size: 12px;
    opacity: 0.8;
}

/* Dropdown Select */
.dropdown-select {
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Cairo', sans-serif;
}

.dropdown-select:hover {
    border-color: #667eea;
}

.dropdown-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Quantity and Cart Container */
.quantity-cart-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #667eea;
    color: white;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-input {
    width: 60px;
    height: 40px;
    border: none;
    border-left: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.qty-input:focus {
    outline: none;
    background: #f8f9fa;
}

.add-to-cart-btn {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.add-to-cart-btn:active {
    transform: translateY(0);
}

.add-to-cart-btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.add-to-cart-btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .variant-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .variant-modal-header {
        padding: 15px 20px;
    }
    
    .variant-modal-header h3 {
        font-size: 18px;
    }
    
    .variant-modal-body {
        padding: 20px;
    }
    
    .product-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .product-header h1 {
        font-size: 22px;
    }
    
    .product-price .current-price {
        font-size: 24px;
    }
    
    .quantity-cart-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .add-to-cart-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .variant-modal-content {
        border-radius: 12px;
    }
    
    .variant-modal-header {
        padding: 12px 15px;
    }
    
    .variant-modal-body {
        padding: 15px;
    }
    
    .color-option,
    .image-option {
        width: 50px;
        height: 50px;
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
}

/* Scrollbar Styling */
.variant-modal-content::-webkit-scrollbar {
    width: 8px;
}

.variant-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.variant-modal-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.variant-modal-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}


/* المتغيرات غير المتوفرة في المودال */
.variant-modal .color-option.out-of-stock,
.variant-modal .image-option.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed !important;
    position: relative;
}

.variant-modal .color-option.out-of-stock::after,
.variant-modal .image-option.out-of-stock::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #dc3545;
    transform: translateY(-50%) rotate(-45deg);
    pointer-events: none;
    z-index: 10;
}

.variant-modal .radio-option.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.variant-modal .radio-option.out-of-stock label {
    text-decoration: line-through;
    cursor: not-allowed !important;
}

.variant-modal .color-option.out-of-stock:hover,
.variant-modal .image-option.out-of-stock:hover {
    transform: none;
    border-color: #e9ecef;
    box-shadow: none;
}
