/**
 * Accordion Styles
 * 
 * @package EligeMenu_Integration
 * @since 2.0.0
 */

/* Base Accordion Styles */
.em-accordion {
    margin-bottom: 2rem;
}

.em-group-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--em-heading-color, #1f2937);
}

.em-group-description {
    color: var(--em-text-muted, #6b7280);
    margin-bottom: 1rem;
}

.em-dishes-accordion {
    border: 1px solid var(--em-border-color, #e5e7eb);
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Dish Row */
.em-dish-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--em-border-color, #e5e7eb);
    cursor: pointer;
    transition: background-color 0.2s ease;
    background: var(--em-bg-primary, #ffffff);
}

.em-dish-row:last-child {
    border-bottom: none;
}

.em-dish-row:hover {
    background-color: var(--em-bg-hover, #f9fafb);
}

.em-dish-row:focus-within {
    outline: 2px solid var(--em-focus-color, #3b82f6);
    outline-offset: -2px;
}

.em-dish-thumbnail {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.em-dish-name {
    flex: 1;
    font-weight: 500;
    color: var(--em-text-primary, #111827);
}

.em-dish-price {
    font-weight: 600;
    color: var(--em-price-color, #059669);
    flex-shrink: 0;
}

/* Toggle Button */
.em-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    color: var(--em-text-muted, #6b7280);
}

.em-toggle:hover {
    color: var(--em-text-primary, #111827);
}

.em-toggle:focus {
    outline: 2px solid var(--em-focus-color, #3b82f6);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

.em-toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.em-toggle[aria-expanded="true"] .em-toggle-icon {
    transform: rotate(180deg);
}

/* Dish Panel */
.em-dish-panel {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
    background: var(--em-panel-bg, #f9fafb);
}

.em-dish-panel:not([hidden]) {
    max-height: 2000px;
    transition: max-height 0.3s ease-in;
}

.em-panel-inner {
    padding: 1.5rem;
}

/* Image Layouts */
.em-image-below .em-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.em-image-right_768px .em-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .em-image-right_768px .em-panel-inner {
        flex-direction: row;
    }
    
    .em-image-right_768px .em-dish-image-container {
        order: 2;
        flex-shrink: 0;
        width: 300px;
    }
    
    .em-image-right_768px .em-dish-details {
        order: 1;
        flex: 1;
    }
}

.em-dish-image-container {
    overflow: hidden;
    border-radius: 0.5rem;
}

.em-dish-image {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.em-dish-image.lazyload,
.em-dish-image.lazyloading {
    opacity: 0;
    min-height: 200px;
    background: var(--em-skeleton-bg, #e5e7eb);
}

.em-dish-image.lazyloaded {
    opacity: 1;
}

.em-dish-image.lazyerror {
    opacity: 0.3;
}

/* Image Aspect Ratios */
.em-aspect-4-3 .em-dish-image-container {
    aspect-ratio: 4 / 3;
}

.em-aspect-1-1 .em-dish-image-container {
    aspect-ratio: 1 / 1;
}

.em-aspect-16-9 .em-dish-image-container {
    aspect-ratio: 16 / 9;
}

/* Dish Details */
.em-dish-detail-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--em-heading-color, #1f2937);
}

.em-dish-description {
    color: var(--em-text-secondary, #4b5563);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Allergens */
.em-allergens {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.em-allergens strong {
    color: var(--em-text-primary, #111827);
    font-size: 0.875rem;
}

.em-allergen {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: var(--em-allergen-bg, #fee2e2);
    color: var(--em-allergen-text, #991b1b);
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Tags */
.em-dish-tags {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.em-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--em-tag-bg, #e0e7ff);
    color: var(--em-tag-text, #3730a3);
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* CTA Buttons */
.em-dish-cta {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.em-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.em-btn-primary {
    background: var(--em-btn-primary-bg, #3b82f6);
    color: var(--em-btn-primary-text, #ffffff);
}

.em-btn-primary:hover {
    background: var(--em-btn-primary-hover, #2563eb);
}

.em-btn-whatsapp {
    background: #25d366;
    color: #ffffff;
}

.em-btn-whatsapp:hover {
    background: #1ea952;
}

/* Loading States */
.em-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.em-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--em-border-color, #e5e7eb);
    border-top-color: var(--em-primary, #3b82f6);
    border-radius: 50%;
    animation: em-spin 0.6s linear infinite;
}

@keyframes em-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible */
.keyboard-navigation .em-toggle:focus,
.keyboard-navigation .em-btn:focus {
    outline: 2px solid var(--em-focus-color, #3b82f6);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .em-dish-panel,
    .em-toggle-icon,
    .em-dish-image,
    .em-btn {
        transition: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --em-bg-primary: #1f2937;
        --em-bg-hover: #374151;
        --em-panel-bg: #111827;
        --em-text-primary: #f9fafb;
        --em-text-secondary: #d1d5db;
        --em-text-muted: #9ca3af;
        --em-heading-color: #f9fafb;
        --em-border-color: #374151;
    }
}

/* Print Styles */
@media print {
    .em-toggle {
        display: none;
    }
    
    .em-dish-panel {
        max-height: none !important;
        display: block !important;
    }
    
    .em-dish-cta {
        display: none;
    }
}
