/* ════════════════════════════════════════════════════
   FlavorChef – Frontend Styles
   All visual properties use CSS custom properties
   set by the plugin from admin settings.
   ════════════════════════════════════════════════════ */

/* ── Reset & Base ── */
.fc-menu {
    --rm-font-family: 'Playfair Display', serif;
    --rm-body-font: 'Lato', sans-serif;
    --rm-title-weight: 700;
    --rm-title-size: 28px;
    --rm-section-size: 22px;
    --rm-body-size: 16px;
    --rm-price-size: 16px;
    --rm-color-primary: #2c2c2c;
    --rm-color-accent: #8b6914;
    --rm-color-bg: #faf8f4;
    --rm-color-section-bg: #ffffff;

    font-family: var(--rm-body-font);
    font-size: var(--rm-body-size);
    color: var(--rm-color-primary);
    background: var(--rm-color-bg);
    max-width: 900px;
    margin: 2rem auto;
    padding: 2.5rem 2rem;
    box-sizing: border-box;
    line-height: 1.6;
}

.fc-menu *,
.fc-menu *::before,
.fc-menu *::after {
    box-sizing: border-box;
}

/* ── Menu Title ── */
.fc-menu-title {
    font-family: var(--rm-font-family);
    font-weight: var(--rm-title-weight);
    font-size: var(--rm-title-size);
    color: var(--rm-color-primary);
    text-align: center;
    margin: 0 0 1.5rem;
    letter-spacing: 0.04em;
}

/* ── Sections ── */
.fc-section {
    margin-bottom: 2.5rem;
    position: relative;
}

.fc-section-header {
    position: relative;
    margin-bottom: 1.2rem;
}

.fc-section-title {
    font-family: var(--rm-font-family);
    font-weight: var(--rm-title-weight);
    font-size: var(--rm-section-size);
    color: var(--rm-color-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.3rem;
    text-align: center;
}

.fc-section-desc {
    font-size: calc(var(--rm-body-size) - 2px);
    color: #888;
    text-align: center;
    margin: 0 0 0.8rem;
    font-style: italic;
    min-height: 1em;
}

.fc-section-divider {
    width: 60px;
    height: 1px;
    background: var(--rm-color-accent);
    margin: 0.8rem auto 0;
    opacity: 0.5;
}

.fc-section-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 4px;
}

/* ── Items ── */
.fc-items {
    max-width: 700px;
    margin: 0 auto;
}

.fc-item {
    margin-bottom: 1rem;
    position: relative;
}

.fc-item-row {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.fc-item-title {
    font-family: var(--rm-font-family);
    font-weight: 600;
    font-size: calc(var(--rm-body-size) + 1px);
    color: var(--rm-color-primary);
    flex-shrink: 1; /* Allow to shrink if needed */
    min-width: 0;   /* Allow truncation/shrink in flex */
}

.fc-item-dots {
    flex: 1;
    border-bottom: 1px dotted #ccc;
    margin: 0 0.5rem;
    min-width: 20px;
    position: relative;
    top: -4px;
}

.fc-item-price {
    font-family: var(--rm-body-font);
    font-size: var(--rm-price-size);
    font-weight: 600;
    color: var(--rm-color-accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.fc-item-desc {
    font-size: calc(var(--rm-body-size) - 2px);
    color: #999;
    margin: 0.15rem 0 0;
    min-height: 1em;
}

/* ── Error ── */
.fc-error {
    color: #c0392b;
    text-align: center;
    padding: 2rem;
}

/* ── Important Box ── */
.fc-important-box {
    max-width: 760px;
    margin: 2.5rem auto 0;
    padding: 1.4rem 1.6rem;
    background: linear-gradient(135deg, rgba(139, 105, 20, 0.04), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(139, 105, 20, 0.25);
    border-left: 5px solid var(--rm-color-accent);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.fc-important-title {
    font-family: var(--rm-font-family);
    font-weight: var(--rm-title-weight);
    font-size: calc(var(--rm-body-size) + 6px);
    margin: 0 0 0.6rem;
    color: var(--rm-color-accent);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fc-important-title::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 11px;
}

.fc-important-text {
    margin: 0.25rem 0;
    color: var(--rm-color-primary);
    font-size: var(--rm-body-size);
    white-space: pre-line;
}

.fc-important-text:first-of-type {
    font-weight: 600;
}

.fc-empty {
    text-align: center;
    color: #aaa;
    padding: 2rem 0;
    font-style: italic;
}

/* ════════════════════════════════════════════════════
   LAYOUT: ELEGANT
   ════════════════════════════════════════════════════ */
.fc-layout-elegant {
    text-align: center;
    padding: 3rem 2rem;
}

.fc-layout-elegant .fc-ornament {
    color: var(--rm-color-accent);
    font-size: 14px;
    letter-spacing: 0.5em;
    margin: 1rem 0;
    opacity: 0.6;
}

.fc-layout-elegant .fc-elegant-ornament {
    color: var(--rm-color-accent);
    font-size: 12px;
    letter-spacing: 0.3em;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.fc-layout-elegant .fc-item {
    margin-bottom: 1.5rem;
}

.fc-layout-elegant .fc-item-title {
    display: block;
    font-size: calc(var(--rm-body-size) + 2px);
}

.fc-layout-elegant .fc-item-price {
    display: block;
    margin-top: 0.3rem;
    font-size: var(--rm-price-size);
}

.fc-layout-elegant .fc-item-desc {
    text-align: center;
}

.fc-layout-elegant .fc-elegant-item-divider {
    width: 40px;
    height: 1px;
    background: #ddd;
    margin: 1rem auto 0;
}

/* ════════════════════════════════════════════════════
   LAYOUT: TWO-COLUMN
   ════════════════════════════════════════════════════ */
.fc-layout-two-column .fc-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem 3rem;
}

.fc-layout-two-column .fc-col {
    break-inside: avoid;
}

.fc-layout-two-column .fc-section-title {
    text-align: left;
}

.fc-layout-two-column .fc-section-desc {
    text-align: left;
}

.fc-layout-two-column .fc-section-divider {
    margin: 0.8rem 0 0;
}

@media (max-width: 700px) {
    .fc-layout-two-column .fc-columns {
        grid-template-columns: 1fr;
    }
}

/* ════════════════════════════════════════════════════
   LAYOUT: CARD
   ════════════════════════════════════════════════════ */
.fc-layout-card .fc-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
}

.fc-layout-card .fc-card-item {
    background: var(--rm-color-section-bg);
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1.2rem 1rem;
    text-align: center;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.fc-layout-card .fc-card-item:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.fc-layout-card .fc-item-title {
    display: block;
    margin-bottom: 0.3rem;
}

.fc-layout-card .fc-item-price {
    display: block;
    margin-top: 0.5rem;
    font-size: calc(var(--rm-price-size) + 2px);
}

.fc-layout-card .fc-item-desc {
    text-align: center;
}

/* ════════════════════════════════════════════════════
   LAYOUT: MINIMAL
   ════════════════════════════════════════════════════ */
.fc-layout-minimal {
    background: #fff;
    padding: 2rem;
}

.fc-layout-minimal .fc-menu-title {
    text-align: left;
    font-size: calc(var(--rm-title-size) + 4px);
    margin-bottom: 2rem;
}

.fc-layout-minimal .fc-section-title {
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--rm-section-size);
}

.fc-layout-minimal .fc-minimal-underline {
    width: 40px;
    height: 3px;
    background: var(--rm-color-primary);
    margin: 0.3rem 0 1rem;
}

.fc-layout-minimal .fc-section-desc {
    text-align: left;
    font-style: normal;
}

.fc-layout-minimal .fc-item-row {
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.fc-layout-minimal .fc-item-dots {
    display: none;
}

.fc-layout-minimal .fc-item-price {
    color: var(--rm-color-primary);
    font-weight: 400;
}

.fc-layout-minimal .fc-section-divider {
    display: none;
}

/* ════════════════════════════════════════════════════
   EDITING STATE
   ════════════════════════════════════════════════════ */
[data-entity][data-field] {
    cursor: pointer;
    transition: background 0.15s ease, outline 0.15s ease;
    border-radius: 3px;
    outline: 2px dashed transparent;
}

[data-entity][data-field]:hover {
    outline: 2px dashed rgba(139, 105, 20, 0.3);
    background: rgba(139, 105, 20, 0.04);
}

[data-entity][data-field].fc-editing {
    outline: 2px solid var(--rm-color-accent);
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    min-width: 50px;
}

[data-entity][data-field].fc-editing:focus {
    outline: 2px solid var(--rm-color-accent);
}

/* ── Inline toolbar ── */
.fc-inline-toolbar {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.fc-inline-toolbar button {
    font-size: 11px;
    padding: 3px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    color: #333;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.fc-inline-toolbar button.fc-save-btn {
    background: var(--rm-color-accent, #8b6914);
    color: #fff;
    border-color: var(--rm-color-accent, #8b6914);
}

.fc-inline-toolbar button.fc-save-btn:hover {
    opacity: 0.85;
}

.fc-inline-toolbar button.fc-cancel-btn:hover {
    background: #f5f5f5;
}

/* ── Status indicator ── */
.fc-status-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
    z-index: 99999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.fc-status-toast.fc-visible {
    opacity: 1;
    transform: translateY(0);
}

.fc-status-toast.fc-success {
    background: #27ae60;
}

.fc-status-toast.fc-error {
    background: #c0392b;
    color: #fff;
}

.fc-status-toast.fc-saving {
    background: #2c3e50;
}

/* ── Action buttons ── */
.fc-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 0.15s ease;
}

.fc-btn-add-section,
.fc-btn-add-item {
    display: inline-block;
    padding: 6px 16px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    color: #999;
    background: transparent;
    margin-top: 0.8rem;
    font-size: 13px;
}

.fc-btn-add-section:hover,
.fc-btn-add-item:hover {
    border-color: var(--rm-color-accent);
    color: var(--rm-color-accent);
    background: rgba(139, 105, 20, 0.04);
}

/* ── Move up/down buttons ── */
.fc-btn-move-up,
.fc-btn-move-down,
.fc-btn-move-item-up,
.fc-btn-move-item-down {
    color: #bbb;
    font-size: 14px;
    padding: 2px 5px;
    line-height: 1;
    border-radius: 3px;
    flex-shrink: 0;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.fc-btn-move-up:hover,
.fc-btn-move-down:hover,
.fc-btn-move-item-up:hover,
.fc-btn-move-item-down:hover {
    color: var(--rm-color-accent);
    border-color: rgba(139, 105, 20, 0.25);
    background: rgba(139, 105, 20, 0.05);
}

.fc-section-actions {
    display: inline-flex;
    gap: 2px;
    align-items: center;
    margin-left: 8px;
    vertical-align: middle;
}

.fc-item-actions {
    display: inline-flex;
    gap: 1px;
    align-items: center;
    margin-left: 6px;
    flex-shrink: 0;
}

.fc-btn-delete-section,
.fc-btn-delete-item {
    color: #ccc;
    font-size: 16px;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 3px;
    flex-shrink: 0;
    margin-left: 6px;
}

.fc-btn-delete-section:hover,
.fc-btn-delete-item:hover {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.08);
}

.fc-menu-actions {
    text-align: center;
    margin-top: 1.5rem;
}

/* ── Unsaved changes bar ── */
.fc-unsaved-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #f39c12;
    color: #fff;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 99998;
    display: none;
}

.fc-unsaved-bar.fc-visible {
    display: block;
}

/* ════════════════════════════════════════════════════
   LAYOUT: CARTA (custom restaurant layout)
   ════════════════════════════════════════════════════ */
.fc-layout-carta {
    max-width: 960px;
    padding: 2.5rem 2rem;
}

/* ── Hide price when zero (not editing) ── */
.fc-price-zero {
    display: none;
}
.fc-editing.fc-price-zero,
[data-entity].fc-price-zero:hover {
    display: inline;
    opacity: 0.4;
}

/* ── ZONE: Food (single column centered) ── */
.fc-carta-zone-food {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.fc-carta-zone-food .fc-section-title {
    text-align: center;
}

.fc-carta-zone-food .fc-section-desc {
    text-align: center;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.fc-carta-zone-food .fc-carta-item {
    justify-content: center;
    text-align: center;
    padding: 0.35rem 0;
}

.fc-carta-zone-food .fc-item-content {
    text-align: center;
}

.fc-carta-zone-food .fc-item-title {
    display: block;
    font-size: var(--rm-body-size);
    color: var(--rm-color-primary);
}

.fc-carta-zone-food .fc-item-desc {
    display: block;
    font-size: calc(var(--rm-body-size) - 2px);
    color: #888;
    font-style: italic;
    margin-top: 0.1rem;
}

.fc-carta-zone-food .fc-item-price {
    display: block;
    color: var(--rm-color-accent);
    font-size: var(--rm-price-size);
    font-weight: 600;
    margin-top: 0.15rem;
}

/* ── ZONE: Two columns ── */
.fc-carta-zone-twocol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem 3rem;
    margin: 2rem auto;
    max-width: 900px;
}

.fc-carta-zone-twocol .fc-section-title {
    text-align: center;
    font-size: calc(var(--rm-section-size) - 2px);
}

.fc-carta-zone-twocol .fc-carta-item {
    padding: 0.3rem 0;
    text-align: center;
}

.fc-carta-zone-twocol .fc-item-content {
    text-align: center;
}

.fc-carta-zone-twocol .fc-item-title {
    display: block;
    font-size: calc(var(--rm-body-size) - 1px);
    color: var(--rm-color-primary);
}

.fc-carta-zone-twocol .fc-item-desc {
    display: block;
    font-size: calc(var(--rm-body-size) - 3px);
    color: #888;
    font-style: italic;
}

.fc-carta-zone-twocol .fc-item-price {
    display: block;
    color: var(--rm-color-accent);
    font-size: var(--rm-price-size);
    font-weight: 600;
    margin-top: 0.1rem;
}

/* ── ZONE: Wine (single column, distinct style) ── */
.fc-carta-zone-wine {
    max-width: 760px;
    margin: 2.5rem auto 0;
    padding: 2rem 0 0;
    border-top: 2px solid var(--rm-color-accent);
}

.fc-carta-wine-header {
    text-align: center;
    margin-bottom: 2rem;
}

.fc-carta-wine-title {
    font-family: var(--rm-font-family);
    font-weight: var(--rm-title-weight);
    font-size: var(--rm-title-size);
    color: var(--rm-color-accent);
    margin: 0 0 0.3rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.fc-carta-wine-ornament {
    color: var(--rm-color-accent);
    font-size: 10px;
    letter-spacing: 6px;
    opacity: 0.6;
}

.fc-carta-zone-wine .fc-section-title {
    text-align: left;
    font-size: calc(var(--rm-section-size) - 2px);
    border-bottom: 1px solid rgba(139, 105, 20, 0.2);
    padding-bottom: 0.4rem;
    margin-bottom: 0.8rem;
}

/* Wine items: centered like food zone, no price */
.fc-carta-zone-wine .fc-carta-item {
    justify-content: center;
    text-align: center;
    padding: 0.35rem 0;
}

.fc-carta-zone-wine .fc-item-content {
    text-align: center;
}

.fc-carta-zone-wine .fc-item-title {
    display: block;
    font-size: calc(var(--rm-body-size) - 1px);
    color: var(--rm-color-primary);
    font-weight: 500;
}

.fc-carta-zone-wine .fc-item-desc {
    display: block;
    font-size: calc(var(--rm-body-size) - 3px);
    color: #999;
    font-style: italic;
    margin-top: 0.1rem;
}

/* Hide price and dots in wine zone */
.fc-carta-zone-wine .fc-item-price,
.fc-carta-zone-wine .fc-item-dots {
    display: none !important;
}

.fc-carta-zone-wine .fc-section {
    margin-bottom: 2rem;
}

/* ── Carta section spacing ── */
.fc-carta-section {
    margin-bottom: 2rem;
}

.fc-carta-section .fc-section-header {
    margin-bottom: 0.8rem;
    position: relative;
}

/* ── Responsive: carta ── */
@media (max-width: 700px) {
    .fc-carta-zone-twocol {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .fc-menu {
        padding: 4rem 1rem 1.5rem; /* More top padding for logo/header clearance */
        margin: 1rem auto;
    }
    .fc-menu-title {
        font-size: calc(var(--rm-title-size) - 6px);
        margin-bottom: 1rem;
    }
    .fc-section {
        margin-bottom: 2rem;
    }
    .fc-section-title {
        font-size: calc(var(--rm-section-size) - 4px);
        padding: 0 40px; /* Room for absolute actions */
    }
    .fc-section-actions {
        top: -5px;
    }
    .fc-item-actions {
        position: absolute;
        right: -5px;
        top: 0;
        background: rgba(255,255,255,0.8);
        padding: 2px;
        border-radius: 4px;
        opacity: 0.6;
    }
    .fc-item:hover .fc-item-actions {
        opacity: 1;
    }
    .fc-layout-card .fc-card-grid {
        grid-template-columns: 1fr;
    }
    
    /* Carta layout adjustments */
    .fc-carta-zone-food .fc-item-title {
        font-size: calc(var(--rm-body-size) - 1px);
    }
    .fc-carta-zone-food .fc-carta-item {
        padding: 0.5rem 0;
        position: relative;
    }
}

@media (max-width: 480px) {
    .fc-section-title {
        font-size: calc(var(--rm-section-size) - 6px);
        padding: 0 35px;
    }
    .fc-item-title {
        font-size: var(--rm-body-size);
    }
    .fc-item-actions {
        transform: scale(0.9);
        right: -10px;
    }
    .fc-section-actions .fc-btn {
        padding: 2px 4px;
    }
}

/* ── Print styles ── */
@media print {
    .fc-btn,
    .fc-inline-toolbar,
    .fc-status-toast,
    .fc-unsaved-bar,
    .fc-section-actions,
    .fc-item-actions,
    .fc-menu-actions {
        display: none !important;
    }
    .fc-menu {
        max-width: 100%;
        background: #fff;
    }
    [data-entity][data-field] {
        outline: none !important;
        cursor: default !important;
    }
}
