/*
 * components/mobile-drawer.css
 *
 * What:  Slide-in side drawer for mobile. Off-canvas to the right; the
 *        panel translates into view when .mobile-drawer[aria-hidden="false"].
 *        Desktop never sees this — the @media (min-width: 768px) rule at
 *        the bottom forces it hidden.
 * Why:   Mobile header only has room for logo + location + hamburger. This
 *        is what the hamburger opens — secondary nav + auth + legal.
 * Used:  Loaded by views/_layout.ejs via its own <link> tag.
 */

.mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
}
.mobile-drawer[aria-hidden="false"] { pointer-events: auto; }
.mobile-drawer[aria-hidden="true"]  { display: flex; }   /* keep in DOM for transition */

.mobile-drawer__backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(20, 20, 20, 0.45);
    opacity: 0;
    transition: opacity 180ms ease;
}
.mobile-drawer[aria-hidden="false"] .mobile-drawer__backdrop { opacity: 1; }

.mobile-drawer__panel {
    position: relative;
    width: min(400px, 92vw);
    height: 100dvh;
    background-color: #f3f4f6;
    box-shadow: var(--shadow-3);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 220ms ease;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4) var(--space-8);
}
.mobile-drawer[aria-hidden="false"] .mobile-drawer__panel {
    transform: translateX(0);
}

/* ── Profile menu redesign (md-*) ──────────────────────────────────── */
.md-head { display: flex; }
.md-back { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; color: var(--color-text); cursor: pointer; margin-left: -8px; }

.md-profile { display: flex; align-items: center; gap: var(--space-3); background: #fff; border-radius: var(--radius-lg); padding: var(--space-4); }
.md-profile__avatar { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%; background: #dbeafe; color: #2563eb; display: grid; place-items: center; font-size: 1.25rem; font-weight: 800; }
.md-profile__body { min-width: 0; }
.md-profile__name { font-size: 1.05rem; font-weight: 800; margin: 0; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; }
.md-profile__edit { display: inline-block; margin-top: 3px; color: var(--color-primary); font-weight: 700; font-size: 0.85rem; text-decoration: none; }

.md-rewards { display: flex; align-items: center; gap: var(--space-3); background: #1c1c22; border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); text-decoration: none; }
.md-rewards__crown { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #5a4a1f, #2a2412); color: #f5c451; }
.md-rewards__text { flex: 1 1 auto; color: #f5c451; font-weight: 800; font-size: 0.92rem; }
.md-rewards__chev { color: #f5c451; font-size: 1.2rem; }

.md-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.md-tile--full { grid-column: 1 / -1; }
.md-tile--full .md-tile__body { flex: 1; }
.md-tile { display: flex; align-items: center; gap: var(--space-2); background: #fff; border: 0; border-radius: var(--radius-lg); padding: var(--space-3) var(--space-3); cursor: pointer; text-align: left; text-decoration: none; color: var(--color-text); }
.md-tile__icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--color-bg-alt); display: grid; place-items: center; color: var(--color-text); }
.md-tile__label { display: block; font-weight: 700; font-size: 0.82rem; }
.md-tile__value { display: block; color: #16a34a; font-weight: 800; font-size: 0.82rem; }

.md-sec { margin-top: var(--space-2); }
.md-sec__title { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; font-weight: 800; margin: 0 0 var(--space-2); padding-left: 10px; position: relative; }
.md-sec__title::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 4px; border-radius: 2px; background: var(--color-primary); }
.md-card { background: #fff; border-radius: var(--radius-lg); overflow: hidden; }

.md-row { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: 12px var(--space-4); background: none; border: 0; border-bottom: 1px solid var(--color-border-soft); cursor: pointer; text-align: left; text-decoration: none; color: var(--color-text); font: inherit; }
.md-row:last-child { border-bottom: 0; }
.md-row:hover { background: var(--color-bg-alt); }
.md-row__icon { flex: 0 0 auto; width: 24px; display: inline-flex; justify-content: center; color: var(--color-text); }
.md-row__icon--veg { width: 20px; height: 20px; border: 2px solid #16a34a; border-radius: 5px; align-items: center; }
.md-row__icon--veg span { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; }
.md-row__label { flex: 1 1 auto; font-weight: 600; font-size: 0.92rem; }
.md-row__value { color: var(--color-text-soft); font-weight: 600; font-size: 0.88rem; }
.md-row__chev { color: var(--color-text-soft); font-size: 1.15rem; line-height: 1; }

/* toggle switch */
.md-switch { position: absolute; opacity: 0; width: 0; height: 0; }
.md-switch__ui { flex: 0 0 auto; width: 42px; height: 24px; border-radius: 999px; background: var(--color-border); position: relative; transition: background 140ms ease; }
.md-switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform 140ms ease; }
.md-switch:checked + .md-switch__ui { background: var(--color-primary); }
.md-switch:checked + .md-switch__ui::after { transform: translateX(18px); }

.md-social { list-style: none; display: flex; gap: var(--space-3); justify-content: center; margin: var(--space-3) 0 0; padding: 0; }
.md-social a { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--color-text-muted); }
.md-social a:hover { color: var(--color-primary); }
.md-copy { text-align: center; font-size: 0.74rem; color: var(--color-text-soft); margin: var(--space-2) 0 0; }
.md-build { opacity: 0.7; }
.md-logout { margin-top: var(--space-3); }
.md-logout__btn { width: 100%; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 14px; font-weight: 700; color: var(--color-primary); cursor: pointer; }

/* ── Head ──────────────────────────────────────────────────────── */

.mobile-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.mobile-drawer__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    color: var(--color-text);
}
.mobile-drawer__brand img { border-radius: var(--radius-sm); }

.mobile-drawer__close {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background-color: var(--color-bg-alt);
    color: var(--color-text);
    transition: background-color 120ms ease;
}
.mobile-drawer__close:hover { background-color: var(--color-border); }

/* ── Auth row ──────────────────────────────────────────────────── */

.mobile-drawer__auth {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.mobile-drawer__account {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text);
}
.mobile-drawer__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
}
.mobile-drawer__account-name { font-weight: 600; }

/* ── Nav links ─────────────────────────────────────────────────── */

.mobile-drawer__nav {
    display: flex;
    flex-direction: column;
}
.mobile-drawer__link {
    padding: var(--space-3) var(--space-2);
    border-bottom: 1px solid var(--color-border-soft);
    color: var(--color-text);
    font-weight: 500;
    transition: color 120ms ease, background-color 120ms ease;
}
.mobile-drawer__link:hover {
    color: var(--color-primary);
    background-color: var(--color-primary-soft);
    border-radius: var(--radius-sm);
}

/* ── Footer band inside the drawer ─────────────────────────────── *
 * The mobile site footer is hidden, so this band carries everything
 * that used to live in views/partials/footer.ejs (link columns,
 * social icons, copyright). Visually separated from the primary nav
 * above with a hairline top border + extra top padding. */
.mobile-drawer__footer {
    margin-top: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border-soft);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* Each link group ("Company", "For restaurants", "Help & legal") is
 * a stacked column with a small uppercase heading and a tight list
 * of sub-links underneath. */
.mobile-drawer__group {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.mobile-drawer__group-title {
    margin: 0 0 var(--space-1);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* `.mobile-drawer__link--sub` is the smaller variant for footer-band
 * links — tighter row height + slightly muted colour so the primary
 * nav above still reads as the main destinations. */
.mobile-drawer__link--sub {
    padding: 0.55rem var(--space-1);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--color-text-muted);
    border-bottom: 0;
}
.mobile-drawer__link--sub:hover {
    color: var(--color-primary);
    background: transparent;
}

/* Social row — three icons centred in a horizontal strip with a
 * subtle ring on hover. Matches the desktop footer's icon set. */
.mobile-drawer__social {
    list-style: none;
    margin: var(--space-2) 0 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.mobile-drawer__social a {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-text-muted);
    background-color: var(--color-bg-alt);
    transition: background-color 120ms ease, color 120ms ease;
}
.mobile-drawer__social a:hover {
    background-color: var(--color-primary-soft);
    color: var(--color-primary);
}

.mobile-drawer__copy {
    margin: var(--space-2) 0 0;
    font-size: 0.75rem;
    color: var(--color-text-soft);
    line-height: 1.4;
}
.mobile-drawer__build { color: var(--color-text-soft); opacity: 0.7; }

.mobile-drawer__logout { margin-top: var(--space-3); }

/* Desktop hides the drawer entirely — the desktop header already has
 * the secondary nav + auth buttons inline. */
@media (min-width: 768px) {
    .mobile-drawer { display: none !important; }
}

/* Body lock — when the drawer is open we kill page scroll. The class
 * is toggled from /js/app.js to keep the source of truth in JS. */
body.is-mobile-menu-open { overflow: hidden; }
