:root {
    --green: #2d6a4f;
    --green-light: #40916c;
    --green-pale: #d8f3dc;
    --brown: #6f4518;
    --ink: #1b2a22;
    --muted: #5b6f64;
    --bg: #f6f8f5;
    --card: #ffffff;
    --danger: #b23a48;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.home-title {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 9rem;
}
.home-title-text {
    flex: 1;
}
.home-title-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 9rem;
    width: auto;
}

.loading { padding: 3rem; text-align: center; color: var(--muted); }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--danger);
    color: #fff;
    padding: 0.75rem 1rem;
    z-index: 1000;
}
#blazor-error-ui a { color: #fff; margin-left: 1rem; }

/* ─── Layout ─────────────────────────────── */

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

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--green);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.25rem 1.25rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.sidebar-brand img {
    height: 5rem;
    width: 5rem;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow-y: auto;
}
.sidebar-nav .nav-label {
    color: var(--green-pale);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.9rem 0.75rem 0.3rem;
}
.sidebar-nav a {
    color: #fff;
    text-decoration: none;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.12); }
.sidebar-nav a.active { background: #fff; color: var(--green); font-weight: 600; }

.sidebar-footer {
    padding: 0.9rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
}
.sidebar-footer a {
    color: #fff;
    text-decoration: none;
}
.sidebar-footer a:hover { text-decoration: underline; }
.sidebar-footer .user { font-weight: 600; }
.sidebar-footer .role { color: var(--green-pale); font-size: 0.8rem; margin-left: 0.25rem; }
.sidebar-footer .nav-link {
    background: none;
    border: none;
    color: #fff;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}
.sidebar-footer .nav-link:hover { text-decoration: underline; }

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-main main { flex: 1; padding: 1.5rem 2rem 3rem; max-width: 1100px; width: 100%; margin: 0 auto; }

.site-footer {
    padding: 1rem 2rem;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid #e2e8e4;
}

.page { max-width: 900px; }

/* ─── Generic ────────────────────────────── */

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }
.muted { color: var(--muted); }

.card {
    background: var(--card);
    border: 1px solid #e2e8e4;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.btn {
    display: inline-block;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--green-light); }
.btn:disabled { background: #9db8ac; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--green); border: 1px solid var(--green); }
.btn-secondary:hover { background: var(--green-pale); }
.btn-danger { background: var(--danger); }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.area-swatch {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 3px;
    margin-right: 0.45rem;
    vertical-align: -0.1rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

.slot-chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.slot-chip {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--green);
    background: #fff;
    color: var(--green);
    cursor: pointer;
}
.slot-chip:hover { background: var(--green-pale); }
.slot-chip.allocated { font-weight: 600; border-color: rgba(0, 0, 0, 0.25); }
.slot-chip.hatched { font-weight: 600; border-color: rgba(0, 0, 0, 0.25); }
.slot-chip.selected {
    background: var(--green);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 0 2px var(--green-light);
}

.error-box {
    background: #fbe9eb;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

.success-box {
    background: var(--green-pale);
    border: 1px solid var(--green-light);
    color: var(--green);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

.warning-box {
    background: #fff4e0;
    border: 1px solid #e0a800;
    color: #7a5a00;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

/* ─── Forms ──────────────────────────────── */

.form-grid { display: grid; gap: 0.9rem; max-width: 480px; }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.9rem; }
input, select, textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid #c3d1c8;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
}
input:focus, select:focus { outline: 2px solid var(--green-light); border-color: var(--green); }

.show-password {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.4rem;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--muted);
}
.show-password input { width: auto; margin: 0; }

/* ─── Tenant cards ───────────────────────── */

.tenant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }.tenant-card { display: block; text-decoration: none; color: inherit; transition: box-shadow 0.15s; }
.tenant-card:hover { box-shadow: 0 4px 14px rgba(45, 106, 79, 0.18); }
.tenant-card h3 { margin: 0 0 0.35rem; color: var(--green); }
.tenant-card .price { font-weight: 700; margin-top: 0.5rem; }

.last-tenant { border: 1px solid var(--green-light); border-left: 4px solid var(--green); margin-bottom: 1.5rem; }
.last-tenant-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--green);
    margin-bottom: 0.35rem;
}

/* ─── Map ────────────────────────────────── */

.map-card {
    margin-top: 1rem;
    border: 1px solid #e2e8e4;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
}

.map-container {
    width: 100%;
    height: 280px;
}

.map-caption {
    padding: 0.5rem 0.9rem;
    margin: 0;
    font-size: 0.85rem;
    border-top: 1px solid #e2e8e4;
}

.area-map-container {
    width: 100%;
    height: 420px;
    border: 1px solid #e2e8e4;
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

/* ─── Calendar ───────────────────────────── */

.calendar-nav { display: flex; align-items: center; gap: 1rem; margin: 1rem 0 0.5rem; }
.calendar-nav h2 { margin: 0; min-width: 180px; text-align: center; }

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 1.5rem;
}
.calendar .dow {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0.4rem 0;
}
.calendar .day {
    min-height: 64px;
    border: 1px solid #e2e8e4;
    border-radius: 6px;
    padding: 4px 6px;
    background: #fff;
    font-size: 0.85rem;
}
.calendar .day.other-month { background: #f2f4f2; color: #b7c2ba; }
.calendar .day.past { background: #f2f4f2; color: #b7c2ba; }
.calendar .day.available { cursor: pointer; border-color: var(--green-light); }
.calendar .day.available:hover { background: var(--green-pale); }
.calendar .day.selected { background: var(--green); color: #fff; }
.calendar .day .slots-count { display: block; font-size: 0.75rem; margin-top: 2px; color: var(--green); font-weight: 600; }
.calendar .day.selected .slots-count { color: var(--green-pale); }

.slot-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 1.5rem; }
.slot-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--green);
    background: #fff;
    color: var(--green);
    font-size: 0.95rem;
    cursor: pointer;
}
.slot-btn:hover { background: var(--green-pale); }
.slot-btn.full { border-color: #c3d1c8; color: #9db8ac; cursor: not-allowed; text-decoration: line-through; }

/* ─── Admin ──────────────────────────────── */

.admin-tabs { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
.admin-tabs button {
    border: 1px solid var(--green);
    background: #fff;
    color: var(--green);
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
}
.admin-tabs button.active { background: var(--green); color: #fff; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid #e2e8e4; vertical-align: top; }
th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

.status-pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.status-Confirmed { background: var(--green-pale); color: var(--green); }
.status-Completed { background: #dbeafe; color: #1d4ed8; }
.status-PendingPayment { background: #fef3c7; color: #92400e; }
.status-Cancelled, .status-PaymentExpired { background: #f1f1f1; color: #6b7280; }
.status-NoShow { background: #fbe9eb; color: var(--danger); }

/* ─── Cart / items ────────────────────────── */

.item-list { margin: 0.25rem 0; padding-left: 1.2rem; }
.item-list li { margin: 0.2rem 0; }

.qty { display: inline-block; min-width: 1.5rem; text-align: center; font-weight: 600; }
td .btn-small + .qty { margin: 0 0.35rem; }

@media (max-width: 640px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar-nav .nav-label { width: 100%; }
    .app-main main { padding: 1rem; }
    .calendar .day { min-height: 48px; font-size: 0.75rem; }
}
