/* =========================================================================
   Coffee INN Hostel – Housekeeping Manager
   Light, friendly, mobile-first stylesheet.
   ========================================================================= */

:root {
    --bg:           #faf7f2;   /* warm off-white */
    --surface:      #ffffff;
    --surface-2:    #f3ede4;
    --border:       #e6ddd0;
    --text:         #2b2118;
    --text-soft:    #6b5d4d;
    --muted:        #9a8c79;

    --accent:       #8b5a2b;   /* coffee brown */
    --accent-dark:  #6e4520;
    --accent-soft:  #f5ead9;

    --red:          #dc2626;
    --red-soft:     #fee2e2;
    --yellow:       #d97706;
    --yellow-soft:  #fef3c7;
    --green:        #16a34a;
    --green-soft:   #dcfce7;

    --shadow-sm: 0 1px 2px rgba(40,30,20,0.05);
    --shadow:    0 4px 12px rgba(40,30,20,0.08);
    --radius:    14px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* --------------------------------- Layout --------------------------------- */

.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.brand {
    font-weight: 700;
    color: var(--accent-dark);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}
.brand-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: grid; place-items: center;
    font-size: 0.95rem;
    font-weight: 800;
}

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--text-soft);
    font-size: 0.92rem;
    border: 1px solid transparent;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active {
    background: var(--accent-soft);
    color: var(--accent-dark);
    border-color: var(--accent-soft);
    font-weight: 600;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-soft);
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.88rem;
}
.logout-btn:hover { background: var(--surface-2); }

/* --------------------------------- Hero / Stats --------------------------- */

h1 {
    margin: 18px 0 8px;
    font-size: 1.55rem;
    color: var(--accent-dark);
}
h2 {
    margin: 24px 0 10px;
    font-size: 1.15rem;
    color: var(--text);
}
.subtitle {
    color: var(--text-soft);
    margin: 0 0 14px;
    font-size: 0.95rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 12px 0 18px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}
.stat-label {
    font-size: 0.78rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}
.stat.red    .stat-value { color: var(--red); }
.stat.yellow .stat-value { color: var(--yellow); }
.stat.green  .stat-value { color: var(--green); }

/* --------------------------------- Search --------------------------------- */

.search {
    display: flex;
    gap: 8px;
    margin: 10px 0 18px;
}
.search input[type="text"] {
    flex: 1;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 1rem;
    color: var(--text);
}
.search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.search button {
    padding: 0 18px;
    border-radius: var(--radius);
    border: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.search button:hover { background: var(--accent-dark); }
.search .clear {
    background: var(--surface);
    color: var(--text-soft);
    border: 1px solid var(--border);
}
.search .clear:hover { background: var(--surface-2); }

/* --------------------------------- Flash messages ------------------------- */

.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin: 10px 0;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.flash.ok  { background: var(--green-soft); color: #14532d; border-color: #bbf7d0; }
.flash.err { background: var(--red-soft);   color: #7f1d1d; border-color: #fecaca; }

/* --------------------------------- Room card ------------------------------ */

.room {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 12px 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    scroll-margin-top: 80px;
}
.room.vip {
    border-color: #d4af37;
    background:
        linear-gradient(180deg, #fdf8ec 0%, var(--surface) 60%);
}
.room.empty {
    border-color: #bbf7d0;
}

.room-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.room-num {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-dark);
}
.room-summary {
    color: var(--text-soft);
    font-size: 0.85rem;
    margin-left: auto;
}

.badges { display: flex; gap: 5px; flex-wrap: wrap; }
.badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-soft);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge.vip      { background: #fef3c7; color: #92400e; }
.badge.empty    { background: var(--green-soft); color: #14532d; }
.badge.late     { background: #ede9fe; color: #5b21b6; }
.badge.towels   { background: #dbeafe; color: #1e40af; }

/* --------------------------------- Room flags row ------------------------- */

.flags {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 10px 12px;
    background: var(--surface);
}
.flag-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-size: 0.88rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: all 0.15s;
}
.flag-btn:hover { background: var(--surface-2); }
.flag-btn.on {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-dark);
    font-weight: 600;
}
.flag-btn .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}
.flag-btn.on .dot { background: var(--accent); }

/* --------------------------------- Bed list ------------------------------- */

.beds {
    padding: 6px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bed {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--surface);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
}
.bed.red    { background: var(--red-soft);    border-color: #fecaca; }
.bed.yellow { background: var(--yellow-soft); border-color: #fde68a; }
.bed.green  { background: var(--green-soft);  border-color: #bbf7d0; }

.bed-light {
    width: 22px; height: 22px;
    border-radius: 50%;
    margin-top: 2px;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.08);
}
.bed-light.red    { background: var(--red); }
.bed-light.yellow { background: var(--yellow); }
.bed-light.green  { background: var(--green); }

.bed-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bed-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.bed-label {
    font-weight: 600;
    color: var(--text);
}
.bed-status {
    font-size: 0.82rem;
    color: var(--text-soft);
}
.bed-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.bed-actions .chip {
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.15s;
}
.bed-actions .chip:hover { background: var(--surface-2); }
.bed-actions .chip.on {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-dark);
    font-weight: 600;
}
.bed-actions .chip.danger {
    background: transparent;
    color: var(--red);
    border-color: #fecaca;
}
.bed-actions .chip.danger:hover { background: var(--red-soft); }

/* --------------------------------- Forms ---------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 14px 0;
    box-shadow: var(--shadow-sm);
}
.card h2 { margin-top: 0; }

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-soft);
    margin: 8px 0 4px;
}
input[type="text"],
input[type="number"],
input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 1rem;
    color: var(--text);
}
input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
    display: inline-block;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    border: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.secondary:hover { background: #e6ddd0; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 7px 12px; font-size: 0.88rem; }

.form-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 140px; }

/* --------------------------------- Login screen --------------------------- */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 20% 10%, var(--accent-soft) 0%, transparent 50%),
        radial-gradient(circle at 90% 90%, #f5e6cc 0%, transparent 50%),
        var(--bg);
    padding: 16px;
}
.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px 24px;
    box-shadow: var(--shadow);
    text-align: center;
}
.login-box .brand {
    justify-content: center;
    font-size: 1.15rem;
    margin: 0 0 18px;
}
.login-box .brand-icon { width: 36px; height: 36px; font-size: 1.05rem; }
.login-box input { text-align: center; letter-spacing: 0.1em; }
.login-box .btn { width: 100%; margin-top: 12px; }
.login-tip {
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--muted);
}

/* --------------------------------- Overview (traffic light) --------------- */

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.ov-room {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}
.ov-room-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--accent-dark);
}
.ov-beds { display: flex; flex-wrap: wrap; gap: 6px; }
.ov-bed {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--surface-2);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--text-soft);
}
.ov-dot { width: 10px; height: 10px; border-radius: 50%; }
.ov-dot.red    { background: var(--red); }
.ov-dot.yellow { background: var(--yellow); }
.ov-dot.green  { background: var(--green); }

.legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 10px 0 14px;
    font-size: 0.88rem;
    color: var(--text-soft);
}
.legend span { display: flex; align-items: center; gap: 6px; }

/* --------------------------------- Empty state ---------------------------- */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-soft);
}
.empty-state .big { font-size: 2.5rem; margin-bottom: 8px; }

/* --------------------------------- Footer --------------------------------- */

footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 24px 16px 32px;
}

/* --------------------------------- Mobile tweaks -------------------------- */

@media (max-width: 600px) {
    .wrap { padding: 12px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 1.45rem; }
    .flags { grid-template-columns: 1fr; }
    h1 { font-size: 1.3rem; }
    .topbar-inner { padding: 8px 12px; gap: 8px; }
    .brand { font-size: 0.95rem; }
    .nav a { padding: 5px 10px; font-size: 0.85rem; }
    .room-summary { display: none; }
}

@media (max-width: 380px) {
    .stats { grid-template-columns: 1fr 1fr; }
}

/* Hide submit-as-button styling */
button { font-family: inherit; }
form { margin: 0; }

/* Make every interactive bed-action button reset properly */
.inline-form { display: inline; }
