/* Frontend Styles for Pizzaenligne Advanced */

.pel-advanced-options {
    margin: 30px 0;
    padding: 25px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.pel-option-group {
    margin-bottom: 30px;
}

.pel-option-group:last-child {
    margin-bottom: 20px;
}

.pel-option-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--pel-primary-color, #e74c3c);
}

.pel-option-values {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pel-option-value {
    position: relative;
}

.pel-option-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pel-option-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    min-height: 44px;
    box-sizing: border-box;
}

.pel-option-button:hover {
    border-color: var(--pel-primary-color, #e74c3c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pel-option-input:checked + .pel-option-button {
    background: var(--pel-primary-color, #e74c3c);
    border-color: var(--pel-primary-color, #e74c3c);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.pel-option-input:checked + .pel-option-button:hover {
    background: var(--pel-primary-dark, #c0392b);
    border-color: var(--pel-primary-dark, #c0392b);
}

.pel-option-label {
    font-weight: 500;
}

.pel-option-price {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
}

.pel-option-input:checked + .pel-option-button .pel-option-price {
    opacity: 1;
}

/* Price Summary */
.pel-price-summary {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.pel-total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.pel-price-label {
    color: #666;
}

.pel-price-amount {
    color: var(--pel-primary-color, #e74c3c);
    font-size: 24px;
}

/* Animation for price changes */
.pel-price-amount.updating {
    animation: priceUpdate 0.3s ease;
}

@keyframes priceUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Loading state */
.pel-advanced-options.loading {
    opacity: 0.7;
    pointer-events: none;
}

.pel-advanced-options.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--pel-primary-color, #e74c3c);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .pel-advanced-options {
        margin: 20px 0;
        padding: 20px 15px;
        border-radius: 8px;
    }
    
    .pel-option-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .pel-option-values {
        gap: 8px;
    }
    
    .pel-option-button {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 40px;
    }
    
    .pel-total-price {
        font-size: 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .pel-price-amount {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .pel-option-values {
        flex-direction: column;
    }
    
    .pel-option-button {
        justify-content: space-between;
        width: 100%;
    }
}

/* Focus states for accessibility */
.pel-option-input:focus + .pel-option-button {
    outline: 2px solid var(--pel-primary-color, #e74c3c);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pel-option-button {
        border-width: 3px;
    }
    
    .pel-option-input:checked + .pel-option-button {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pel-option-button,
    .pel-price-amount {
        transition: none;
    }
    
    .pel-option-button:hover {
        transform: none;
    }
    
    .pel-option-input:checked + .pel-option-button {
        transform: none;
    }
    
    .pel-price-amount.updating {
        animation: none;
    }
}

/* Category Filter Styles */
.pel-category-filter {
    margin: 0 0 40px 0;
    padding: 0;
    background: transparent;
}

.pel-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pel-category-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s ease;
    min-height: 48px;
    position: relative;
}

.pel-category-tab:hover {
    color: var(--pel-primary-color, #e74c3c);
    background: rgba(231, 76, 60, 0.05);
}

.pel-category-tab.active {
    color: var(--pel-primary-color, #e74c3c);
    border-bottom-color: var(--pel-primary-color, #e74c3c);
    font-weight: 600;
}

.pel-category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #f5f5f5;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    line-height: 1;
}

.pel-category-tab:hover .pel-category-count {
    background: var(--pel-primary-color, #e74c3c);
    color: #fff;
}

.pel-category-tab.active .pel-category-count {
    background: var(--pel-primary-color, #e74c3c);
    color: #fff;
}

/* Loading indicator */
.pel-filter-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 15px;
}

.pel-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--pel-primary-color, #e74c3c);
    border-radius: 50%;
    animation: pel-spin 1s linear infinite;
}

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

/* Products fade transition */
.products {
    transition: opacity 0.3s ease;
}

.products.filtering {
    opacity: 0.6;
}

/* Mobile responsiveness for category filter */
@media (max-width: 768px) {
    .pel-category-filter {
        margin: 0 0 30px 0;
    }
    
    .pel-category-tabs {
        gap: 4px;
        padding: 0 15px;
        margin: 0 -15px;
    }
    
    .pel-category-tab {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .pel-category-count {
        min-width: 18px;
        height: 18px;
        font-size: 11px;
        border-radius: 9px;
    }
}

@media (max-width: 480px) {
    .pel-category-tabs {
        gap: 2px;
    }
    
    .pel-category-tab {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 40px;
    }
    
    .pel-filter-loading {
        padding: 30px 15px;
        font-size: 14px;
    }
}

/* Accessibility improvements */
.pel-category-tab:focus {
    outline: 2px solid var(--pel-primary-color, #e74c3c);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pel-category-tab {
        border-bottom-width: 4px;
    }
    
    .pel-category-tab.active {
        border-bottom-width: 4px;
    }
    
    .pel-category-count {
        border: 1px solid currentColor;
    }
}

/* Reduced motion for category filter */
@media (prefers-reduced-motion: reduce) {
    .pel-category-tab,
    .products,
    .pel-loading-spinner {
        transition: none;
        animation: none;
    }
}
