/**
 * Addon Selection Modal Styles
 * 
 * Features:
 * - Responsive design for all devices
 * - Accessibility-focused styling
 * - Smooth animations and transitions
 * - Modern glass-morphism design
 * - Performance-optimized CSS
 * 
 * @package Manjits_2025
 * @since 1.0.0
 */

/* Modal Backdrop and Container */
.addon-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: modalFadeIn 0.3s ease-out;
}

.addon-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.addon-modal-content {
    position: relative;
    background: #1f2937;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

/* Modal Header */
.addon-modal-header {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1f2937;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.addon-modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    flex: 1;
    color: #1f2937 !important;
    text-shadow: none;
}

.addon-modal-close {
    background: none;
    border: none;
    color: #1f2937;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
}

.addon-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.addon-modal-close:focus {
    outline: 2px solid #1f2937;
    outline-offset: 2px;
}

/* Product Info Section */
.addon-product-info {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    background: #374151;
    border-bottom: 1px solid #4b5563;
}

.product-image-container {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    background: #4b5563;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-image:hover {
    transform: scale(1.05);
}

.product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-price-section,
.product-quantity-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-price-label,
.quantity-label {
    color: #d1d5db;
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 80px;
}

.product-price {
    color: #fbbf24;
    font-size: 1.25rem;
    font-weight: 700;
}

.quantity-controls {
    display: flex;
    align-items: center;
    background: #4b5563;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #6b7280;
}

.qty-btn {
    background: #4b5563;
    border: none;
    color: #f3f4f6;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
}

.qty-btn:hover {
    background: #6b7280;
}

.qty-btn:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

.qty-input {
    background: #4b5563;
    border: none;
    color: #f3f4f6;
    text-align: center;
    width: 4rem;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
}

.qty-input:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* Modal Body */
.addon-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    max-height: 50vh;
}

.addon-section-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.addon-section-header h3 {
    margin: 0 0 0.5rem 0;
    color: #f3f4f6;
    font-size: 1.25rem;
    font-weight: 600;
}

.addon-section-header p {
    margin: 0;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Loading State */
.addon-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    color: #9ca3af;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid #4b5563;
    border-top: 2px solid #fbbf24;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Addon Items */
.addon-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: #374151;
    border-radius: 12px;
    border: 1px solid #4b5563;
    transition: all 0.2s ease;
}

.addon-item:hover {
    border-color: #6b7280;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.addon-item.addon-error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.addon-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.addon-title {
    margin: 0;
    color: #f3f4f6;
    font-size: 1.125rem;
    font-weight: 600;
    flex: 1;
}

.required-indicator {
    color: #ef4444;
    font-weight: 700;
    font-size: 1.25rem;
}

.addon-description {
    margin: 0 0 1rem 0;
    color: #9ca3af;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Addon Options */
.addon-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.addon-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #4b5563;
    border-radius: 8px;
    border: 1px solid #6b7280;
    transition: all 0.2s ease;
}

.addon-option:hover {
    background: #6b7280;
    border-color: #9ca3af;
}

.addon-option-input {
    margin: 0;
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #fbbf24;
}

.addon-option-label {
    flex: 1;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.option-name {
    color: #f3f4f6;
    font-weight: 500;
}

.option-price {
    color: #fbbf24;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Select Addon */
.addon-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #4b5563;
    border: 1px solid #6b7280;
    border-radius: 8px;
    color: #f3f4f6;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.addon-select:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
    border-color: #fbbf24;
}

.addon-select option {
    background: #4b5563;
    color: #f3f4f6;
}

/* Text Addon */
.addon-text-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #4b5563;
    border: 1px solid #6b7280;
    border-radius: 8px;
    color: #f3f4f6;
    font-size: 1rem;
    transition: all 0.2s ease;
    resize: vertical;
    min-height: 2.5rem;
}

.addon-text-input:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
    border-color: #fbbf24;
}

.addon-text-input::placeholder {
    color: #9ca3af;
}

/* Number Addon */
.addon-number-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.addon-number-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #4b5563;
    border: 1px solid #6b7280;
    border-radius: 8px;
    color: #f3f4f6;
    font-size: 1rem;
    text-align: center;
    transition: all 0.2s ease;
}

.addon-number-input:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
    border-color: #fbbf24;
}

.addon-quantity-controls {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.addon-qty-btn {
    background: #6b7280;
    border: none;
    color: #f3f4f6;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.addon-qty-btn:hover {
    background: #9ca3af;
}

.addon-qty-btn:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* No Addons Message */
.no-addons-message {
    text-align: center;
    padding: 3rem 2rem;
    color: #9ca3af;
}

.no-addons-message p {
    margin: 0;
    font-size: 1rem;
}

/* Pricing Summary */
.addon-pricing-summary {
    background: #374151;
    border-top: 1px solid #4b5563;
    padding: 1.5rem 2rem;
}

.pricing-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.price-label {
    color: #d1d5db;
    font-size: 0.875rem;
    font-weight: 500;
}

.price-value {
    color: #f3f4f6;
    font-weight: 600;
    font-size: 1rem;
}

.addons-subtotal .price-value {
    color: #9ca3af;
}

.product-subtotal .price-value {
    color: #fbbf24;
}

.grand-total {
    border-top: 1px solid #4b5563;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grand-total .price-label {
    color: #f3f4f6;
    font-size: 1.125rem;
    font-weight: 700;
}

.grand-total .price-value {
    color: #fbbf24;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Modal Footer */
.addon-modal-footer {
    background: #374151;
    border-top: 1px solid #4b5563;
    padding: 1.5rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6b7280;
    color: #f3f4f6;
}

.btn-secondary:hover:not(:disabled) {
    background: #9ca3af;
    transform: translateY(-1px);
}

.btn-primary {
    background: #fbbf24;
    color: #1f2937;
}

.btn-primary:hover:not(:disabled) {
    background: #f59e0b;
    transform: translateY(-1px);
}

.btn-primary:focus {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* Notifications */
.addon-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    max-width: 400px;
    animation: notificationSlideIn 0.3s ease-out;
}

.addon-notification-error {
    background: #ef4444;
    color: white;
    border: 1px solid #dc2626;
}

.addon-notification-success {
    background: #10b981;
    color: white;
    border: 1px solid #059669;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Error States */
.addon-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.addon-error::before {
    content: "⚠";
    font-size: 1rem;
}

/* Animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-2rem) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .addon-selection-modal {
        padding: 0.5rem;
    }
    
    .addon-modal-content {
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .addon-modal-header {
        padding: 1rem 1.5rem;
    }
    
    .addon-modal-title {
        font-size: 1.25rem;
    }
    
    .addon-product-info {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 1.5rem;
    }
    
    .product-image-container {
        width: 60px;
        height: 60px;
        align-self: center;
    }
    
    .product-details {
        gap: 0.75rem;
    }
    
    .product-price-section,
    .product-quantity-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .addon-modal-body {
        padding: 1.5rem;
        max-height: 40vh;
    }
    
    .addon-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .addon-option {
        padding: 0.5rem;
    }
    
    .addon-pricing-summary {
        padding: 1rem 1.5rem;
    }
    
    .addon-modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .addon-notification {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .addon-modal-content {
        border-radius: 8px;
    }
    
    .addon-modal-header {
        padding: 0.75rem 1rem;
    }
    
    .addon-modal-title {
        font-size: 1.125rem;
    }
    
    .addon-product-info {
        padding: 0.75rem 1rem;
    }
    
    .addon-modal-body {
        padding: 1rem;
    }
    
    .addon-item {
        padding: 0.75rem;
    }
    
    .addon-pricing-summary {
        padding: 0.75rem 1rem;
    }
    
    .addon-modal-footer {
        padding: 0.75rem 1rem;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .addon-modal-content {
        border: 2px solid #fbbf24;
    }
    
    .addon-item {
        border: 2px solid #6b7280;
    }
    
    .addon-item.addon-error {
        border-color: #ef4444;
    }
    
    .btn-primary {
        border: 2px solid #1f2937;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .addon-selection-modal,
    .addon-modal-content,
    .addon-notification {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
    }
    
    * {
        transition: none !important;
    }
}

/* Print Styles */
@media print {
    .addon-selection-modal {
        display: none !important;
    }
}
