/* ── Background ─────────────────────────────────────────────────────────── */
body.admin-layout {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f8f8 0%, #fde8e5 45%, #fef5ec 100%);
    background-attachment: fixed;
    color: #1a1a2a;
}

/* ── Glass card ─────────────────────────────────────────────────────────── */
.glass-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
#sidebar {
    width: 260px;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(192, 57, 43, 0.2);
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    box-shadow: 2px 0 16px rgba(192, 57, 43, 0.06);
}

#sidebar .sidebar-brand {
    padding: 1.5rem 1.25rem 1.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: #c0392b;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
}

#sidebar .nav-link {
    color: rgba(0, 0, 0, 0.6);
    padding: .55rem 1.1rem;
    border-radius: .5rem;
    margin: .15rem .6rem;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .65rem;
    transition: background .15s, color .15s;
}
#sidebar .nav-link i { font-size: 1rem; }
#sidebar .nav-link:hover,
#sidebar .nav-link.active {
    background: rgba(192, 57, 43, 0.1);
    color: #c0392b;
}

#sidebar .sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
}
#sidebar .sidebar-footer .user-name {
    font-size: .85rem;
    color: rgba(0, 0, 0, 0.8);
    font-weight: 600;
}
#sidebar .sidebar-footer .user-role {
    font-size: .7rem;
    color: rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ── Main content ───────────────────────────────────────────────────────── */
#main-content {
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.75rem;
}
.topbar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #1a1a2a;
}

/* ── Tables inside glass cards ──────────────────────────────────────────── */
.glass-card .table {
    --bs-table-bg: transparent;
    --bs-table-color: rgba(0, 0, 0, 0.82);
    --bs-table-border-color: rgba(0, 0, 0, 0.07);
    --bs-table-hover-bg: rgba(192, 57, 43, 0.06);
    margin-bottom: 0;
}
.glass-card .table thead th {
    color: rgba(0, 0, 0, 0.42);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-bottom-color: rgba(0, 0, 0, 0.1);
    padding: .9rem 1rem;
}
.glass-card .table tbody td {
    padding: .85rem 1rem;
    vertical-align: middle;
    border-color: rgba(0, 0, 0, 0.05);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-fire {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
    font-weight: 500;
}
.btn-fire:hover, .btn-fire:focus {
    background: #a93226;
    border-color: #a93226;
    color: #fff;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: rgba(0, 0, 0, 0.7);
}
.btn-glass:hover, .btn-glass:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.25);
    color: #1a1a2a;
}

/* ── Form controls inside glass ─────────────────────────────────────────── */
.glass-card .form-control,
.glass-card .form-select,
.modal-content .form-control,
.modal-content .form-select {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #1a1a2a;
}
.glass-card .form-control::placeholder,
.modal-content .form-control::placeholder { color: rgba(0, 0, 0, 0.3); }
.glass-card .form-control:focus,
.glass-card .form-select:focus,
.modal-content .form-control:focus,
.modal-content .form-select:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: #c0392b;
    box-shadow: 0 0 0 .25rem rgba(192, 57, 43, .2);
    color: #1a1a2a;
}
.glass-card .form-label,
.modal-content .form-label { color: rgba(0, 0, 0, 0.6); font-size: .85rem; }
.glass-card .form-select option,
.modal-content .form-select option { background: #fff; color: #1a1a2a; }

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 1rem;
    color: #1a1a2a;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.modal-header, .modal-footer {
    border-color: rgba(0, 0, 0, 0.08);
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
    padding: 1.5rem;
    text-align: center;
}
.stat-card .stat-icon {
    font-size: 2rem;
    color: #c0392b;
    margin-bottom: .5rem;
}
.stat-card .stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
    color: #1a1a2a;
}
.stat-card .stat-label {
    font-size: .72rem;
    color: rgba(0, 0, 0, 0.42);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-top: .3rem;
}

/* ── Project cards ──────────────────────────────────────────────────────── */
.project-card {
    transition: transform .15s, box-shadow .15s;
    cursor: default;
}
.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}
.project-card .card-title {
    color: #1a1a2a;
    font-weight: 600;
    font-size: 1rem;
}
.project-card .card-text {
    color: rgba(0, 0, 0, 0.52);
    font-size: .85rem;
}

/* ── Status badges ──────────────────────────────────────────────────────── */
.badge-alarmed { background: #c0392b !important; color: #fff !important; }
.badge-pending { background: rgba(0, 0, 0, 0.1) !important; color: rgba(0,0,0,.6) !important; }

/* ── Toast container ────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

/* ── Key display alert ──────────────────────────────────────────────────── */
.key-display {
    background: rgba(192, 57, 43, 0.07);
    border: 1px solid rgba(192, 57, 43, 0.3);
    border-radius: .5rem;
    padding: .75rem 1rem;
    font-family: monospace;
    font-size: .85rem;
    word-break: break-all;
    color: #c0392b;
}

/* ── Alarm button pulse ─────────────────────────────────────────────────── */
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .5); }
    50%       { box-shadow: 0 0 0 8px rgba(192, 57, 43, 0); }
}
.btn-alarm:not(:disabled) {
    animation: pulse-red 2s infinite;
}

/* ── Login page ─────────────────────────────────────────────────────────── */
body.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f8f8 0%, #fde8e5 45%, #fef5ec 100%);
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}
.login-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #c0392b;
    text-align: center;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

/* ── Checkbox list (project assign) ─────────────────────────────────────── */
.project-checklist {
    max-height: 180px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: .5rem;
    padding: .5rem .75rem;
}
.project-checklist .form-check-label { color: rgba(0,0,0,.75); }
.project-checklist .form-check-input:checked {
    background-color: #c0392b;
    border-color: #c0392b;
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    #sidebar.open { transform: translateX(0); }
    #main-content { margin-left: 0; }
    .topbar h1 { font-size: 1.2rem; }
}
