/* ============================================================
   Marutham Farm House — UI
   Light theme. Inter (UI) + Fraunces (display headings).
   ============================================================ */

:root {
    --bg:            #f4f2ee;
    --surface:       #ffffff;
    --surface-2:     #faf8f4;
    --surface-3:     #f0ede6;

    --text:          #1b211d;
    --text-muted:    #6a736c;
    --text-faint:    #97a09a;

    --border:        #e6e2d9;
    --border-strong: #d8d3c7;

    --accent:        #2f7d4f;
    --accent-strong: #256640;
    --accent-soft:   #e7f2ea;
    --accent-ink:    #ffffff;

    --sidebar-bg:    #1c2621;
    --sidebar-bg-2:  #223029;
    --sidebar-text:  #b7c1b9;
    --sidebar-muted: #7f8c83;

    --ok:      #1f7a45;   --ok-bg:      #e6f4ea;
    --warn:    #8a5a00;   --warn-bg:    #fbf0d6;
    --danger:  #b3261e;   --danger-bg:  #fdeceb;
    --info:    #1f5f8b;   --info-bg:    #e7f1f8;

    --radius:    14px;
    --radius-sm: 9px;
    --radius-xs: 6px;

    --shadow-sm: 0 1px 2px rgba(20, 28, 22, .06);
    --shadow:    0 1px 3px rgba(20, 28, 22, .06), 0 10px 28px -12px rgba(20, 28, 22, .16);
    --shadow-lg: 0 24px 60px -20px rgba(20, 28, 22, .28);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;

    --maxw: 1080px;
    --sidebar-w: 244px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; color: var(--text); }
h1 { font-size: 1.9rem; margin: 0 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 1.6rem 0 .7rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin: .5rem 0 1rem; }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85em; background: var(--surface-3);
    padding: .12em .38em; border-radius: var(--radius-xs);
}
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.muted { color: var(--text-muted); }

/* ---------- brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.02rem; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__mark {
    width: 22px; height: 22px; border-radius: 7px; flex: none;
    background: linear-gradient(140deg, var(--accent), #6fae7d);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}

/* ============================================================
   Public site layout
   ============================================================ */
.site-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner {
    max-width: var(--maxw); margin: 0 auto; padding: .85rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.site-nav { display: flex; align-items: center; gap: 1.1rem; }
.site-nav a { color: var(--text-muted); font-weight: 500; }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav form { margin: 0; }

.site-main { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.5rem 5rem; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.site-footer__inner {
    max-width: var(--maxw); margin: 0 auto; padding: 1.6rem 1.5rem;
    display: flex; gap: .6rem; align-items: baseline; color: var(--text-muted); font-size: .875rem;
}

/* ============================================================
   Auth (blank) layout
   ============================================================ */
.auth-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem;
    background:
        radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 60%),
        var(--bg);
}
.auth-box { width: 100%; max-width: 400px; }
.auth-box .brand { justify-content: center; width: 100%; margin-bottom: 1.1rem; font-size: 1.1rem; }
.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; box-shadow: var(--shadow); padding: 2rem;
}
.auth-card h1 { font-size: 1.4rem; margin-bottom: 1.1rem; }
.auth-card .btn, .auth-card .button { width: 100%; justify-content: center; }
.auth-foot { text-align: center; margin-top: 1.1rem; font-size: .875rem; }

/* ============================================================
   Admin shell
   ============================================================ */
.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex: none;
    position: fixed; inset: 0 auto 0 0; z-index: 30;
    background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; padding: 1.1rem .8rem;
}
.sidebar__brand {
    display: flex; align-items: center; gap: .6rem;
    color: #fff; font-weight: 600; font-size: .98rem; text-decoration: none;
    padding: .4rem .5rem 1rem;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__nav a {
    display: flex; align-items: center; gap: .7rem;
    padding: .58rem .65rem; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-weight: 500; font-size: .9rem; text-decoration: none;
    transition: background .12s, color .12s;
}
.sidebar__nav a:hover { background: var(--sidebar-bg-2); color: #fff; }
.sidebar__nav a.is-active { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar__label {
    text-transform: uppercase; font-size: .68rem; letter-spacing: .09em;
    color: var(--sidebar-muted); padding: 1rem .65rem .35rem;
}
.ico { width: 18px; height: 18px; flex: none; }

.sidebar__foot { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.sidebar__user { display: flex; align-items: center; gap: .6rem; padding: .5rem .4rem; }
.avatar {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    background: var(--accent); color: #fff; font-weight: 600; font-size: .85rem;
    display: grid; place-items: center;
}
.sidebar__user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sidebar__user-meta strong { color: #fff; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-meta small { color: var(--sidebar-muted); font-size: .72rem; }
.sidebar__link { color: var(--sidebar-text); font-size: .82rem; padding: .2rem .4rem; }
.sidebar__link:hover { color: #fff; }
.sidebar__foot form { margin: 0; }
.sidebar__foot .btn-link { color: var(--sidebar-muted); font-size: .82rem; padding: .2rem .4rem; text-align: left; }
.sidebar__foot .btn-link:hover { color: #fff; }

.admin-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0 1.75rem; height: 62px;
    background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar__title { font-size: 1.15rem; margin: 0; }
.topbar__meta { color: var(--text-muted); font-size: .85rem; }
.admin-content { padding: 1.75rem; max-width: 1120px; width: 100%; }

/* ============================================================
   Impersonation banner
   ============================================================ */
.imp-banner {
    background: #7c3a12; color: #fff;
    display: flex; align-items: center; justify-content: center; gap: 1rem;
    padding: .5rem 1rem; font-size: .85rem;
}
.imp-banner form { margin: 0; }
.imp-banner .btn-link { color: #fff; }

/* ============================================================
   Buttons
   ============================================================ */
.btn, .button {
    --btn-bg: var(--accent); --btn-ink: var(--accent-ink); --btn-bd: var(--accent);
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .6rem 1.05rem; border-radius: var(--radius-sm);
    background: var(--btn-bg); color: var(--btn-ink);
    border: 1px solid var(--btn-bd); font: inherit; font-weight: 600; font-size: .9rem;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: filter .12s, transform .04s, box-shadow .12s;
}
.btn:hover, .button:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active, .button:active { transform: translateY(1px); }
.btn:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn--primary { --btn-bg: var(--accent); --btn-ink: #fff; --btn-bd: var(--accent); }
.btn--danger, .button-danger { --btn-bg: var(--danger); --btn-ink: #fff; --btn-bd: var(--danger); }
.btn--ghost {
    --btn-bg: var(--surface); --btn-ink: var(--text); --btn-bd: var(--border-strong);
}
.btn--ghost:hover { --btn-bg: var(--surface-2); filter: none; }
.btn--sm { padding: .4rem .7rem; font-size: .82rem; }

.btn-link, .link-button {
    background: none; border: 0; padding: 0; margin: 0;
    color: var(--accent-strong); cursor: pointer; font: inherit; font-weight: 500;
    text-decoration: underline; text-underline-offset: 2px;
}
.btn-link:hover, .link-button:hover { color: var(--text); }

/* ============================================================
   Cards / panels / notices
   ============================================================ */
.card, .panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.4rem;
}
.panel { margin: 1.25rem 0; }
.panel h2 { margin-top: 0; }

.card-grid {
    list-style: none; margin: 1.5rem 0; padding: 0;
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}
.card h2 { margin-top: 0; font-size: 1.1rem; }
.card-image {
    width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
    border-radius: var(--radius-sm); margin-bottom: .7rem; background: var(--surface-3);
}

.hero { padding: 1.5rem 0 .5rem; }
.hero h1 { font-size: 2.3rem; }
.hero p { color: var(--text-muted); font-size: 1.05rem; }

.notice {
    background: var(--accent-soft);
    border: 1px solid #cfe6d7; border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm); padding: .85rem 1.05rem; margin: 1.4rem 0;
    font-size: .88rem; color: #2a4636;
}

.alert { border-radius: var(--radius-sm); padding: .8rem 1rem; margin: 0 0 1rem; font-size: .9rem; }
.alert--success, .alert-success { background: var(--ok-bg); color: var(--ok); }
.alert--error, .alert-error { background: var(--danger-bg); color: var(--danger); }
.alert--info { background: var(--info-bg); color: var(--info); }
.alert ul { margin: 0; padding-left: 1.1rem; }

/* ============================================================
   Stat cards
   ============================================================ */
.stat-grid {
    display: grid; gap: 1rem; margin: 1.4rem 0;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
}
.stat {
    position: relative; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 1.15rem 1.2rem;
}
.stat::before {
    content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
    background: var(--accent); opacity: .8;
}
.stat-value {
    display: block; font-family: var(--font-display);
    font-size: 1.9rem; font-weight: 600; letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    display: block; margin-top: .15rem;
    color: var(--text-muted); font-size: .72rem;
    text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
}

/* ============================================================
   Tables
   ============================================================ */
.data-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
    margin: 1.1rem 0; font-size: .9rem;
}
.data-table th, .data-table td {
    text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table thead th {
    background: var(--surface-2);
    font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); font-weight: 700;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table.data-table--kv th { width: 40%; color: var(--text-muted); font-weight: 500; background: var(--surface); text-transform: none; letter-spacing: 0; font-size: .9rem; }

.table-scroll { overflow-x: auto; }

/* ============================================================
   Badges / pills
   ============================================================ */
.status-badge, .badge {
    display: inline-block; font-size: .72rem; font-weight: 600;
    padding: .2rem .55rem; border-radius: 999px;
    background: var(--surface-3); color: var(--text-muted);
    text-transform: capitalize; letter-spacing: .01em; white-space: nowrap;
}
.status-confirmed, .status-active, .status-completed, .status-checked_out { background: var(--ok-bg); color: var(--ok); }
.status-checked_in { background: #dcefff; color: #1f5f8b; }
.status-cancelled, .status-no_show, .status-disabled, .status-inactive, .status-expired, .status-failed { background: var(--danger-bg); color: var(--danger); }
.status-hold, .status-pending_payment, .status-pending_approval, .status-scheduled, .status-requires_action { background: var(--warn-bg); color: var(--warn); }

.pill-list { list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; padding: 0; margin: .6rem 0; }
.pill-list li {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: .3rem .8rem; font-size: .82rem; color: var(--text-muted);
}

/* ============================================================
   Forms
   ============================================================ */
.stacked-form, .auth-card form { display: grid; gap: 1rem; }
.stacked-form { max-width: 34rem; }
label { display: grid; gap: .35rem; font-size: .82rem; font-weight: 600; color: var(--text-muted); }
input, select, textarea {
    font: inherit; color: var(--text);
    padding: .6rem .7rem; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); background: var(--surface);
    width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
label.checkbox { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 500; }
label.checkbox input { width: auto; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 1.1rem; padding: 1.1rem 1.2rem; }
legend { padding: 0 .45rem; color: var(--text-muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.inline-form { margin: 1rem 0; }

/* ============================================================
   Misc page furniture
   ============================================================ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.6rem 0 .8rem; }
.page-head h1, .page-head h2 { margin: 0; }
.page-head:first-child { margin-top: .2rem; }
.breadcrumb { color: var(--text-muted); font-size: .82rem; margin-bottom: 1rem; }
.breadcrumb a { color: var(--text-muted); }
.photo-strip { display: flex; gap: .6rem; overflow-x: auto; margin: 1rem 0; padding-bottom: .3rem; }
.photo-strip img { height: 13rem; border-radius: var(--radius-sm); }

.error-page { max-width: 34rem; margin: 8vh auto; text-align: center; padding: 0 1.25rem; }
.error-code { font-family: var(--font-display); font-size: 3.5rem; font-weight: 600; color: var(--text-faint); margin: 0; }

/* ============================================================
   Calendar
   ============================================================ */
.cal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cal-title h2 { margin: 0; }
.cal-nav { display: flex; gap: .4rem; }

.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
    background: var(--border); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.cal-weekday {
    background: var(--surface-2); padding: .5rem .6rem;
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); font-weight: 700; text-align: center;
}
.cal-cell { background: var(--surface); min-height: 7.5rem; padding: .4rem .45rem; display: flex; flex-direction: column; gap: 3px; }
.cal-cell--empty { background: var(--surface-2); }
.cal-cell--today { background: var(--accent-soft); }
.cal-daynum { font-size: .78rem; font-weight: 600; color: var(--text-muted); text-align: right; }
.cal-cell--today .cal-daynum { color: var(--accent-strong); }
.cal-chip {
    display: flex; flex-direction: column; line-height: 1.2;
    padding: .2rem .4rem; border-radius: var(--radius-xs);
    background: var(--surface-3); font-size: .72rem; overflow: hidden;
    border-left: 3px solid var(--text-faint);
}
.cal-chip__code { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip__name { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.status-confirmed { background: var(--ok-bg); border-left-color: var(--ok); }
.cal-chip.status-checked_in { background: #dcefff; border-left-color: #1f5f8b; }
.cal-chip.status-hold, .cal-chip.status-pending_payment, .cal-chip.status-pending_approval { background: var(--warn-bg); border-left-color: var(--warn); }
.cal-more { font-size: .7rem; color: var(--text-muted); padding-left: .2rem; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin: .9rem 0; font-size: .8rem; color: var(--text-muted); }
.cal-legend .dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .35rem; vertical-align: middle; background: var(--text-faint); }
.cal-legend .dot.status-confirmed { background: var(--ok); }
.cal-legend .dot.status-checked_in { background: #1f5f8b; }
.cal-legend .dot.status-hold, .cal-legend .dot.status-pending_payment, .cal-legend .dot.status-pending_approval { background: var(--warn); }

/* ============================================================
   Booking flow
   ============================================================ */
.search-bar {
    display: flex; flex-wrap: wrap; gap: .8rem; align-items: end;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 1rem 1.1rem; margin: 1.25rem 0 1.75rem;
}
.search-bar label { flex: 1 1 8rem; }
.search-bar input[type="number"] { max-width: 6rem; }
.search-bar .btn { flex: 0 0 auto; }

.card-grid--wide { grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); }

.room-result { display: flex; flex-direction: column; }
.room-result__body { flex: 1; }
.room-result__price {
    border-top: 1px solid var(--border); margin-top: .8rem; padding-top: .8rem;
    display: flex; flex-direction: column; gap: .35rem; align-items: flex-start;
}
.price-total { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; }
.room-result__price .btn { align-self: stretch; text-align: center; }

.reserve-layout { display: grid; gap: 1.25rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 820px) { .reserve-layout { grid-template-columns: 1.4fr 1fr; } }
.reserve-summary { position: sticky; top: 1.5rem; }

.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .2rem 0 1.2rem; }
.chip {
    display: inline-block; padding: .3rem .7rem; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: .8rem; color: var(--text-muted); text-decoration: none; text-transform: capitalize;
}
.chip:hover { color: var(--text); text-decoration: none; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.detail-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; margin: 1.25rem 0; }
@media (min-width: 760px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-grid > .panel, .detail-grid > .card { margin: 0; }

.action-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.action-row form { margin: 0; }

.cal-chip { text-decoration: none; color: inherit; }
.cal-chip:hover { text-decoration: none; filter: brightness(.97); }

/* Room management */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .4rem .8rem; }
.photo-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .8rem; margin-bottom: .5rem; }
.photo-admin { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.photo-admin.is-cover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.photo-admin img { width: 100%; height: 6.5rem; object-fit: cover; display: block; }
.photo-admin figcaption { padding: .35rem .45rem; display: flex; flex-direction: column; gap: .3rem; }
.photo-admin .action-row { gap: .3rem; }
.photo-admin .action-row form { margin: 0; }
.photo-admin .btn-link { font-size: .78rem; }
.rooms-form .form-row { align-items: end; }
section.panel .data-table { box-shadow: none; }
section.panel .form-row label { font-weight: 600; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .sidebar {
        position: static; width: 100%; flex-direction: row; flex-wrap: wrap;
        align-items: center; gap: .3rem; padding: .6rem .8rem;
    }
    .sidebar__brand { padding: .3rem .5rem; }
    .sidebar__nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
    .sidebar__label { display: none; }
    .sidebar__foot { margin: 0; flex-direction: row; align-items: center; gap: .8rem; padding: 0; }
    .sidebar__user-meta { display: none; }
    .admin-main { margin-left: 0; }
    .cal-cell { min-height: 5.5rem; }
    .cal-chip__name { display: none; }
}

@media (max-width: 560px) {
    h1 { font-size: 1.6rem; }
    .site-main, .admin-content { padding-left: 1.1rem; padding-right: 1.1rem; }
    .stat-value { font-size: 1.6rem; }
}
