/* ==========================================================================
   Leasing Monitoring — Design System
   Modern, clean, professional admin UI built on top of Bootstrap 5.
   ========================================================================== */

:root {
    --brand-50:  #eef4ff;
    --brand-100: #dce8ff;
    --brand-200: #b3cdff;
    --brand-400: #4f7cff;
    --brand-500: #2f5dfa;
    --brand-600: #2347d6;
    --brand-700: #1c39ad;
    --brand-900: #101f5c;

    --ink-900: #111827;
    --ink-700: #374151;
    --ink-500: #6b7280;
    --ink-300: #d1d5db;
    --ink-200: #e5e7eb;
    --ink-100: #f1f3f7;
    --ink-50:  #f8f9fc;

    --success: #12b76a;
    --warning: #f79009;
    --danger:  #f04438;
    --info:    #0ba5ec;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

    --sidebar-w: 264px;
    --topbar-h: 68px;

    --bs-primary: var(--brand-500);
    --bs-primary-rgb: 47, 93, 250;
    --bs-body-font-family: 'Plus Jakarta Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

/* --------------------------------------------------------------------
   Base
   -------------------------------------------------------------------- */
html, body { height: 100%; }

body {
    font-family: var(--bs-body-font-family);
    background-color: var(--ink-50);
    color: var(--ink-900);
    font-size: 0.9rem;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--ink-900);
    letter-spacing: -0.01em;
}

main h4:first-of-type,
.app-main > h4:first-child {
    font-size: 1.28rem;
    font-weight: 700;
    padding-bottom: 0.9rem;
    margin-bottom: 1.25rem !important;
    border-bottom: 1px solid var(--ink-200);
}

main h4:first-of-type i,
.app-main > h4:first-child i {
    color: var(--brand-500);
    background: var(--brand-50);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    margin-right: 0.6rem !important;
    vertical-align: middle;
}

a { color: var(--brand-600); }
a:hover { color: var(--brand-700); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-500); }

/* --------------------------------------------------------------------
   App shell layout (sidebar + topbar + main)
   -------------------------------------------------------------------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

#appSidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 1040;
    background: linear-gradient(180deg, var(--ink-900) 0%, #16213e 100%);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease-in-out;
    box-shadow: var(--shadow-lg);
}

.app-content {
    flex: 1 1 auto;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-main {
    flex: 1 1 auto;
    padding: 1.75rem;
    width: 100%;
}

@media (max-width: 992px) {
    #appSidebar { transform: translateX(-100%); }
    #appSidebar.show { transform: translateX(0); }
    .app-content { margin-left: 0; }
    .app-main { padding: 1.1rem; }
}

/* --------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------- */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.05rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(47, 93, 250, 0.35);
}

.sidebar-brand .brand-text {
    line-height: 1.15;
    overflow: hidden;
}

.sidebar-brand .brand-text .name {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand .brand-text .tagline {
    color: rgba(255,255,255,0.45);
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.sidebar-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.9rem 0.85rem 1.5rem;
}

.sidebar-section-title {
    color: rgba(255,255,255,0.35);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.9rem 0.6rem 0.4rem;
}

#appSidebar .nav-item { margin-bottom: 2px; }

#appSidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: rgba(255,255,255,0.68);
    font-size: 0.86rem;
    font-weight: 500;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease, color 0.15s ease;
}

#appSidebar .nav-link .nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.06);
    font-size: 0.8rem;
    flex-shrink: 0;
}

#appSidebar .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}

#appSidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(47, 93, 250, 0.35), rgba(47, 93, 250, 0.12));
}

#appSidebar .nav-link.active .nav-icon {
    background: var(--brand-500);
    color: #fff;
}

/* --------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------- */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--ink-200);
}

.app-topbar .btn-toggle-sidebar {
    border: 1px solid var(--ink-200);
    background: #fff;
    color: var(--ink-700);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-topbar .app-name-mobile {
    font-weight: 700;
    color: var(--ink-900);
    font-size: 0.95rem;
}

.topbar-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--ink-200);
    background: #fff;
    color: var(--ink-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.topbar-icon-btn:hover { background: var(--ink-100); color: var(--ink-900); }

.notif-badge-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    font-size: 0.6rem;
    line-height: 16px;
    border-radius: 8px;
    background: var(--danger);
    color: #fff;
    text-align: center;
    font-weight: 700;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid var(--ink-200);
    background: #fff;
    border-radius: 999px;
    padding: 0.3rem 0.85rem 0.3rem 0.3rem;
}

.user-menu-btn:hover { background: var(--ink-100); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-menu-btn .user-meta { line-height: 1.15; text-align: left; }
.user-menu-btn .user-meta .u-name { font-size: 0.82rem; font-weight: 600; color: var(--ink-900); }
.user-menu-btn .user-meta .u-role { font-size: 0.7rem; color: var(--ink-500); }

/* --------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------- */
.card {
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}

.card .card-header {
    background: #fff;
    border-bottom: 1px solid var(--ink-200);
    font-weight: 700;
    color: var(--ink-900);
}

.card h6 {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--ink-700);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

/* KPI-style stat cards (text-center cards used across dashboards) */
#kpiCards .card,
.card.text-center {
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

#kpiCards .card::before,
.card.text-center::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--brand-500);
}

#kpiCards .card .text-muted.small {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-500) !important;
}

/* --------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; }

.btn-primary {
    background: var(--brand-500);
    border-color: var(--brand-500);
    box-shadow: 0 2px 6px rgba(47, 93, 250, 0.28);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-600);
    border-color: var(--brand-600);
}

.btn-outline-light { border-radius: var(--radius-sm); }

/* --------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------- */
.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--ink-700);
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--ink-300);
    font-size: 0.86rem;
    padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-400);
    box-shadow: 0 0 0 0.2rem rgba(47, 93, 250, 0.15);
}

.input-group-text {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
    border-color: var(--ink-300);
}

.input-group .form-control {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* --------------------------------------------------------------------
   Tables / DataTables
   -------------------------------------------------------------------- */
.table {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.table thead th {
    background: var(--ink-100);
    color: var(--ink-700);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: none;
    white-space: nowrap;
}

.table > :not(caption) > * > * { padding: 0.65rem 0.85rem; }

.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: var(--ink-50); }

.table-hover > tbody > tr:hover > * { background-color: var(--brand-50); }

div.dataTables_wrapper div.dataTables_length select,
div.dataTables_wrapper div.dataTables_filter input {
    border-radius: var(--radius-sm);
    border: 1px solid var(--ink-300);
    padding: 0.3rem 0.6rem;
}

div.dataTables_wrapper div.dataTables_filter input:focus { outline: none; border-color: var(--brand-400); }

table.dataTable thead th, table.dataTable thead td { border-bottom: 2px solid var(--ink-200) !important; }

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--brand-500) !important;
    border-color: var(--brand-500) !important;
    color: #fff !important;
    border-radius: var(--radius-sm);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius-sm) !important;
    margin-left: 3px !important;
}

/* --------------------------------------------------------------------
   Badges / status pills
   -------------------------------------------------------------------- */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    padding: 0.4em 0.65em;
    border-radius: 999px;
}

/* --------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------- */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--ink-200);
    padding: 1.1rem 1.4rem;
}

.modal-header .modal-title { font-weight: 700; font-size: 1rem; }
.modal-body { padding: 1.4rem; }
.modal-footer { border-top: 1px solid var(--ink-200); padding: 1rem 1.4rem; }

/* --------------------------------------------------------------------
   Notification dropdown
   -------------------------------------------------------------------- */
.dropdown-menu {
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
}

#notifList .notifItem:hover { background: var(--brand-50); }

/* --------------------------------------------------------------------
   Auth (login) page
   -------------------------------------------------------------------- */
body.auth-body {
    background: radial-gradient(circle at 15% 20%, #1c39ad 0%, #101f5c 45%, #0b1638 100%);
    min-height: 100vh;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 900px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: #fff;
}

.auth-side {
    background:
        radial-gradient(circle at 20% 15%, rgba(255,255,255,0.12), transparent 45%),
        linear-gradient(160deg, var(--brand-600), var(--brand-900));
    color: #fff;
    padding: 2.75rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    min-height: 100%;
}

.auth-side .auth-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: rgba(255,255,255,0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.auth-side h2 { color: #fff; font-size: 1.5rem; margin-bottom: 0.6rem; }
.auth-side p { color: rgba(255,255,255,0.75); font-size: 0.88rem; line-height: 1.6; }

.auth-side .auth-features { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.auth-side .auth-features li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.85);
    margin-bottom: 0.7rem;
}
.auth-side .auth-features li i { color: #7fdba4; }

.auth-form-side { padding: 2.75rem 2.5rem; }

.auth-form-side .auth-heading { font-size: 1.35rem; margin-bottom: 0.25rem; }
.auth-form-side .auth-sub { color: var(--ink-500); font-size: 0.86rem; margin-bottom: 1.75rem; }

@media (max-width: 767.98px) {
    .auth-side { display: none; }
}

/* --------------------------------------------------------------------
   Error pages (403 / 404)
   -------------------------------------------------------------------- */
.error-page-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink-50);
}

.error-code {
    font-size: 5rem;
    font-weight: 800;
    color: var(--brand-500);
    line-height: 1;
}
