/* =====================================================================
   MenuCard Builder - application styles (on top of Bootstrap 5)
   ===================================================================== */
:root {
    --brand: #c2410c;
    --brand-dark: #9a3412;
    --brand-soft: #fff1e8;
    --ink: #1c1917;
    --muted: #78716c;
    --surface: #ffffff;
    --bg: #faf7f4;
    --line: #ece6e0;
    --veg: #15803d;
    --veg-soft: #ecfdf3;
    --nonveg: #b91c1c;
    --nonveg-soft: #fef2f2;
    --radius: 14px;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 194, 65, 12;
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-dark);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html, body { height: 100%; }
body { display: flex; flex-direction: column; background: var(--bg); color: var(--ink); }
.app-main { flex: 1 0 auto; }
a { text-decoration: none; }
.font-display { font-family: "Playfair Display", Georgia, serif; }

/* ------------------------------------------------------------ buttons */
.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: #e7a07f; --bs-btn-disabled-border-color: #e7a07f;
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
}
.btn { border-radius: 10px; font-weight: 500; }
.btn-lg { border-radius: 12px; }
.text-primary { color: var(--brand) !important; }
.bg-primary-soft { background: var(--brand-soft); }
.form-control, .form-select { border-radius: 10px; border-color: var(--line); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #f0a47e; box-shadow: 0 0 0 .2rem rgba(194, 65, 12, .15);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-label { font-weight: 500; font-size: .92rem; }

/* ------------------------------------------------------------- navbar */
.app-navbar { background: #fff; border-bottom: 1px solid var(--line); }
.app-navbar .navbar-brand { font-weight: 700; color: var(--ink); }
.brand-icon {
    width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center;
    background: var(--brand); color: #fff; font-size: 1.05rem;
}
.app-navbar .nav-link.active { color: var(--brand); font-weight: 600; }
.app-footer { border-top: 1px solid var(--line); background: #fff; }

/* -------------------------------------------------------------- cards */
.card-soft { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(28, 25, 23, .04); }
.card-soft .card-header { background: transparent; border-bottom: 1px solid var(--line); }
.page-head h1, .page-head .h3 { font-weight: 700; }
.page-head p { color: var(--muted); }

/* ------------------------------------------------------- auth screens */
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.auth-card { max-width: 460px; width: 100%; }
.auth-side {
    background: linear-gradient(135deg, #7c2d12 0%, #c2410c 55%, #ea580c 100%);
    color: #fff; border-radius: var(--radius); position: relative; overflow: hidden;
}
.auth-side::after {
    content: ""; position: absolute; right: -60px; bottom: -60px; width: 220px; height: 220px;
    border-radius: 50%; background: rgba(255, 255, 255, .08);
}
.auth-side li { margin-bottom: .6rem; }

/* ------------------------------------------------------- wizard bar */
.wizard-bar { background: #fff; border-bottom: 1px solid var(--line); padding: .85rem 0; }
.wizard-progress { height: 6px; border-radius: 6px; }
.wizard-progress .progress-bar { background: var(--brand); }
.wizard-steps { list-style: none; margin: 0; padding: 0; justify-content: space-between; position: relative; }
.wizard-steps::before {
    content: ""; position: absolute; top: 15px; left: 4%; right: 4%; height: 2px; background: var(--line); z-index: 0;
}
.wizard-step { position: relative; z-index: 1; flex: 1; text-align: center; }
.wizard-link { display: inline-flex; flex-direction: column; align-items: center; gap: .3rem; color: var(--muted); font-size: .8rem; }
a.wizard-link:hover { color: var(--brand); }
.wizard-dot {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600;
    background: #fff; border: 2px solid var(--line); color: var(--muted); font-size: .85rem;
}
.wizard-step.done .wizard-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.wizard-step.done .wizard-link { color: var(--ink); }
.wizard-step.current .wizard-dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.wizard-step.current .wizard-label { color: var(--brand); font-weight: 600; }
.wizard-step.reached .wizard-dot { border-color: #f0a47e; color: var(--brand); }

/* ----------------------------------------------- veg / non-veg marks */
.food-mark {
    display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-radius: 3px;
    position: relative; flex-shrink: 0; vertical-align: -2px;
}
.food-mark::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.food-mark.veg { color: var(--veg); }
.food-mark.nonveg { color: var(--nonveg); }
.food-mark.nonveg::after { border-radius: 0; width: 0; height: 0; background: none;
    border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid currentColor; }
.badge-veg { background: var(--veg-soft); color: var(--veg); border: 1px solid #bbf7d0; }
.badge-nonveg { background: var(--nonveg-soft); color: var(--nonveg); border: 1px solid #fecaca; }
.badge-soft { background: #f5f5f4; color: #57534e; border: 1px solid var(--line); }

/* --------------------------------------------------------- welcome */
.hero-card {
    background: radial-gradient(circle at 15% 20%, #fff7ed 0, transparent 45%), radial-gradient(circle at 90% 80%, #ffedd5 0, transparent 40%), #fff;
    border: 1px solid var(--line); border-radius: 22px;
}
.hero-icon {
    width: 88px; height: 88px; border-radius: 26px; display: grid; place-items: center; font-size: 2.4rem;
    background: var(--brand); color: #fff; box-shadow: 0 16px 30px -14px rgba(194, 65, 12, .7);
}
.how-step { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }

/* ------------------------------------------------- category grid */
.type-banner { border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.type-banner.veg { background: linear-gradient(120deg, #ecfdf3, #f7fee7); border: 1px solid #bbf7d0; }
.type-banner.nonveg { background: linear-gradient(120deg, #fef2f2, #fff7ed); border: 1px solid #fecaca; }
.category-tile {
    display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; height: 100%;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.category-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -16px rgba(0, 0, 0, .35); border-color: #f0a47e; color: var(--ink); }
.category-tile .cat-icon {
    width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0;
    background: var(--brand-soft); color: var(--brand);
}
.category-tile.selected { border-color: #86efac; background: #fbfffc; }
.category-tile.selected .cat-icon { background: var(--veg-soft); color: var(--veg); }
.type-nonveg .category-tile.selected { border-color: #fca5a5; background: #fffbfb; }
.type-nonveg .category-tile.selected .cat-icon { background: var(--nonveg-soft); color: var(--nonveg); }
.category-tile.custom .cat-icon { background: #eef2ff; color: #4338ca; }
.category-tile .cat-count { font-size: .8rem; color: var(--muted); }
.category-tile .cat-chip { margin-left: auto; }

/* ------------------------------------------------- item picker */
.item-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; }
.item-option {
    display: flex; align-items: center; gap: .65rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 12px;
    background: #fff; cursor: pointer; user-select: none; transition: border-color .1s, background .1s; margin: 0;
}
.item-option:hover { border-color: #f0a47e; }
.item-option .form-check-input { margin: 0; flex-shrink: 0; width: 1.15em; height: 1.15em; }
.item-option.checked { border-color: var(--brand); background: var(--brand-soft); }
.item-option .item-name { flex: 1; font-weight: 500; }
.item-option.custom { border-style: dashed; }
.sticky-actions {
    position: sticky; bottom: 0; z-index: 10; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
    border-top: 1px solid var(--line); margin: 0 -1rem -1rem; padding: .85rem 1rem; border-radius: 0 0 var(--radius) var(--radius);
}

/* -------------------------------------------------- final + preview */
.menu-sheet { background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.menu-sheet-head { border-bottom: 2px dashed var(--line); }
.menu-type-title {
    font-family: "Playfair Display", Georgia, serif; font-weight: 700; letter-spacing: .02em;
    display: flex; align-items: center; gap: .6rem;
}
.menu-type-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.final-section h6 { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; color: var(--brand-dark); }
.final-item { display: flex; align-items: center; gap: .5rem; padding: .28rem 0; border-bottom: 1px dotted #e7e5e4; }
.final-item:last-child { border-bottom: 0; }

.section-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.section-card .section-head { display: flex; align-items: center; gap: .5rem; padding: .75rem .9rem; border-bottom: 1px solid var(--line); background: #fffdfb; border-radius: var(--radius) var(--radius) 0 0; }
.section-card .section-name {
    font-weight: 700; font-size: 1.02rem; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: .25rem .5rem; min-width: 0; flex: 1;
}
.section-card .section-name:hover { border-color: var(--line); }
.section-card .section-name:focus { border-color: #f0a47e; background: #fff; outline: none; }
.drag-handle { cursor: grab; color: #a8a29e; padding: .25rem; font-size: 1.1rem; }
.drag-handle:active { cursor: grabbing; }
.item-list { list-style: none; margin: 0; padding: .25rem .5rem; min-height: 46px; }
.item-row { display: flex; align-items: center; gap: .5rem; padding: .4rem .25rem; border-bottom: 1px solid #f5f5f4; background: #fff; }
.item-row:last-child { border-bottom: 0; }
.item-row .item-name-input { flex: 1; min-width: 0; border: 1px solid transparent; border-radius: 8px; padding: .3rem .5rem; background: transparent; }
.item-row .item-name-input:hover { border-color: var(--line); }
.item-row .item-name-input:focus { border-color: #f0a47e; background: #fff; outline: none; }
.price-input { width: 130px; flex-shrink: 0; }
.price-input .form-control { text-align: right; }
.price-input.missing .form-control { border-color: #fcd34d; background: #fffbeb; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 8px; flex-shrink: 0; }
.type-toggle { border: 0; background: transparent; padding: .25rem; border-radius: 6px; }
.type-toggle:hover { background: #f5f5f4; }
.sortable-ghost { opacity: .45; background: var(--brand-soft) !important; }
.sortable-chosen { box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .35); }
.empty-section-hint { color: var(--muted); font-size: .85rem; padding: .6rem .5rem; }
.item-list:not(:empty) + .empty-section-hint { display: none; }
.save-indicator { font-size: .82rem; color: var(--muted); }
.save-indicator.saving { color: #b45309; }
.save-indicator.saved { color: var(--veg); }
.save-indicator.error { color: var(--nonveg); }

/* ---------------------------------------------------------- stats */
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; height: 100%; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; }

/* ---------------------------------------------------- confirm modal */
.confirm-icon { width: 58px; height: 58px; border-radius: 50%; margin: auto; display: grid; place-items: center; background: #fef2f2; color: #dc2626; font-size: 1.6rem; }

/* ------------------------------------------------ print menu document */
.print-doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 48px 56px; border: 1px solid var(--line); border-radius: 6px; color: #111; }
.print-doc .doc-title { font-family: "Playfair Display", Georgia, serif; font-size: 2.1rem; font-weight: 700; margin: 0; }
.print-doc .doc-meta { width: 100%; font-size: .9rem; border-collapse: collapse; }
.print-doc .doc-meta td { padding: 3px 8px 3px 0; vertical-align: top; }
.print-doc .doc-meta td:first-child { color: #57534e; width: 150px; }
.print-doc .doc-type { margin: 28px 0 8px; padding: 8px 12px; color: #fff; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .95rem; }
.print-doc .doc-type.veg { background: var(--veg); }
.print-doc .doc-type.nonveg { background: var(--nonveg); }
.print-doc .doc-section { margin-top: 18px; break-inside: avoid-page; }
.print-doc .doc-section-title { font-weight: 700; text-transform: uppercase; font-size: .9rem; letter-spacing: .06em; border-bottom: 2px solid #111; padding-bottom: 4px; margin-bottom: 4px; }
.print-doc .doc-item { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-size: .95rem; break-inside: avoid; }
.print-doc .doc-item .dots { flex: 1; border-bottom: 1px dotted #a8a29e; transform: translateY(-4px); }
.print-doc .doc-item .num { color: #a8a29e; width: 24px; font-size: .8rem; }
.print-doc .doc-item .price { font-weight: 600; white-space: nowrap; }
.print-doc .doc-item .price.missing { color: #b45309; font-weight: 400; font-style: italic; }
.print-doc .doc-foot { margin-top: 36px; padding-top: 10px; border-top: 1px solid #e7e5e4; font-size: .8rem; color: #78716c; }

@media print {
    @page { size: A4; margin: 14mm; }
    body { background: #fff !important; }
    .app-navbar, .app-footer, .wizard-bar, .no-print, .alert, .toast-container { display: none !important; }
    .app-main { padding: 0 !important; }
    .app-main > .container { max-width: none; padding: 0; }
    .print-doc { border: 0; padding: 0; max-width: none; border-radius: 0; }
    .print-doc .doc-type { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .food-mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* --------------------------------------------------------- admin */
.admin-layout { display: flex; min-height: calc(100vh - 57px); }
.admin-sidebar { width: 240px; flex-shrink: 0; background: #1c1917; color: #d6d3d1; padding: 1rem .75rem; }
.admin-sidebar .nav-link { color: #d6d3d1; border-radius: 10px; padding: .6rem .8rem; display: flex; align-items: center; gap: .6rem; }
.admin-sidebar .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-sidebar .nav-link.active { background: var(--brand); color: #fff; }
.admin-sidebar .side-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #78716c; padding: .75rem .8rem .35rem; }
.admin-content { flex: 1; min-width: 0; padding: 1.5rem; }
.table-soft { --bs-table-bg: #fff; margin: 0; }
.table-soft thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafaf9; font-weight: 600; white-space: nowrap; }
.table-soft td { vertical-align: middle; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

@media (max-width: 991.98px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: auto; padding: .5rem; }
    .admin-sidebar .nav { flex-direction: row !important; flex-wrap: nowrap; overflow-x: auto; }
    .admin-sidebar .side-title { display: none; }
    .admin-sidebar .nav-link { white-space: nowrap; }
    .admin-content { padding: 1rem; }
}

@media (max-width: 575.98px) {
    .price-input { width: 104px; }
    .item-row { flex-wrap: wrap; }
    .item-row .item-name-input { flex-basis: calc(100% - 70px); }
    .print-doc { padding: 24px 18px; }
    .hero-icon { width: 70px; height: 70px; font-size: 2rem; }
}
