/*
 * MyCarinderia — shared design tokens and components.
 * Mobile-first. Bootstrap 5 provides the grid and utilities; this file
 * only adds the brand layer on top of it.
 */

:root {
    --mc-primary: #175734;
    --mc-primary-700: #0f3f26;
    --mc-primary-300: #2f7a4f;
    --mc-accent: #ef641b;
    --mc-accent-600: #d2550f;
    --mc-highlight: #ffbc16;
    --mc-surface: #fff9ef;

    --mc-ink: #15211b;
    --mc-muted: #5d6b63;
    --mc-line: #e3e8e3;
    --mc-card: #ffffff;
    --mc-page: #f6f7f5;

    --mc-radius: 14px;
    --mc-radius-sm: 10px;
    --mc-shadow: 0 1px 2px rgba(21, 33, 27, .06), 0 8px 24px rgba(21, 33, 27, .06);
    --mc-shadow-sm: 0 1px 2px rgba(21, 33, 27, .08);

    --mc-sidebar-w: 260px;

    /* 4 / 8 / 12 / 16 / 24 / 32 spacing scale */
    --mc-s1: 4px;
    --mc-s2: 8px;
    --mc-s3: 12px;
    --mc-s4: 16px;
    --mc-s5: 24px;
    --mc-s6: 32px;

    --bs-body-font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-color: var(--mc-ink);
    --bs-body-bg: var(--mc-page);
    --bs-link-color: var(--mc-primary);
    --bs-link-hover-color: var(--mc-primary-700);
    --bs-border-radius: var(--mc-radius-sm);
}

[data-bs-theme="dark"] {
    --mc-ink: #e8efe9;
    --mc-muted: #9bada2;
    --mc-line: #27352c;
    --mc-card: #16201a;
    --mc-page: #0e1512;
    --mc-surface: #1a241d;
    --mc-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35);
    --bs-body-color: var(--mc-ink);
    --bs-body-bg: var(--mc-page);
    --bs-link-color: #6fcf97;
}

* {
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    overflow-x: hidden;
}

body {
    font-family: var(--bs-body-font-family);
    background: var(--mc-page);
    color: var(--mc-ink);
    font-size: 15px;
    padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3, h4, h5, h6,
.mc-brandmark {
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* A section title sits closer to its own content than to the block above */
.block-title {
    margin-top: var(--mc-s6);
    margin-bottom: var(--mc-s3);
    font-size: clamp(1.05rem, 1rem + 0.3vw, 1.25rem);
    font-weight: 800;
}

.block-title:first-child,
.mc-card .block-title:first-child {
    margin-top: 0;
}

/* ---------- surfaces ---------- */

.mc-card {
    background: var(--mc-card);
    border: 1px solid var(--mc-line);
    border-radius: var(--mc-radius);
    box-shadow: var(--mc-shadow-sm);
    padding: var(--mc-s4);
}

.mc-card--flush {
    padding: 0;
    overflow: hidden;
}

.mc-card--tint {
    background: var(--mc-surface);
    border-color: color-mix(in srgb, var(--mc-highlight) 35%, var(--mc-line));
}

.mc-card-head {
    display: flex;
    flex-wrap: wrap;
    gap: var(--mc-s3);
    align-items: center;
    justify-content: space-between;
    padding: var(--mc-s4);
    border-bottom: 1px solid var(--mc-line);
}

.mc-card-head h2,
.mc-card-head h1 {
    font-size: 1.05rem;
    margin: 0;
}

/* ---------- buttons ---------- */

.btn {
    --bs-btn-border-radius: 10px;
    font-weight: 700;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-sm {
    min-height: 36px;
    font-size: .85rem;
}

.btn-primary {
    --bs-btn-bg: var(--mc-primary);
    --bs-btn-border-color: var(--mc-primary);
    --bs-btn-hover-bg: var(--mc-primary-700);
    --bs-btn-hover-border-color: var(--mc-primary-700);
    --bs-btn-active-bg: var(--mc-primary-700);
    --bs-btn-active-border-color: var(--mc-primary-700);
    --bs-btn-disabled-bg: var(--mc-primary-300);
    --bs-btn-disabled-border-color: var(--mc-primary-300);
}

.btn-accent {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--mc-accent);
    --bs-btn-border-color: var(--mc-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--mc-accent-600);
    --bs-btn-hover-border-color: var(--mc-accent-600);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--mc-accent-600);
    color: #fff;
}

.btn-outline-primary {
    --bs-btn-color: var(--mc-primary);
    --bs-btn-border-color: var(--mc-primary);
    --bs-btn-hover-bg: var(--mc-primary);
    --bs-btn-hover-border-color: var(--mc-primary);
    --bs-btn-active-bg: var(--mc-primary);
}

/* ---------- forms ---------- */

.form-control,
.form-select {
    min-height: 44px;
    /* 16px keeps iOS from zooming the viewport on focus */
    font-size: 16px;
    border-color: var(--mc-line);
    border-radius: 10px;
    background: var(--mc-card);
    color: var(--mc-ink);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--mc-primary-300);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--mc-primary) 18%, transparent);
}

.form-label {
    font-weight: 700;
    font-size: .85rem;
    margin-bottom: var(--mc-s1);
}

.form-hint {
    font-size: .78rem;
    color: var(--mc-muted);
    display: block;
    margin-top: var(--mc-s1);
}

textarea.form-control {
    min-height: 96px;
}

/* ---------- tables ---------- */

.mc-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    --bs-table-bg: transparent;
    table-layout: auto;
    width: 100%;
    margin-bottom: 0;
    color: var(--mc-ink);
    vertical-align: middle;
}

.table > thead {
    background: var(--mc-surface);
}

.table > thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--mc-muted);
    font-weight: 800;
    white-space: nowrap;
    border-bottom-color: var(--mc-line);
}

.table > tbody td,
.table > tbody th {
    border-color: var(--mc-line);
}

[data-bs-theme="dark"] .table > thead {
    background: #1b261f;
}

.col-tight {
    width: 1%;
    white-space: nowrap;
}

.col-grow {
    min-width: 180px;
}

.col-num {
    text-align: right;
    white-space: nowrap;
    width: 1%;
    font-variant-numeric: tabular-nums;
}

.col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.truncate {
    display: block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- backend shell ---------- */

.mc-shell {
    display: flex;
    min-height: 100vh;
}

.mc-sidebar {
    width: var(--mc-sidebar-w);
    flex: 0 0 var(--mc-sidebar-w);
    background: var(--mc-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1045;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto;
    transition: transform .22s ease;
}

.mc-sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--mc-s5) var(--mc-s4) var(--mc-s4);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

/* The sidebar mark is the brand logo rendered entirely in white */
.mc-sidebar__brand img {
    width: 160px;
    max-width: 100%;
    height: auto;
    filter: brightness(0) invert(1);
}

.mc-sidebar__scope {
    padding: var(--mc-s3) var(--mc-s3) var(--mc-s2);
    display: grid;
    gap: var(--mc-s2);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.mc-sidebar__scope .form-select {
    background-color: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .22);
    color: #fff;
    font-size: 14px;
    min-height: 40px;
    font-weight: 700;
}

.mc-sidebar__scope .form-select option {
    color: #15211b;
}

.mc-nav {
    padding: var(--mc-s3);
    display: grid;
    gap: 2px;
    flex: 1 1 auto;
}

.mc-nav__label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .55);
    padding: var(--mc-s3) var(--mc-s3) var(--mc-s1);
    font-weight: 800;
}

.mc-nav a {
    display: flex;
    align-items: center;
    gap: var(--mc-s3);
    padding: 10px var(--mc-s3);
    min-height: 44px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .86);
    text-decoration: none;
    font-weight: 700;
    font-size: .92rem;
}

.mc-nav a i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex: 0 0 20px;
}

.mc-nav a:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.mc-nav a.is-active {
    background: #fff;
    color: var(--mc-primary);
}

.mc-nav__foot {
    padding: var(--mc-s3);
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.mc-main {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: var(--mc-sidebar-w);
    background: var(--mc-card);
    display: flex;
    flex-direction: column;
}

.mc-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: var(--mc-s3);
    padding: var(--mc-s3) var(--mc-s4);
    background: var(--mc-card);
    border-bottom: 1px solid var(--mc-line);
    padding-top: calc(var(--mc-s3) + env(safe-area-inset-top));
}

.mc-topbar__title {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mc-content {
    padding: var(--mc-s4);
    flex: 1 1 auto;
    background: var(--mc-page);
}

.mc-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 18, 12, .45);
    z-index: 1040;
    display: none;
}

.mc-backdrop.is-open {
    display: block;
}

@media (max-width: 991.98px) {
    .mc-sidebar {
        transform: translateX(-100%);
    }

    .mc-sidebar.is-open {
        transform: translateX(0);
    }

    .mc-main {
        margin-left: 0;
    }
}

/* ---------- stat tiles ---------- */

.mc-stat {
    background: var(--mc-card);
    border: 1px solid var(--mc-line);
    border-radius: var(--mc-radius);
    padding: var(--mc-s4);
    box-shadow: var(--mc-shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--mc-s3);
    height: 100%;
    min-width: 0;
}

.mc-stat__icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    background: var(--mc-surface);
    color: var(--mc-primary);
}

.mc-stat--accent .mc-stat__icon {
    background: color-mix(in srgb, var(--mc-accent) 14%, transparent);
    color: var(--mc-accent);
}

.mc-stat--highlight {
    background: var(--mc-surface);
    border-color: color-mix(in srgb, var(--mc-highlight) 45%, var(--mc-line));
}

.mc-stat--highlight .mc-stat__icon {
    background: color-mix(in srgb, var(--mc-highlight) 30%, transparent);
    color: #9a6b00;
}

.mc-stat__value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.mc-stat__label {
    font-size: .78rem;
    color: var(--mc-muted);
    font-weight: 700;
}

/* ---------- public shell ---------- */

.mc-navbar {
    background: var(--mc-card);
    border-bottom: 1px solid var(--mc-line);
    position: sticky;
    top: 0;
    z-index: 1030;
    padding-top: env(safe-area-inset-top);
}

.mc-navbar__logo {
    height: 34px;
    width: auto;
}

.mc-navbar .nav-link {
    font-weight: 700;
    color: var(--mc-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    padding: 8px 10px;
}

.mc-navbar .nav-link.is-active {
    color: var(--mc-primary);
    background: var(--mc-surface);
}

/* ---------- discovery ---------- */

.mc-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--mc-s2);
    align-items: center;
}

.mc-filters .form-select,
.mc-filters .form-control {
    min-height: 40px;
    font-size: 15px;
    width: auto;
    min-width: 0;
}

.mc-segment {
    display: inline-flex;
    background: var(--mc-surface);
    border: 1px solid var(--mc-line);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
}

.mc-segment a,
.mc-segment button {
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 7px 12px;
    min-height: 38px;
    font-weight: 700;
    font-size: .85rem;
    color: var(--mc-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.mc-segment a.is-active,
.mc-segment button.is-active {
    background: var(--mc-primary);
    color: #fff;
}

.mc-merchant-card {
    background: var(--mc-card);
    border: 1px solid var(--mc-line);
    border-radius: var(--mc-radius);
    overflow: hidden;
    box-shadow: var(--mc-shadow-sm);
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s ease, transform .18s ease;
}

.mc-merchant-card:hover {
    box-shadow: var(--mc-shadow);
    transform: translateY(-2px);
}

.mc-merchant-card__media {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--mc-surface);
}

.mc-merchant-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mc-fav {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .92);
    color: var(--mc-muted);
    display: grid;
    place-items: center;
    font-size: 1.05rem;
    box-shadow: var(--mc-shadow-sm);
}

.mc-fav.is-on {
    background: #e23c3c;
    color: #fff;
}

.mc-merchant-card__body {
    padding: var(--mc-s3);
    display: flex;
    gap: var(--mc-s3);
    justify-content: space-between;
    flex: 1 1 auto;
    min-width: 0;
}

.mc-merchant-card__name {
    font-weight: 800;
    font-size: .98rem;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mc-meta {
    font-size: .8rem;
    color: var(--mc-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mc-price {
    text-align: right;
    white-space: nowrap;
}

.mc-price__main {
    color: var(--mc-accent);
    font-weight: 800;
    font-size: 1rem;
}

.mc-price__sub {
    font-size: .74rem;
    color: var(--mc-muted);
}

/* ---------- day tabs & meal choices ---------- */

.mc-days {
    display: flex;
    gap: var(--mc-s2);
    overflow-x: auto;
    padding-bottom: var(--mc-s1);
}

.mc-day {
    flex: 1 0 auto;
    min-width: 104px;
    border: 1px solid var(--mc-line);
    background: var(--mc-card);
    border-radius: var(--mc-radius-sm);
    padding: 10px var(--mc-s3);
    text-align: center;
    text-decoration: none;
    color: var(--mc-ink);
    font-weight: 700;
    min-height: 56px;
}

.mc-day small {
    display: block;
    font-weight: 700;
    color: var(--mc-muted);
    font-size: .76rem;
}

.mc-day.is-active {
    background: var(--mc-primary);
    border-color: var(--mc-primary);
    color: #fff;
}

.mc-day.is-active small {
    color: rgba(255, 255, 255, .78);
}

.mc-choice {
    display: block;
    cursor: pointer;
    height: 100%;
}

.mc-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mc-choice__inner {
    border: 2px solid var(--mc-line);
    border-radius: var(--mc-radius);
    overflow: hidden;
    background: var(--mc-card);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mc-choice input:checked + .mc-choice__inner {
    border-color: var(--mc-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mc-primary) 14%, transparent);
}

.mc-choice__inner img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.mc-choice__label {
    padding: 10px var(--mc-s3);
    display: flex;
    align-items: center;
    gap: var(--mc-s2);
    font-weight: 700;
    font-size: .9rem;
}

.mc-choice.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}

.mc-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--mc-line);
    flex: 0 0 16px;
}

.mc-choice input:checked + .mc-choice__inner .mc-dot {
    border-color: var(--mc-primary);
    background: var(--mc-primary);
    box-shadow: inset 0 0 0 3px #fff;
}

/* ---------- misc ---------- */

.mc-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--mc-surface);
}

.mc-banner {
    display: flex;
    gap: var(--mc-s3);
    align-items: center;
    padding: var(--mc-s3) var(--mc-s4);
    border-radius: var(--mc-radius-sm);
    background: var(--mc-surface);
    border: 1px solid color-mix(in srgb, var(--mc-highlight) 45%, var(--mc-line));
    font-weight: 700;
    font-size: .92rem;
}

.mc-banner--alert {
    background: color-mix(in srgb, var(--mc-accent) 10%, transparent);
    border-color: color-mix(in srgb, var(--mc-accent) 35%, transparent);
}

.mc-countdown {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--mc-accent);
}

.mc-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--mc-s4);
    background:
        radial-gradient(1200px 400px at 50% -200px, color-mix(in srgb, var(--mc-highlight) 25%, transparent), transparent),
        var(--mc-page);
}

.mc-auth__card {
    width: 100%;
    max-width: 420px;
}

.mc-accordion .accordion-button:not(.collapsed) {
    background: var(--mc-surface);
    color: var(--mc-primary);
    font-weight: 800;
    box-shadow: none;
}

.mc-accordion .accordion-button:focus {
    box-shadow: none;
    border-color: var(--mc-line);
}

.img-fit-cover {
    object-fit: cover;
}

.img-fit-contain {
    object-fit: contain;
}

img {
    max-width: 100%;
    height: auto;
}

.min-w-0 {
    min-width: 0;
}

.page-link {
    color: var(--mc-primary);
}

.active > .page-link,
.page-link.active {
    background-color: var(--mc-primary);
    border-color: var(--mc-primary);
}

@media (max-width: 575.98px) {
    .mc-content {
        padding: var(--mc-s3);
    }

    .hide-xs {
        display: none !important;
    }
}
