/* =======================================================
   LROB La Carte – Frontend & Block Styles (v1.2.0)
   Security + Layout Fix + Gutenberg variable cleanup
   ======================================================= */

.lrob-carte-wrapper {
    /* Core variables – overridable in Gutenberg */
    --lrob-cols-desktop: 2;
    --lrob-cols-mobile: 1;
    --lrob-border-radius: 12px;
    --lrob-border-width: 1px;
    --lrob-card-padding: 20px;
    --lrob-card-gap: 30px;
    --lrob-border-color: currentColor;
    --lrob-accent-color: currentColor;
    --lrob-badge-bg: #e0e0e0;
    --lrob-badge-text: #333;
    --lrob-opacity-base: 0.85;
    --lrob-transition: all 0.3s ease;

    max-width: 1200px;
    margin: 0 auto;
    background: transparent;
    color: inherit;
    border: none;
    padding: 0;
}

/* ========== Editor preview ========== */

.lrob-carte-block-editor .lrob-carte-preview {
    padding: 60px 20px;
    text-align: center;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.lrob-carte-preview .lrob-carte-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: inherit;
}

.lrob-carte-preview p {
    color: #646970;
    font-size: 16px;
}

/* ========== Navigation ========== */

.lrob-carte-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
}

.lrob-carte-nav.lrob-carte-nav-bottom {
    margin-top: 40px;
    margin-bottom: 0;
}

.lrob-carte-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 2px solid var(--lrob-border-color);
    border-radius: 50px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: var(--lrob-transition);
    opacity: 0.6;
    background: none;
    color: inherit;
}

.lrob-carte-nav-item:hover,
.lrob-carte-nav-item.active {
    opacity: 1;
    transform: translateY(-2px);
}

.lrob-carte-nav-icon {
    font-size: 20px;
}

/* ========== Categories ========== */

.lrob-carte-category {
    margin-bottom: 60px;
}

.lrob-carte-category-header {
    margin-bottom: 30px;
}

.lrob-carte-category-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--lrob-border-color);
    opacity: var(--lrob-opacity-base);
}

/* ========== Subcategory filters ========== */

.lrob-carte-subcategory-filters,
.lrob-level-2-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.lrob-level-2-filters {
    margin-top: 10px;
    padding-left: 20px;
}

.lrob-subcategory-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--lrob-badge-bg);
    color: var(--lrob-badge-text);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--lrob-transition);
}

.lrob-subcategory-badge:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.lrob-subcategory-badge.active {
    opacity: 1;
    font-weight: 600;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.lrob-subcategory-badge-icon {
    font-size: 14px;
}

/* ========== Subcategory sections ========== */

.lrob-carte-subcategory {
    margin-top: 30px;
}

.lrob-carte-subcategory-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-bottom: 20px;
    opacity: 0.8;
}

.lrob-carte-category-icon {
    font-size: 36px;
}

.lrob-carte-subcategory .lrob-carte-subcategories-container {
    margin-top: 20px;
    margin-left: 30px;
    padding-left: 20px;
    border-left: 2px solid var(--lrob-border-color);
}

/* ========== Products grid ========== */

.lrob-carte-products {
    display: grid;
    grid-template-columns: repeat(var(--lrob-cols-desktop), 1fr);
    gap: var(--lrob-card-gap);
}

.lrob-carte-subcategories-wrapper {
    margin-top: 20px;
}

@media (max-width: 768px) {
    .lrob-carte-products {
        grid-template-columns: repeat(var(--lrob-cols-mobile), 1fr);
    }
    .lrob-carte-nav-item {
        font-size: 14px;
        padding: 10px 18px;
    }
    .lrob-carte-subcategory .lrob-carte-subcategories-container {
        margin-left: 15px;
        padding-left: 15px;
    }
}

/* ========== Product cards ========== */

.lrob-carte-product {
    background: none;
    border: var(--lrob-border-width) solid var(--lrob-border-color);
    border-radius: var(--lrob-border-radius);
    overflow: hidden;
    opacity: var(--lrob-opacity-base);
    transition: var(--lrob-transition);
}

.lrob-carte-product:hover {
    transform: translateY(-4px);
    opacity: 1;
}

.lrob-carte-product.lrob-unavailable {
    opacity: 0.4;
}

.lrob-carte-product-content {
    padding: var(--lrob-card-padding);
}

/* === LAYOUT: COMPACT (fixed grid alignment) === */

.lrob-layout-compact .lrob-carte-product-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 15px;
    align-items: start;
}

/* Title top-left */
.lrob-layout-compact .lrob-carte-product-name {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
    font-weight: 600;
}

/* Image + description bottom-left */
.lrob-layout-compact .lrob-carte-product-main {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/* Prices right side spanning both rows */
.lrob-layout-compact .lrob-carte-product-prices {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
}

/* Price styling */
.lrob-layout-compact .lrob-carte-price {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: right;
}

.lrob-layout-compact .lrob-carte-price-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.6;
    margin-bottom: 3px;
}

.lrob-layout-compact .lrob-carte-price-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--lrob-accent-color);
}

/* Image formatting */
.lrob-layout-compact .lrob-carte-product-image {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: 4px;
    overflow: hidden;
}

.lrob-layout-compact .lrob-carte-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lrob-layout-compact .lrob-carte-product-description {
    opacity: 0.7;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

/* === LAYOUT: CLASSIC === */

.lrob-layout-classic .lrob-carte-product-header {
    margin-bottom: 12px;
}

.lrob-layout-classic .lrob-carte-product-name {
    font-weight: 700;
    margin: 0 0 12px 0;
}

.lrob-layout-classic .lrob-carte-product-prices {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--lrob-border-color);
    opacity: 0.7;
}

.lrob-layout-classic .lrob-carte-price {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.lrob-layout-classic .lrob-carte-price-label {
    font-size: 13px;
    opacity: 0.7;
    font-weight: 600;
}

.lrob-layout-classic .lrob-carte-price-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--lrob-accent-color);
}

/* ========== Common product details ========== */

.lrob-carte-product-description {
    opacity: 0.7;
    font-size: 14px;
    line-height: 1.5;
    margin-top: 8px;
}

.lrob-carte-product-allergens {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--lrob-border-color);
    opacity: 0.4;
}

.lrob-carte-product-allergens small {
    font-size: 12px;
}

/* ========== Badges ========== */

.lrob-carte-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 6px;
    margin-bottom: 6px;
    background: var(--lrob-badge-bg);
    color: var(--lrob-badge-text);
}

.lrob-badge-unavailable { background: #d63638; color: #fff; }
.lrob-badge-nouveau,
.lrob-badge-vegetarien,
.lrob-badge-vegan,
.lrob-badge-bio { background: #00a32a; color: #fff; }
.lrob-badge-fait_maison { background: #2271b1; color: #fff; }
.lrob-badge-sans_gluten { background: #dba617; color: #fff; }
.lrob-badge-epicé,
.lrob-badge-coup_coeur { background: #d63638; color: #fff; }

/* ========== Custom image icons ========== */

.lrob-nav-custom-icon,
.lrob-title-custom-icon,
.lrob-subtitle-custom-icon,
.lrob-badge-custom-icon {
    object-fit: contain;
    vertical-align: middle;
}

.lrob-nav-custom-icon { width: 24px; height: 24px; }
.lrob-title-custom-icon { width: 32px; height: 32px; }
.lrob-subtitle-custom-icon { width: 24px; height: 24px; }
.lrob-badge-custom-icon { width: 16px; height: 16px; }

/* ========== Single column adjustments ========== */

.lrob-carte-products[style*="--lrob-cols-desktop: 1"] .lrob-carte-product {
    display: flex;
    gap: 20px;
}

.lrob-carte-products[style*="--lrob-cols-desktop: 1"] .lrob-carte-product-image {
    width: 250px;
    height: 180px;
    flex-shrink: 0;
}

.lrob-carte-products[style*="--lrob-cols-desktop: 1"] .lrob-carte-product-content {
    flex: 1;
}

@media (max-width: 768px) {
    .lrob-carte-products[style*="--lrob-cols-desktop: 1"] .lrob-carte-product {
        flex-direction: column;
    }
    .lrob-carte-products[style*="--lrob-cols-desktop: 1"] .lrob-carte-product-image {
        width: 100%;
        height: 200px;
    }
}

/* ========== Happy Hour ========== */

.lrob-carte-price.lrob-price-happy {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 3px solid #ffc107;
    padding: 6px 10px;
    border-radius: 4px;
}

.lrob-price-happy-icon {
    font-size: 1.1em;
    margin-left: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========== Drill-down hierarchy ========== */

.lrob-carte-root-category { margin-bottom: 40px; }
.lrob-carte-child-category { margin-top: 24px; }
