/* ============================================================
   Spark Maintenance — modern theme (navy + red)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800&display=swap');

:root {
    --sp-navy-900: #0b1c40;
    --sp-navy-800: #0f2350;
    --sp-navy-700: #16346e;
    --sp-navy-600: #1d3f82;
    --sp-red: #e11d2a;
    --sp-red-dark: #b9141f;
    --sp-ink: #1f2937;
    --sp-muted: #6b7280;
    --sp-line: #e5e7eb;
    --sp-bg: #f4f6fb;
    --sp-radius: 14px;
    --sp-shadow: 0 10px 30px rgba(15, 35, 80, 0.08);
    --sp-shadow-sm: 0 4px 14px rgba(15, 35, 80, 0.06);
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
    font-size: 0.9rem;
    background-color: var(--sp-bg);
    color: var(--sp-ink);
    margin-bottom: 0;
}

h1, h2, h3, h4, h5 {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--sp-navy-800);
}

h2 { font-size: 1.5rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }

a {
    text-decoration: none;
}

.text-muted {
    color: var(--sp-muted) !important;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.55rem 1.15rem;
}

.btn-brand,
.btn-primary {
    background: linear-gradient(135deg, var(--sp-navy-800), var(--sp-navy-600));
    border: none;
    color: #fff;
}

.btn-brand:hover,
.btn-primary:hover {
    background: linear-gradient(135deg, var(--sp-navy-900), var(--sp-navy-700));
    color: #fff;
}

.btn-red,
.btn-success {
    background: linear-gradient(135deg, var(--sp-red), var(--sp-red-dark));
    border: none;
    color: #fff;
}

.btn-red:hover,
.btn-success:hover {
    background: var(--sp-red-dark);
    color: #fff;
}

.btn-warning {
    background: #f0b429;
    border: none;
    color: #3b2f00;
}

.btn-outline-secondary {
    border-color: var(--sp-line);
    color: var(--sp-navy-700);
    background: #fff;
}

.btn-outline-secondary:hover {
    background: var(--sp-navy-800);
    border-color: var(--sp-navy-800);
    color: #fff;
}

.btn:focus, .btn:active:focus, .form-control:focus,
.form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(29, 63, 130, 0.18);
    border-color: var(--sp-navy-600);
}

/* ---------- Navbar ---------- */
.app-navbar {
    background: linear-gradient(90deg, var(--sp-navy-900), var(--sp-navy-700));
    box-shadow: 0 2px 12px rgba(11, 28, 64, 0.25);
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.app-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    letter-spacing: 0.2px;
}

.app-navbar .nav-link { font-size: 0.9rem; }

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--sp-red), var(--sp-red-dark));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(225, 29, 42, 0.35);
}

.app-navbar .nav-link {
    color: rgba(255, 255, 255, 0.82) !important;
    font-weight: 500;
    border-radius: 8px;
    padding: 0.4rem 0.85rem !important;
    transition: all .15s ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.show {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.10);
}

.app-navbar .dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: var(--sp-shadow);
    padding: 0.4rem;
    margin-top: 0.4rem;
}

.app-navbar .dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    font-weight: 500;
    color: var(--sp-ink);
}

.app-navbar .dropdown-item:hover {
    background: var(--sp-bg);
    color: var(--sp-navy-800);
}

/* ---------- Cards ---------- */
.card {
    border: none;
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow-sm);
}

.card-header.bg-dark {
    background: linear-gradient(135deg, var(--sp-navy-800), var(--sp-navy-600)) !important;
    border-top-left-radius: var(--sp-radius);
    border-top-right-radius: var(--sp-radius);
}

/* Headings inside dark headers / modals must be white (was invisible navy-on-navy) */
.bg-dark h1, .bg-dark h2, .bg-dark h3, .bg-dark h4, .bg-dark h5, .bg-dark h6,
.modal-header.bg-dark .modal-title,
.text-white h1, .text-white h2, .text-white h3, .text-white h4, .text-white h5 {
    color: #fff !important;
}

/* Give buttons a little room between icon and text */
.btn i.bi { vertical-align: -0.1em; }

/* ---------- Page hero banner (HRMS-style) ---------- */
.page-hero {
    background: linear-gradient(120deg, var(--sp-navy-900) 0%, var(--sp-navy-700) 55%, var(--sp-red) 130%);
    color: #fff;
    border-radius: var(--sp-radius);
    padding: 1.4rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--sp-shadow);
}
.page-hero .hero-left { display: flex; align-items: center; gap: 1rem; }
.page-hero .hero-icon {
    width: 54px; height: 54px; border-radius: 14px;
    background: rgba(255,255,255,0.15);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #fff; flex-shrink: 0;
}
.page-hero h2 { color: #fff !important; margin: 0; font-size: 1.5rem; }
.page-hero p { color: rgba(255,255,255,0.82); margin: 0; font-size: 0.9rem; }

/* Letter avatar in list */
.name-avatar {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--sp-navy-700), var(--sp-navy-600));
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; margin-right: 0.6rem; flex-shrink: 0;
}

/* DataTables buttons (Copy/CSV/Excel/PDF/Print) styled as a group */
div.dt-buttons .dt-button {
    background: var(--sp-navy-800); color: #fff; border: none;
    border-radius: 8px; padding: 0.35rem 0.85rem; margin-right: 0.35rem;
    font-size: 0.85rem; font-weight: 600;
}
div.dt-buttons .dt-button:hover { background: var(--sp-navy-900); color: #fff; }
table.dataTable thead th { background: var(--sp-bg); color: var(--sp-navy-800); font-weight: 600; }
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; border: 1px solid var(--sp-line); }

/* 'Show N entries' length control — own row, tidy spacing, no button overlap */
.dt-length-wrap label,
.dataTables_length label,
.dt-length label {
    display: flex; align-items: center; gap: 6px; margin: 0;
    color: var(--sp-muted); font-size: 0.85rem; white-space: nowrap; font-weight: 500;
}
.dt-length-wrap select,
.dataTables_length select,
.dt-length select {
    width: auto !important; display: inline-block;
    padding: 0.25rem 1.8rem 0.25rem 0.6rem;
    border: 1px solid var(--sp-line); border-radius: 8px;
}

/* Long cell data wraps into multiple lines (caps column width) */
table.dataTable td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 320px;
    vertical-align: middle;
}
table.dataTable thead th { white-space: nowrap; }

/* Right-align the pagination */
div.dt-paging ul.pagination,
.dataTables_wrapper .dataTables_paginate ul.pagination {
    justify-content: flex-end !important;
    margin-bottom: 0;
}

/* ============================================================
   NUZN-style sidebar layout
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 264px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--sp-navy-900), var(--sp-navy-800));
    color: #cdd5e6;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    padding: 0.9rem 1rem;
    background: #fff;
    margin: 0.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.sidebar-brand .brand-mark { width: 38px; height: 38px; border-radius: 10px; }
.sidebar-brand .brand-name { font-family: 'Poppins', sans-serif; font-weight: 700; color: var(--sp-navy-800); line-height: 1.05; font-size: 1.05rem; }
.sidebar-brand .brand-sub { font-size: 0.68rem; color: var(--sp-red); font-weight: 600; }

.sidebar-search { padding: 0.25rem 0.85rem 0.5rem; }
.sidebar-search input {
    width: 100%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 9px;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
}
.sidebar-search input::placeholder { color: rgba(255,255,255,0.45); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.25rem 0.7rem 1rem; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.nav-section-label {
    font-size: 0.66rem; letter-spacing: 1.2px; text-transform: uppercase;
    color: rgba(255,255,255,0.38); padding: 1rem 0.6rem 0.35rem; font-weight: 600;
}
.side-link {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.6rem 0.75rem; border-radius: 9px;
    color: #cdd5e6; font-weight: 500; font-size: 0.9rem; text-decoration: none;
    transition: background .15s ease, color .15s ease;
    cursor: pointer;
}
.side-link i.bi { font-size: 1.05rem; width: 20px; text-align: center; }
.side-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.side-link.active { background: linear-gradient(90deg, var(--sp-red), var(--sp-red-dark)); color: #fff; box-shadow: 0 4px 12px rgba(225,29,42,0.35); }
.side-link .chev { margin-left: auto; font-size: 0.8rem; transition: transform .2s ease; }
.side-link[aria-expanded="true"] .chev { transform: rotate(90deg); }
.side-sub { padding: 0.25rem 0 0.35rem; margin: 0.15rem 0 0.3rem; background: rgba(0,0,0,0.18); border-radius: 10px; }
.side-sub .side-link { padding-left: 2.4rem; font-size: 0.85rem; }
.side-sub .side-link.active { background: linear-gradient(90deg, var(--sp-red-dark), #7d0d15); }

.sidebar-user {
    padding: 0.85rem 1rem; border-top: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 0.65rem;
}
.sidebar-user .u-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--sp-red), var(--sp-red-dark));
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; flex-shrink: 0;
}
.sidebar-user .u-name { color: #fff; font-weight: 600; font-size: 0.85rem; line-height: 1.1; }
.sidebar-user .u-role { color: rgba(255,255,255,0.5); font-size: 0.72rem; }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 60px; background: #fff; border-bottom: 1px solid var(--sp-line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem; position: sticky; top: 0; z-index: 20;
}
.topbar .crumbs { color: var(--sp-muted); font-size: 0.9rem; display: flex; align-items: center; gap: 0.4rem; }
.topbar .crumbs .cur { color: var(--sp-navy-800); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 0.85rem; }
.topbar-icon {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--sp-line);
    display: inline-flex; align-items: center; justify-content: center; color: var(--sp-navy-700);
    background: #fff; cursor: pointer;
}
.content-area { flex: 1; padding: 1.25rem; }
.sidebar-toggle { display: none; }

@media (max-width: 991px) {
    .sidebar { position: fixed; z-index: 1050; transform: translateX(-100%); transition: transform .25s ease; }
    .app-shell.sb-open .sidebar { transform: translateX(0); }
    .sidebar-toggle { display: inline-flex; }
}

/* Toast/alert message floats on top (above modals) */
#toast:not(.d-none) {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    min-width: 320px;
    max-width: 92%;
    box-shadow: 0 12px 34px rgba(11, 28, 64, 0.28);
    border: none;
}

/* ---------- Sectioned modal form (HRMS-style) ---------- */
.modal-header.bg-dark {
    background: linear-gradient(135deg, var(--sp-navy-800), var(--sp-navy-600)) !important;
    border-bottom: none;
}
.modal-content { border: none; border-radius: 14px; overflow: hidden; }
.modal-body { padding: 1.5rem 1.75rem; }
.form-section-title {
    color: var(--sp-navy-700);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding-bottom: 0.4rem;
    margin: 0.25rem 0 1rem;
    border-bottom: 1px solid var(--sp-line);
}
.form-section-title:not(:first-child) { margin-top: 1rem; }
.req { color: var(--sp-red); font-weight: 700; }
.modal-footer { border-top: 1px solid var(--sp-line); padding: 1rem 1.75rem; }

/* ---------- Tables ---------- */
.table > thead.table-dark th {
    background: var(--sp-navy-800);
    border-color: var(--sp-navy-700);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.table-hover > tbody > tr:hover > * {
    background-color: #eef2fb;
}

/* ---------- Forms ---------- */
.form-label {
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--sp-muted);
}

.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid var(--sp-line);
    padding: 0.6rem 0.85rem;
}

/* ---------- Dashboard ---------- */
.page-head h2 {
    margin-bottom: 0.15rem;
}

.stat-card {
    background: #fff;
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow-sm);
    padding: 1.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #eef1f7;
    transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sp-shadow);
}

.icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 0.9rem;
}

.icon-badge.navy { background: linear-gradient(135deg, var(--sp-navy-800), var(--sp-navy-600)); }
.icon-badge.red  { background: linear-gradient(135deg, var(--sp-red), var(--sp-red-dark)); }
.icon-badge.teal { background: linear-gradient(135deg, #0d9488, #0f766e); }
.icon-badge.amber{ background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-card h5 {
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
}

.stat-card p {
    color: var(--sp-muted);
    font-size: 0.88rem;
    flex-grow: 1;
}

/* ---------- Footer ---------- */
.app-footer {
    border-top: 1px solid var(--sp-line);
    background: #fff;
    padding: 1rem 0;
    color: var(--sp-muted);
    font-size: 0.85rem;
}

/* ============================================================
   Auth / Login split screen
   ============================================================ */
.auth-shell {
    display: flex;
    min-height: 100vh;
    background: #fff;
}

.auth-left {
    flex: 1 1 50%;
    position: relative;
    overflow: hidden;
    background: radial-gradient(1200px 600px at -10% -10%, var(--sp-navy-700), transparent),
                linear-gradient(160deg, var(--sp-navy-900), var(--sp-navy-800));
    color: #fff;
    padding: 3.5rem 3.5rem;
    display: flex;
    flex-direction: column;
}

.auth-left::before,
.auth-left::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.auth-left::before { width: 520px; height: 520px; right: -160px; top: -120px; }
.auth-left::after  { width: 360px; height: 360px; right: -60px; bottom: -140px; background: rgba(255,255,255,0.02); }

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    position: relative;
    z-index: 2;
}

.auth-brand .brand-mark { width: 42px; height: 42px; border-radius: 11px; }

.auth-brand .brand-name {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.1;
}

.auth-brand .brand-sub {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.6);
}

.auth-headline {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 2.2rem;
    line-height: 1.15;
    color: #fff;
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
}

.auth-headline .accent { color: #ff5a63; display: block; }

.auth-subtext {
    color: rgba(255, 255, 255, 0.72);
    max-width: 30rem;
    line-height: 1.6;
    position: relative;
    z-index: 2;
    margin-bottom: 2.25rem;
}

.auth-features {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    margin-top: auto;
}

.auth-feature {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.auth-feature .af-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ff8a90;
}

.auth-feature h6 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 0.15rem;
    font-size: 0.98rem;
}

.auth-feature p {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.85rem;
    margin: 0;
}

.auth-right {
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 4rem;
    position: relative;
}

.auth-form-wrap {
    width: 100%;
    max-width: 26rem;
    margin: 0 auto;
}

.auth-logo-lock {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.auth-logo-lock .spark { color: var(--sp-navy-800); }
.auth-logo-lock .pay { color: var(--sp-red); }

.auth-tag {
    color: var(--sp-muted);
    font-size: 0.9rem;
    margin-bottom: 2.25rem;
}

.auth-tag .accent { color: var(--sp-red); font-weight: 600; }

.auth-title {
    font-size: 1.7rem;
    margin-bottom: 0.35rem;
}

.auth-sub {
    color: var(--sp-muted);
    margin-bottom: 1.75rem;
}

.input-icon {
    position: relative;
}

.input-icon .ic {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sp-muted);
    pointer-events: none;
}

.input-icon .form-control {
    padding-left: 2.5rem;
    background: #f8fafc;
    height: 48px;
}

.input-icon .toggle-pass {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--sp-muted);
    cursor: pointer;
    padding: 0;
}

.auth-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    right: 0;
    justify-content: center;
}

.auth-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--sp-muted);
    border: 1px solid var(--sp-line);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    background: #fff;
}

.btn-signin {
    height: 50px;
    font-size: 1rem;
    width: 100%;
}

@media (max-width: 991px) {
    .auth-left { display: none; }
    .auth-right { flex-basis: 100%; padding: 2.5rem 1.5rem; }
    .auth-chips { position: static; margin-top: 2rem; }
}
