@import url('https://fonts.googleapis.com/css2?family=Bellefair&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --navy:        #0f1923;
    --navy-2:      #1a2a38;
    --navy-3:      #243447;
    --gold:        #c9a453;
    --gold-hover:  #b8913e;
    --green:       #16a34a;
    --green-bg:    #dcfce7;
    --red:         #dc2626;
    --red-bg:      #fee2e2;
    --bg:          #f5f6fa;
    --surface:     #ffffff;
    --border:      #e4e7ec;
    --border-2:    #d0d5dd;
    --text:        #374151;
    --text-2:      #6b7280;
    --text-3:      #9ca3af;
    --heading:     #111827;
    --radius-sm:   6px;
    --radius:      10px;
    --radius-lg:   14px;
    --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow:      0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
    --shadow-lg:   0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ───────────────────────────────────────────
   LOGIN
─────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
    background-image: radial-gradient(ellipse at 60% 20%, rgba(201,164,83,.12) 0%, transparent 60%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-brand {
    background: var(--navy);
    padding: 32px 40px 28px;
    text-align: center;
    border-bottom: 2px solid var(--gold);
}

.login-brand h1 {
    font-family: 'Bellefair', serif;
    font-size: 26px;
    font-weight: 400;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 4px;
}

.login-brand p {
    font-size: 11px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
}

.login-body {
    padding: 36px 40px 40px;
}

.login-body .form-group { margin-bottom: 20px; }

.login-body .btn-primary {
    margin-top: 8px;
}

/* ───────────────────────────────────────────
   TOPBAR
─────────────────────────────────────────── */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--navy);
    border-bottom: 2px solid var(--gold);
    padding: 0 28px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.header-logo {
    font-family: 'Bellefair', serif;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-logo span {
    color: var(--gold);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color .15s;
    white-space: nowrap;
}

.back-link::before { content: '←'; font-size: 14px; }

.back-link:hover { color: #fff; }

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--navy);
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    color: rgba(255,255,255,.7);
    font-weight: 500;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ───────────────────────────────────────────
   LAYOUT
─────────────────────────────────────────── */
.admin-main {
    max-width: 1040px;
    margin: 28px auto;
    padding: 0 20px;
}

/* ───────────────────────────────────────────
   PAGE HEADER
─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    font-family: 'Bellefair', serif;
    font-size: 26px;
    font-weight: 400;
    color: var(--heading);
    letter-spacing: .5px;
}

/* ───────────────────────────────────────────
   ALERTS
─────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--green-bg);
    color: #166534;
    border-color: #86efac;
}

.alert-success::before { content: '✓'; font-weight: 700; }

.alert-error {
    background: var(--red-bg);
    color: #991b1b;
    border-color: #fca5a5;
}

.alert-error::before { content: '!'; font-weight: 700; }

/* ───────────────────────────────────────────
   BUTTONS
─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all .15s ease;
    line-height: 1;
    letter-spacing: .01em;
}

.btn:active { transform: translateY(1px); }

.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn-full { width: 100%; }

/* Primary — navy */
.btn-primary {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }

/* Gold */
.btn-gold {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
}
.btn-gold:hover { background: var(--gold-hover); border-color: var(--gold-hover); }

/* Success */
.btn-success {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
.btn-success:hover { background: #15803d; border-color: #15803d; }

/* Danger */
.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* Outline */
.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border-2);
}
.btn-outline:hover { background: var(--bg); border-color: var(--border-2); color: var(--heading); }

/* Outline in header */
.admin-header .btn-outline {
    color: rgba(255,255,255,.75);
    border-color: rgba(255,255,255,.2);
    font-size: 12px;
    padding: 6px 14px;
}
.admin-header .btn-outline:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
    border-color: rgba(255,255,255,.35);
}

/* ───────────────────────────────────────────
   FORMS
─────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--heading);
    text-transform: uppercase;
    letter-spacing: .6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.item-name-input,
.item-price-input,
.item-type-select,
.day-select {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.item-name-input:focus,
.item-price-input:focus,
.item-type-select:focus,
.day-select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,164,83,.18);
}

.form-group input::placeholder,
.item-name-input::placeholder { color: var(--text-3); }

/* ───────────────────────────────────────────
   TABLE / CARD LIST
─────────────────────────────────────────── */
.table-wrapper {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead tr {
    background: var(--navy);
}

.data-table th {
    padding: 13px 18px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.65);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: background .1s;
}

.data-table tbody tr:hover { background: #fafbfc; }

.data-table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.inline-form { display: inline; }

/* ───────────────────────────────────────────
   BADGES
─────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.badge-success {
    background: var(--green-bg);
    color: #166534;
}

.badge-success::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}

.badge-muted {
    background: #f3f4f6;
    color: var(--text-2);
}

/* ───────────────────────────────────────────
   EMPTY STATE
─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.empty-state-icon {
    font-size: 40px;
    margin-bottom: 16px;
    opacity: .4;
}

.empty-state p {
    color: var(--text-2);
    font-size: 15px;
    margin-bottom: 20px;
}

/* ───────────────────────────────────────────
   MENU EDITOR — day blocks
─────────────────────────────────────────── */
.editor-title-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.editor-title-row .form-group { margin-bottom: 0; }

.editor-title-row label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .7px;
    margin-bottom: 6px;
    display: block;
}

.day-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    overflow: visible;
    transition: box-shadow .15s;
}
/* Keep border-radius visible on header */
.day-block > .day-header:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.day-block:focus-within {
    box-shadow: var(--shadow), 0 0 0 2px rgba(201,164,83,.2);
}

.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: var(--navy);
    border-bottom: 2px solid var(--gold);
}

.day-select {
    width: auto;
    font-family: 'Bellefair', serif;
    font-size: 17px;
    font-weight: 400;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,.08);
    color: #fff;
    letter-spacing: 1px;
    cursor: pointer;
}

.day-select option { background: var(--navy-2); color: #fff; }

.day-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,164,83,.25);
}

.items-container {
    padding: 14px 18px 6px;
}

.item-row {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    transition: background .1s;
}
.item-row:hover { background: #fafbfc; }

.item-type-select {
    width: 108px;
    padding: 8px 10px;
    flex-shrink: 0;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
}

.item-name-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.item-price-input {
    width: 86px;
    padding: 8px 10px;
    text-align: right;
    font-size: 14px;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

.add-item-row {
    padding: 8px 18px 14px;
}

/* ── Item rows (main + detail) ── */
.item-main-row {
    display: flex;
    width: 100%;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}

.item-detail-row {
    display: flex;
    width: 100%;
    gap: 8px;
    align-items: center;
    padding-left: 30px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    clear: both;
}

.item-name-en-input {
    flex: 1;
    min-width: 160px;
    padding: 6px 10px;
    font-size: 12px;
    font-style: italic;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    color: var(--text-2);
    background: var(--surface);
    transition: border-color .15s;
}
.item-name-en-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,164,83,.15);
}
.item-name-en-input::placeholder { color: var(--text-3); font-style: italic; }

/* ── Drag handle ── */
.drag-handle {
    cursor: grab;
    color: var(--text-3);
    font-size: 16px;
    padding: 4px 2px;
    flex-shrink: 0;
    user-select: none;
    transition: color .15s;
}
.drag-handle:hover { color: var(--gold); }
.drag-handle:active { cursor: grabbing; }

.sortable-ghost {
    opacity: .4;
    background: #f0f4ff;
    border-radius: var(--radius-sm);
}

/* ── Allergen toggles ── */
.allergen-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.allergen-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
    margin-right: 2px;
}

.allergen-btn {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    flex-shrink: 0;
}
.allergen-btn:hover { border-color: var(--gold); color: var(--gold); }
.allergen-btn.active {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}

/* ── Email compose — contact checkboxes ── */
.contact-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .1s;
    margin-bottom: 4px;
}
.contact-checkbox-row:hover { background: var(--bg); }
.contact-checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--gold); flex-shrink: 0; }
.contact-name { font-weight: 600; color: var(--heading); font-size: 14px; }
.contact-email { color: var(--text-2); font-size: 13px; margin-left: auto; }

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.day-counter {
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}

.form-submit {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid var(--gold);
}

/* ───────────────────────────────────────────
   IFRAME INFO CARD
─────────────────────────────────────────── */
.info-card {
    margin-top: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.info-card-header {
    padding: 14px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card-header h3 {
    font-family: 'Bellefair', serif;
    font-size: 17px;
    font-weight: 400;
    color: var(--heading);
    letter-spacing: .3px;
}

.info-card-body { padding: 20px; }

.info-card-body p {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 12px;
}

.iframe-code {
    display: block;
    background: var(--navy);
    color: var(--gold);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 12.5px;
    word-break: break-all;
    line-height: 1.7;
    user-select: all;
    cursor: text;
}

/* ───────────────────────────────────────────
   RESPONSIVE — Tablet ≤ 768px
─────────────────────────────────────────── */
@media (max-width: 768px) {
    .admin-header { padding: 0 16px; height: 52px; }
    .header-logo { font-size: 15px; letter-spacing: 2px; }
    .admin-main { padding: 0 14px; margin: 18px auto; }

    .page-header { flex-direction: column; align-items: stretch; }
    .page-header .btn { text-align: center; }
    .page-title { font-size: 22px; }

    /* Table → card layout */
    .data-table thead { display: none; }
    .data-table, .data-table tbody,
    .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr {
        border-bottom: none;
        border-radius: var(--radius);
        margin-bottom: 12px;
        padding: 16px;
        box-shadow: var(--shadow-sm);
        background: var(--surface);
        border: 1px solid var(--border);
    }
    .data-table td { padding: 4px 0; border-bottom: none; }
    .data-table td:first-child { font-size: 16px; font-weight: 600; padding-bottom: 8px; }
    .table-wrapper { background: transparent; border: none; box-shadow: none; border-radius: 0; }

    /* Dashboard actions — 2-column grid */
    .data-table .actions {
        margin-top: 12px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .data-table .actions .btn-sm { text-align: center; }
    .data-table .actions .btn-danger { grid-column: 1 / -1; }

    /* Editor — form submit */
    .form-submit { flex-direction: column; }
    .form-submit .btn { width: 100%; }

    /* Day header — allow wrap on small tablet */
    .day-header { flex-wrap: wrap; gap: 8px; }
    .day-select { flex: 1; min-width: 120px; }

    /* Item detail row — allergens wrap */
    .item-detail-row { padding-left: 0; gap: 6px; }
}

/* ───────────────────────────────────────────
   RESPONSIVE — Mobile ≤ 480px
─────────────────────────────────────────── */
@media (max-width: 480px) {
    .admin-header { padding: 0 12px; height: 48px; }
    .header-logo { letter-spacing: 1.5px; font-size: 14px; }
    .user-name { display: none; }
    .back-link span { display: none; }

    .login-brand { padding: 24px 24px 20px; }
    .login-brand h1 { font-size: 20px; letter-spacing: 3px; }
    .login-body { padding: 24px 24px 28px; }

    .items-container { padding: 10px 12px 4px; }
    .add-item-row { padding: 6px 12px 12px; }

    /* Item main row — 2-line layout on mobile */
    .item-main-row { flex-wrap: wrap; gap: 6px; }
    .drag-handle { order: 0; align-self: center; }
    .item-type-select { order: 1; width: calc(100% - 30px); flex: 1; }
    .item-name-input { order: 2; width: 100%; flex: 1 0 100%; }
    .item-price-input { order: 3; flex: 1; min-width: 80px; text-align: left; }
    .item-main-row .remove-item-btn { order: 4; flex-shrink: 0; }

    /* Item detail row */
    .item-detail-row { padding-left: 0; }
    .item-name-en-input { min-width: 0; width: 100%; }

    /* Allergen buttons — compact grid */
    .allergen-btn { width: 24px; height: 24px; font-size: 10px; }
    .allergen-wrap { gap: 3px; }
    .allergen-label { width: 100%; margin-bottom: 2px; }

    /* Day header stack */
    .day-header { flex-direction: column; align-items: stretch; gap: 8px; }
    .day-select { width: 100%; }
    .remove-day-btn { width: 100%; }

    /* form actions */
    .form-actions { flex-wrap: wrap; }
}
