/* ==========================================================================
   A4 PRINT MENU STYLESHEET (14-PAGE MODULAR BOOKLET)
   Optimized for high-resolution A4 printing and "Save as PDF"
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;800&family=Noto+Serif+SC:wght@400;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #8c1d1d;
    /* Deep restaurant burgundy */
    --accent-gold: #b38b2d;
    /* Menu gold */
    --text-main: #111111;
    /* Crisp black */
    --text-muted: #555555;
    /* Description text */
    --frame-border: #dcd6cd;
    /* Outer decorative line */
    --bg-page: #ffffff;
    --photo-bg: #1c1c1c;
    /* Placeholder dark color */
    --font-heading: 'Cinzel', 'Noto Serif SC', serif;
    --font-body: 'Outfit', 'Noto Sans SC', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

body {
    background-color: #4a4a4a;
    font-family: var(--font-body);
    color: var(--text-main);
    line-height: 1.35;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

/* Floating Control Toolbar */
.toolbar {
    position: sticky;
    top: 10px;
    z-index: 1000;
    background: #1e1e1e;
    color: #fff;
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

.toolbar button {
    background: var(--accent-gold);
    color: #000;
    font-weight: 700;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.toolbar button:hover {
    transform: scale(1.04);
    background: #d4a942;
}

/* ==========================================================================
   A4 PAGE CONTAINER
   ========================================================================== */
.a4-page {
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    background: var(--bg-page);
    padding: 11mm 13mm;
    margin-bottom: 20mm;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Modular Outer Decorative Frame */
.page-frame {
    position: absolute;
    top: 5mm;
    left: 5mm;
    right: 5mm;
    bottom: 5mm;
    border: 1.5px solid var(--accent-gold);
    pointer-events: none;
}

.page-frame::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border: 0.5px solid rgba(140, 29, 29, 0.35);
}

/* Header */
.page-header {
    text-align: center;
    margin-bottom: 4mm;
    border-bottom: 1.5px solid var(--accent-gold);
    padding-bottom: 2.5mm;
}

.restaurant-title {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--primary-color);
    text-transform: uppercase;
}

.page-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 1mm;
}

/* Mains Rice & Side Notice in Footer (Enlarged & Red Text, Clean Borderless) */
.mains-rice-notice-footer {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.2px;
    box-shadow: none;
}

/* ==========================================================================
   MODULAR GRID & EQUAL COLUMN LAYOUT
   ========================================================================== */
.page-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
    width: 100%;
    flex-grow: 1;
    align-content: start;
}

.menu-column {
    display: flex;
    flex-direction: column;
    gap: 3.5mm;
    width: 100%;
    min-width: 0;
    /* Prevents flex children from overflowing column width */
}

/* Category Block */
.category-section {
    break-inside: avoid;
    margin-bottom: 1mm;
    width: 100%;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--accent-gold);
    padding-bottom: 1.2mm;
    margin-bottom: 2.5mm;
    width: 100%;
}

.category-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-note {
    font-size: 0.7rem;
    color: #777;
    font-style: italic;
}

/* ==========================================================================
   DISH ITEM ROW (OVERFLOW-SAFE & ACCURATE GRID-LIKE ALIGNMENT)
   ========================================================================== */
.menu-item-row {
    margin-bottom: 3.2mm;
    padding-bottom: 0.5mm;
    break-inside: avoid;
    width: 100%;
}

.item-main-line {
    display: flex;
    align-items: baseline;
    font-size: 0.94rem;
    width: 100%;
    overflow: hidden;
}

.item-id {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.94rem;
    width: 28px;
    min-width: 28px;
    flex-shrink: 0;
    text-align: right;
    margin-right: 10px;
}

.item-name {
    font-weight: 700;
    font-size: 0.94rem;
    color: var(--text-main);
    flex-shrink: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-vegan {
    color: #27ae60;
    font-size: 0.78rem;
    font-weight: 600;
    margin-left: 4px;
    flex-shrink: 0;
}

.badge-spicy {
    color: #e74c3c;
    font-size: 0.78rem;
    margin-left: 3px;
    flex-shrink: 0;
}

.item-leader-dots {
    flex-grow: 1;
    border-bottom: 1px dotted #aaa;
    margin: 0 4px 3px 4px;
    height: 1px;
    min-width: 8px;
    /* Guaranteed dots */
    flex-shrink: 0;
}

.item-price {
    font-weight: 700;
    font-size: 0.94rem;
    color: var(--primary-color);
    flex-shrink: 0;
    white-space: nowrap;
    text-align: right;
    margin-left: auto;
}

.item-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding-left: 33px;
    /* 28px item-id + 5px margin-right for perfect alignment */
    line-height: 1.35;
    margin-top: 1mm;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

/* ==========================================================================
   ACADEMIC PAPER STYLE FIGURES & PHOTO BOXES
   Format: Photo on top, formatted caption description underneath
   ========================================================================== */
.menu-figure {
    margin: 2.5mm 0 3.5mm 0;
    break-inside: avoid;
    display: flex;
    flex-direction: column;
}

.photo-box {
    width: 100%;
    background-color: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
    margin: 0 auto;
}

.photo-box img {
    max-width: 100%;
    height: auto;
    max-height: 46mm;
    object-fit: contain;
    /* Full complete dish visible */
    margin: 0 auto;
    display: block;
    border: 1px solid var(--accent-gold);
    /* Border directly around the photo */
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.photo-box .placeholder-label {
    background: rgba(0, 0, 0, 0.7);
    color: #eee;
    padding: 4px 10px;
    border-radius: 12px;
    border: 0.5px solid rgba(179, 139, 45, 0.6);
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.photo-caption {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 1.5mm;
    line-height: 1.3;
    padding: 0 4px;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

.photo-caption strong {
    color: var(--primary-color);
    font-style: normal;
}

/* ==========================================================================
   FRONT COVER & BACK COVER
   ========================================================================== */
.cover-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    height: 100%;
    padding: 18mm 10mm 14mm 10mm;
}

.cover-header {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cover-logo {
    width: 220px;
    height: auto;
    margin-bottom: 6mm;
}

.cover-title {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin-bottom: 4mm;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cover-brand-line {
    display: block;
    font-size: 2.35rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--primary-color);
    line-height: 1.15;
}

.cover-brand-amp {
    display: block;
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--accent-gold);
    margin: 1.5mm 0;
    letter-spacing: 0;
    font-family: var(--font-heading), 'Playfair Display', Georgia, serif;
}

.cover-subtitle {
    font-size: 1.05rem;
    color: var(--accent-gold);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 4mm;
}

/* Center QR Code Container on Cover */
.cover-qr-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid var(--accent-gold);
    border-radius: 8px;
    padding: 8mm 10mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90mm;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cover-qr-img {
    width: 58mm;
    height: 58mm;
    object-fit: contain;
    background: #ffffff;
    padding: 3mm;
    border-radius: 6px;
    margin-bottom: 4mm;
}

.cover-qr-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2mm;
    letter-spacing: 1px;
}

.cover-qr-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.cover-footer-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Back Cover */
.backcover-page {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 4mm;
}

.info-card {
    background: #faf8f5;
    border: 1px solid var(--frame-border);
    padding: 4mm 6mm;
    border-radius: 4px;
    margin-bottom: 4mm;
}

.info-card h3 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-bottom: 2mm;
    border-bottom: 1px solid var(--accent-gold);
    padding-bottom: 1mm;
}

/* Page Footer */
.page-footer {
    border-top: 1px solid var(--frame-border);
    padding-top: 2mm;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ==========================================================================
   PRINT MEDIA SETTINGS
   ========================================================================== */
@page {
    size: A4 portrait;
    margin: 0;
}

@media print {
    body {
        background: transparent;
        padding: 0;
        margin: 0;
    }

    .toolbar {
        display: none !important;
    }

    .a4-page {
        margin: 0;
        box-shadow: none;
        page-break-after: always;
        break-after: page;
        height: 297mm;
        max-height: 297mm;
    }

    .a4-page:last-child {
        page-break-after: avoid;
        break-after: avoid;
    }
}