/* ── ExTime Backoffice Global Styles ──────────────────────────────────────── */
:root {
    --primary: #0A2A6B;
    --primary-light: #1a3d8f;
    --primary-dark: #061a45;
    --accent: #2ECC71;
    --accent-hover: #27ae60;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
    --topbar-height: 60px;
    --border: #e2e8f0;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --danger: #e53e3e;
    --warning: #d69e2e;
    --info: #3182ce;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-width); background: var(--primary); position: fixed; top: 0; left: 0; height: 100vh; display: flex; flex-direction: column; z-index: 100; transition: width 0.22s ease; overflow: hidden; }
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left 0.22s ease; }
.topbar { height: var(--topbar-height); background: var(--card-bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 99; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.page-body { padding: 24px; flex: 1; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar-logo { padding: 20px 16px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo h1 { color: #fff; font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.sidebar-logo h1 span { color: var(--accent); }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 8px 16px 4px; font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: rgba(255,255,255,0.75); transition: all 0.2s; cursor: pointer; font-size: 13.5px; font-weight: 500; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.12); color: #fff; border-left-color: var(--accent); }
.nav-item-icon { font-size: 17px; width: 20px; text-align: center; }
.nav-sub-item { padding-left: 36px; font-size: 12.5px; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-card { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0; }
.user-name { color: #fff; font-size: 13px; font-weight: 500; }
.user-role { color: rgba(255,255,255,0.5); font-size: 11px; }
.logout-btn { width: 100%; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; color: rgba(255,255,255,0.75); padding: 7px 12px; font-size: 12px; font-weight: 500; transition: all 0.2s; }
.logout-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-btn { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
.topbar-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border); padding: 20px; margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border); padding: 20px; display: flex; align-items: flex-start; gap: 14px; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); background: var(--card-bg); }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); background: #f8fafc; }
td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border); color: var(--text); }
tr:hover td { background: #f8fafc; }
tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: #d4f7e5; color: #0d6e45; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; border: none; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-control { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--text); background: var(--card-bg); outline: none; transition: border-color 0.2s; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,42,107,0.08); }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%); }
.login-card { background: #fff; border-radius: 20px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 30px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.login-logo h1 span { color: var(--accent); }
.login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-error { background: #fee2e2; border: 1px solid #fca5a5; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #991b1b; margin-bottom: 16px; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.search-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.search-row .form-control { max-width: 280px; }
.empty-state { text-align: center; padding: 48px; color: var(--text-muted); }
.pagination { display: flex; gap: 4px; justify-content: flex-end; margin-top: 16px; align-items: center; font-size: 13px; }
.page-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; }
.page-btn.active, .page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

#blazor-error-ui { display: none; position: fixed; bottom: 0; width: 100%; padding: 12px 20px; background: #fee2e2; color: #991b1b; font-size: 13px; z-index: 9999; border-top: 1px solid #fca5a5; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--card-bg); border-radius: 16px; padding: 28px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal-box--wide { width: min(900px, 90vw); }
@media (max-width: 768px) { .modal-box--wide { width: calc(100vw - 24px); max-height: 95vh; border-radius: 12px; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text); }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-muted); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--danger); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.food-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 768px) { .food-modal-grid { grid-template-columns: 1fr; } }

/* ── Detail grid ──────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.detail-item { background: #f8fafc; border-radius: 8px; padding: 12px 14px; }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.detail-value { font-size: 14px; font-weight: 500; color: var(--text); }

/* ── Confirm dialog ───────────────────────────────────────────────────────── */
.confirm-box { background: var(--card-bg); border-radius: 14px; padding: 28px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); text-align: center; }
.confirm-box h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.confirm-box p { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.6; }
.confirm-icon { font-size: 36px; margin-bottom: 10px; }
.confirm-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.confirm-msg { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Hostel grid ──────────────────────────────────────────────────────────── */
.hostel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.hostel-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 20px; cursor: pointer; transition: box-shadow 0.2s, transform 0.15s; }
.hostel-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.1); transform: translateY(-2px); }
.hostel-card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.hostel-card-icon { font-size: 28px; flex-shrink: 0; }
.hostel-card-name { font-size: 15px; font-weight: 700; color: var(--text); }
.hostel-card-address { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.hostel-stats { display: flex; gap: 16px; margin-bottom: 12px; }
.hostel-stat { text-align: center; flex: 1; }
.hostel-stat-value { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
.hostel-stat-label { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }
.hostel-contact { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.hostel-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── Room grid ────────────────────────────────────────────────────────────── */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.room-box { border-radius: 12px; padding: 14px 12px; cursor: pointer; border: 2px solid transparent; transition: transform 0.15s, box-shadow 0.2s; text-align: center; }
.room-box:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.room-available { background: #f0fdf4; border-color: #86efac; }
.room-partial { background: #fffbeb; border-color: #fde68a; }
.room-full { background: #fef2f2; border-color: #fca5a5; }
.room-box-number { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.room-box-occupancy { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.room-box-worker { font-size: 11px; color: var(--text); font-weight: 500; line-height: 1.4; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-box-empty { font-size: 11px; color: var(--text-muted); font-style: italic; }
.room-box-more { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.room-box-schedule { font-size: 10px; color: var(--text-muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-legend { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }

/* ── Mini stat bar ────────────────────────────────────────────────────────── */
.stat-mini { background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 20px; text-align: center; min-width: 100px; }
.stat-mini-val { font-size: 24px; font-weight: 800; }
.stat-mini-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-mini-blue .stat-mini-val { color: #3b82f6; }
.stat-mini-red .stat-mini-val { color: var(--danger); }
.stat-mini-yellow .stat-mini-val { color: #d97706; }
.stat-mini-green .stat-mini-val { color: var(--success); }

/* ── Form grid ────────────────────────────────────────────────────────────── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Utility colors ───────────────────────────────────────────────────────── */
.text-green { color: var(--success) !important; }
.text-red { color: var(--danger) !important; }

/* ── Hostel Map ───────────────────────────────────────────────────────────── */
.hostel-map-view {
    width: 100%;
    height: 340px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.hostel-map-picker {
    width: 100%;
    height: 300px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-top: 6px;
}

/* ── Hostel Photo Gallery ─────────────────────────────────────────────────── */
.hostel-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 4px;
}
.hostel-gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: var(--surface);
    border: 1px solid var(--border);
}
.hostel-gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}
.hostel-gallery-item:hover .hostel-gallery-img {
    transform: scale(1.04);
}
.hostel-gallery-del {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 13px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0;
}
.hostel-gallery-item:hover .hostel-gallery-del {
    opacity: 1;
}

/* -- Collapsed sidebar ----------------------------------------------------------------------- */
.logout-btn { display: flex; align-items: center; gap: 8px; }
.logout-btn-icon { font-size: 15px; flex-shrink: 0; }
.logout-btn-text { flex: 1; }
.sidebar--collapsed { width: var(--sidebar-collapsed-width); }
.layout--collapsed .main-content { margin-left: var(--sidebar-collapsed-width); }
.sidebar--collapsed .sidebar-logo-text { display: none; }
.sidebar--collapsed .nav-label { display: none; }
.sidebar--collapsed .nav-section { visibility: hidden; height: 0; padding: 0; overflow: hidden; }
.sidebar--collapsed .nav-item { justify-content: center; padding: 10px 0; border-left-color: transparent; }
.sidebar--collapsed .nav-item.active { border-right: 3px solid var(--accent); }
.sidebar--collapsed .nav-item-icon { width: auto; }
.sidebar--collapsed .user-card-info { display: none; }
.sidebar--collapsed .logout-btn-text { display: none; }
.sidebar--collapsed .logout-btn { padding: 7px; justify-content: center; }
.sidebar--collapsed .user-card { justify-content: center; }
.sidebar--collapsed .sidebar-logo { display: flex; justify-content: center; align-items: center; }

/* -- Drawer toggle button -------------------------------------------------------------------- */
.drawer-btn { background: none; border: none; font-size: 18px; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; line-height: 1; margin-right: 8px; transition: background 0.15s, color 0.15s; }
.drawer-btn:hover { background: var(--bg); color: var(--primary); }

