/* =========================================================
   MESS PURI INDAH - Tema "Blue Crystal"
   ========================================================= */

:root {
    --blue-dark: #2563eb;
    --blue-mid: #3b82f6;
    --blue-light: #60a5fa;
    --bg-page: #eaf1fb;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-soft: #e2e8f0;
    --green: #16a34a;
    --red: #dc2626;
    --orange: #f97316;
    --gray: #94a3b8;
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-pill: 999px;
    --shadow-soft: 0 8px 24px rgba(37, 99, 235, 0.08);
    --shadow-hover: 0 12px 32px rgba(37, 99, 235, 0.14);
    --sidebar-w: 260px;
}

body.dark {
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-soft: #334155;
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    background: linear-gradient(180deg, var(--bg-page) 0%, #ffffff 60%);
    color: var(--text-main);
    transition: background .3s, color .3s;
}
body.dark { background: var(--bg-page); }

a { text-decoration: none; color: inherit; }

/* ---------- Login Page ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    width: 100%;
    max-width: 380px;
    padding: 40px 36px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,.2);
    text-align: center;
}
.login-logo {
    width: 76px; height: 76px;
    border-radius: 50%;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-light));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 32px;
    box-shadow: var(--shadow-soft);
}
.login-title { color: var(--blue-dark); font-weight: 800; letter-spacing: .5px; margin: 0 0 4px; font-size: 22px; }
.login-sub { font-style: italic; color: var(--text-muted); font-size: 13px; margin-bottom: 26px; }
.login-form .input-group { position: relative; margin-bottom: 16px; }
.login-form .input-group i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--gray); }
.login-form input {
    width: 100%; padding: 13px 18px 13px 44px;
    border-radius: var(--radius-pill); border: 1px solid var(--border-soft);
    background: #f1f5f9; font-size: 14px; outline: none;
}
.login-form input:focus { border-color: var(--blue-mid); background: #fff; }
.btn-login {
    width: 100%; padding: 13px; border: none; border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-light));
    color: #fff; font-weight: 600; font-size: 15px; cursor: pointer;
    box-shadow: var(--shadow-soft); transition: transform .15s, box-shadow .15s;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--text-muted); }
.login-error { background: #fee2e2; color: var(--red); padding: 10px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 14px; }

/* ---------- App Layout ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border-soft);
    position: fixed; top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    padding: 24px 18px;
    z-index: 100;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; padding: 0 6px; }
.sidebar-logo {
    width: 46px; height: 46px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-light));
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px;
    flex-shrink: 0;
}
.sidebar-brand h1 { font-size: 15px; margin: 0; font-weight: 800; color: var(--blue-dark); line-height: 1.2; }
.sidebar-brand span { font-size: 10px; font-style: italic; color: var(--text-muted); }

.sidebar-menu { list-style: none; padding: 0; margin: 0; flex: 1; }
.sidebar-menu li { margin-bottom: 6px; }
.sidebar-menu a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: var(--radius-md);
    color: var(--text-main); font-size: 14px; font-weight: 500;
    transition: background .2s;
}
.sidebar-menu a i { width: 18px; text-align: center; }
.sidebar-menu a:hover { background: var(--bg-page); }
.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-mid));
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.btn-logout {
    display: flex; align-items: center; gap: 10px; justify-content: center;
    padding: 12px; border-radius: var(--radius-pill);
    background: #fee2e2; color: var(--red); font-weight: 600; font-size: 14px;
    border: none; cursor: pointer; width: 100%;
}
.btn-logout:hover { background: #fecaca; }

.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 24px 32px; width: calc(100% - var(--sidebar-w)); }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 26px; flex-wrap: wrap; gap: 12px;
}
.topbar h2 { margin: 0; font-size: 22px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.topbar-clock { text-align: right; }
.topbar-clock .time { font-size: 18px; font-weight: 700; color: var(--blue-dark); }
.topbar-clock .date { font-size: 12px; color: var(--text-muted); }
.btn-theme-toggle {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-soft);
    background: var(--bg-card); cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-main);
}
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar-circle {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-light));
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.topbar-user .u-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.topbar-user .u-role { font-size: 11px; color: var(--text-muted); }

/* ---------- Card ---------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 22px;
    margin-bottom: 24px;
}
.card h3 { margin-top: 0; font-size: 16px; }
.grid-2x2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 900px) { .grid-2x2 { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn { border: none; border-radius: var(--radius-pill); padding: 10px 20px; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--blue-dark), var(--blue-light)); color: #fff; box-shadow: var(--shadow-soft); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text-main); }
body.dark .btn-secondary { background: #334155; color: #e2e8f0; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.btn-sm { padding: 7px 14px; font-size: 12px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.toolbar .spacer { flex: 1; }
.filter-input, .filter-select {
    padding: 10px 16px; border-radius: var(--radius-pill); border: 1px solid var(--border-soft);
    background: var(--bg-card); color: var(--text-main); font-size: 13px; outline: none;
}

/* ---------- Table ---------- */
table.data-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
table.data-table thead th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--text-muted); padding: 0 14px 8px; }
table.data-table tbody tr { background: var(--bg-card); box-shadow: var(--shadow-soft); }
table.data-table tbody td { padding: 12px 14px; font-size: 13px; }
table.data-table tbody tr td:first-child { border-radius: 12px 0 0 12px; }
table.data-table tbody tr td:last-child { border-radius: 0 12px 12px 0; }
.foto-thumb { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.badge { padding: 4px 12px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; }
.badge-green { background: #dcfce7; color: #16a34a; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-gray { background: #e2e8f0; color: #475569; }
.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-orange { background: #ffedd5; color: #ea580c; }

/* ---------- Kamar Cards ---------- */
.kamar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.kamar-card {
    background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft);
    padding: 20px; border-left: 5px solid var(--gray);
}
.kamar-card.terisi { border-left-color: var(--red); }
.kamar-card.kosong { border-left-color: var(--green); }
.kamar-card h4 { margin: 0 0 6px; font-size: 17px; }
.kamar-card .meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.kamar-card .badges { display: flex; gap: 8px; margin: 12px 0; }
.kamar-card .actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- Modal ---------- */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5);
    align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 28px;
    width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-box h3 { margin-top: 0; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-soft);
    background: var(--bg-page); color: var(--text-main); font-size: 13px; outline: none;
}
body.dark .form-group input, body.dark .form-group select, body.dark .form-group textarea { background: #0f172a; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--blue-mid); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.autocomplete-box { position: relative; }
.autocomplete-results {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card);
    border-radius: var(--radius-md); box-shadow: var(--shadow-hover); z-index: 50; max-height: 220px; overflow-y: auto; display: none;
}
.autocomplete-results div { padding: 10px 14px; font-size: 13px; cursor: pointer; }
.autocomplete-results div:hover { background: var(--bg-page); }

/* ---------- DataTables custom footer ---------- */
.dt-info { font-size: 12px; color: var(--text-muted); }

/* Pagination custom look for DataTables */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius-pill) !important; padding: 6px 12px !important; margin-left: 4px !important;
    border: 1px solid var(--border-soft) !important; background: var(--bg-card) !important; color: var(--text-main) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, var(--blue-dark), var(--blue-light)) !important; color: #fff !important; border: none !important;
}
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select {
    border-radius: var(--radius-pill); border: 1px solid var(--border-soft); padding: 6px 12px; background: var(--bg-card); color: var(--text-main);
}
.dataTables_wrapper .dataTables_info { color: var(--text-muted) !important; font-size: 12px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--blue-light); border-radius: 8px; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .3s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; padding: 18px; }
}
