/* ============================================================
   ServiceApp Cloud — Core Theme
   ============================================================ */

:root {
    --sa-primary:       #0d6efd;
    --sa-primary-dark:  #0a58ca;
    --sa-secondary:     #6c757d;
    --sa-success:       #198754;
    --sa-danger:        #dc3545;
    --sa-warning:       #ffc107;
    --sa-info:          #0dcaf0;
    --sa-dark:          #1a1d21;
    --sa-light:         #f8f9fa;
    --sa-sidebar-width: 250px;
    --sa-header-height: 56px;
}

/* ── Base ───────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f2f5;
    color: #212529;
}

/* ── Sidebar ───────────────────────────────────── */
.sa-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sa-sidebar-width);
    height: 100vh;
    background: var(--sa-dark);
    color: #fff;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}
.sa-sidebar-brand {
    padding: 1rem 1.25rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sa-sidebar-brand:hover { color: var(--sa-info); }

.sa-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}
.sa-sidebar-nav .nav-label {
    padding: 0.75rem 1.25rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,.4);
    font-weight: 600;
}
.sa-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1.25rem;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    border-radius: 0;
}
.sa-sidebar-nav a:hover,
.sa-sidebar-nav a.active {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.sa-sidebar-nav a.active {
    border-left: 3px solid var(--sa-primary);
    padding-left: calc(1.25rem - 3px);
}
.sa-sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.sa-sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 0.8rem;
}

/* ── Top bar ───────────────────────────────────── */
.sa-topbar {
    position: fixed;
    top: 0;
    left: var(--sa-sidebar-width);
    right: 0;
    height: var(--sa-header-height);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1030;
}
.sa-topbar-title {
    font-weight: 600;
    font-size: 1.05rem;
}

/* ── Main content ──────────────────────────────── */
.sa-main {
    margin-left: var(--sa-sidebar-width);
    margin-top: var(--sa-header-height);
    padding: 1.5rem;
    min-height: calc(100vh - var(--sa-header-height));
}

/* ── pg-hero Modal Header ──────────────────────── */
.pg-hero-header {
    background: linear-gradient(135deg, var(--sa-dark) 0%, #2c3136 100%);
    color: #fff;
    padding: 1.25rem 1.5rem;
    border-bottom: none;
    align-items: flex-start;
}
.pg-hero-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}
.pg-hero-kicker {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,.6);
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.pg-hero-title {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 0;
    color: #fff;
}
.pg-hero-sub {
    font-size: 0.82rem;
    color: rgba(255,255,255,.65);
}

/* ── KPI Cards / Stat Pills ───────────────────── */
.sa-stat-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.sa-stat-card .sa-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.sa-stat-card .sa-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}
.sa-stat-card .sa-stat-label {
    font-size: 0.8rem;
    color: var(--sa-secondary);
}

/* ── Global message toast ──────────────────────── */
.sa-toast-container {
    position: fixed;
    top: calc(var(--sa-header-height) + 1rem);
    right: 1.5rem;
    z-index: 1060;
}

/* ── DataTables overrides ──────────────────────── */
div.dt-container {
    width: 100% !important;
}
div.dt-container table.dataTable {
    width: 100% !important;
}
.dataTables_filter input {
    border-radius: 0.375rem !important;
    padding: 0.375rem 0.75rem !important;
    border: 1px solid #dee2e6 !important;
}
.dataTables_wrapper .row:first-child {
    margin-bottom: 0.5rem;
}

/* ── Tables ────────────────────────────────────── */
.table th {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--sa-secondary);
}

/* ── Sidebar toggle (mobile) ───────────────────── */
.sa-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

@media (max-width: 991.98px) {
    .sa-sidebar {
        transform: translateX(-100%);
    }
    .sa-sidebar.show {
        transform: translateX(0);
    }
    .sa-sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1035;
        display: none;
    }
    .sa-sidebar-backdrop.show {
        display: block;
    }
    .sa-topbar {
        left: 0;
    }
    .sa-main {
        margin-left: 0;
    }
    .sa-sidebar-toggle {
        display: inline-block;
    }
}

/* ── Utility ───────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
