/* ============================================================
   PropertyHub — Premium SaaS Design System
   ============================================================ */

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

/* --- Design Tokens --- */
:root {
    --sidebar-width: 210px;

    /* Primary palette */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-dark: #3730a3;
    --primary-light: #eef2ff;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;

    /* Semantic */
    --success: #10b981;
    --success-light: #ecfdf5;
    --success-dark: #065f46;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-dark: #92400e;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-dark: #991b1b;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --info-dark: #1e40af;

    /* Neutrals */
    --gray-25: #fcfcfd;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Sidebar */
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: rgba(255, 255, 255, 0.1);
    --sidebar-text: rgba(255, 255, 255, 0.55);
    --sidebar-text-hover: rgba(255, 255, 255, 0.95);
    --sidebar-accent: #818cf8;

    /* Surfaces */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* --- Page load animation --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Global Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background-color: var(--bg-body);
    color: var(--gray-800);
    font-size: 0.8125rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

::selection {
    background: var(--primary-100);
    color: var(--primary-dark);
}

/* --- Scrollbar (global subtle) --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    transition: width var(--transition-slow), box-shadow var(--transition-slow);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Sidebar header / brand */
.sidebar-header {
    background: rgba(0, 0, 0, 0.2);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header h5 {
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header h5 i {
    color: var(--sidebar-accent);
    font-size: 1.15rem;
}

/* Navigation links */
.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.45rem 1rem;
    font-size: 0.78rem;
    font-weight: 450;
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    letter-spacing: 0.01em;
    margin: 1px 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
    border-left-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: white;
    border-left-color: var(--sidebar-accent);
    font-weight: 550;
}

.sidebar-nav .nav-link i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.sidebar-nav .nav-link:hover i,
.sidebar-nav .nav-link.active i {
    opacity: 1;
}

/* Section headers */
.nav-section-header {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 1.1rem 1rem 0.3rem;
    list-style: none;
    text-transform: uppercase;
}

/* ============================================================
   PAGE CONTENT WRAPPER
   ============================================================ */
#page-content-wrapper {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-slow);
    min-height: 100vh;
    background: var(--bg-body);
}

#page-content-wrapper.expanded {
    margin-left: 0;
}

/* Page content animation */
#page-content-wrapper .container-fluid {
    animation: fadeInUp 0.35s ease both;
}

/* ============================================================
   NAVBAR / TOPBAR
   ============================================================ */
.navbar {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 0.6rem 1.25rem;
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.navbar .navbar-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar .navbar-text i.bi-person-circle {
    font-size: 1.2rem;
    color: var(--gray-400);
}

#sidebarToggle {
    border: 1px solid var(--border-color);
    color: var(--gray-500);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.6rem;
    transition: all var(--transition-fast);
    background: transparent;
}

#sidebarToggle:hover {
    background: var(--gray-50);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: transparent;
    transition: background var(--transition-base);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform var(--transition-base);
}

.kpi-card:hover .kpi-icon {
    transform: scale(1.05);
}

.kpi-icon.blue {
    background: var(--primary-50);
    color: var(--primary);
}

.kpi-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.kpi-icon.yellow {
    background: var(--warning-light);
    color: var(--warning);
}

.kpi-icon.red {
    background: var(--danger-light);
    color: var(--danger);
}

.kpi-icon.purple {
    background: #f5f3ff;
    color: #7c3aed;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.15rem;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    padding: 1rem 1.25rem;
    color: var(--gray-800);
    letter-spacing: -0.01em;
}

.card-body {
    padding: 1.25rem;
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    font-size: 0.875rem;
    margin-bottom: 0;
    color: var(--gray-700);
}

.table th {
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color) !important;
    border-top: none;
    padding: 0.85rem 1rem;
    background: var(--gray-25);
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--gray-700);
    transition: background var(--transition-fast);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: var(--gray-25);
}

.table-striped > tbody > tr:hover > td {
    background-color: var(--gray-50);
}

/* ============================================================
   BADGES (Status)
   ============================================================ */
.badge-status {
    padding: 0.3em 0.75em;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    line-height: 1.4;
}

/* Add a subtle dot indicator before badge text */
.badge-status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Success / Active states */
.badge-active,
.badge-completed,
.badge-paid,
.badge-occupied {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-active::before,
.badge-completed::before,
.badge-paid::before,
.badge-occupied::before {
    background: var(--success);
}

/* Neutral / Expired states */
.badge-expired,
.badge-past,
.badge-cancelled {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-expired::before,
.badge-past::before,
.badge-cancelled::before {
    background: var(--gray-400);
}

/* Warning / Pending states */
.badge-open,
.badge-pending,
.badge-outstanding {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.badge-open::before,
.badge-pending::before,
.badge-outstanding::before {
    background: var(--warning);
}

/* Info / In progress states */
.badge-in_progress {
    background: var(--info-light);
    color: var(--info-dark);
}

.badge-in_progress::before {
    background: var(--info);
}

/* Danger / Emergency states */
.badge-emergency,
.badge-high,
.badge-bounced,
.badge-overdue {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.badge-emergency::before,
.badge-high::before,
.badge-bounced::before,
.badge-overdue::before {
    background: var(--danger);
}

.badge-vacant {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.badge-vacant::before {
    background: var(--danger);
}

.badge-medium {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.badge-medium::before {
    background: var(--warning);
}

.badge-low {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-low::before {
    background: var(--success);
}

.badge-maintenance {
    background: #f5f3ff;
    color: #5b21b6;
}

.badge-maintenance::before {
    background: #7c3aed;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    line-height: 1.5;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.25);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: scale(0.98);
    box-shadow: none;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.2);
}

.btn-outline-secondary {
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.btn-outline-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 3px 8px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.25);
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: var(--warning-dark);
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    font-size: 1rem;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-md);
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.page-header h2 {
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0;
    color: var(--gray-900);
    letter-spacing: -0.025em;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--gray-600);
    letter-spacing: 0.01em;
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    color: var(--gray-800);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background-color: var(--bg-card);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:hover,
.form-select:hover {
    border-color: var(--gray-400);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--gray-50);
    color: var(--gray-500);
}

.form-text {
    font-size: 0.78rem;
    color: var(--gray-400);
}

.input-group-text {
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
    color: var(--gray-500);
    font-size: 0.875rem;
    border-radius: var(--radius-md);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #312e81 100%);
    position: relative;
    overflow: hidden;
}

/* Subtle geometric background pattern */
.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(79, 70, 229, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(129, 140, 248, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 40%);
    animation: fadeIn 1s ease;
}

/* Subtle dot grid overlay */
.login-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2.75rem;
    width: 100%;
    max-width: 420px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.5s ease both;
}

.login-card h3 {
    color: var(--gray-900);
    font-weight: 700;
    letter-spacing: -0.025em;
    font-size: 1.5rem;
}

.login-card .form-control {
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-md);
}

.login-card .btn-primary {
    padding: 0.6rem 1rem;
    font-weight: 600;
    width: 100%;
    font-size: 0.9375rem;
}

/* ============================================================
   ENTITY TYPE BADGES
   ============================================================ */
.entity-type {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.entity-type.trust {
    background: #f5f3ff;
    color: #5b21b6;
}

.entity-type.llc {
    background: var(--info-light);
    color: var(--info-dark);
}

.entity-type.personal {
    background: var(--success-light);
    color: var(--success-dark);
}

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container {
    position: relative;
    height: 300px;
}

/* ============================================================
   ALERT CARDS
   ============================================================ */
.alert-card {
    border-left: 3px solid;
    border-radius: var(--radius-md);
    padding: 0.8rem 1.1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-fast);
}

.alert-card:hover {
    box-shadow: var(--shadow-sm);
}

.alert-card.warning {
    border-left-color: var(--warning);
}

.alert-card.danger {
    border-left-color: var(--danger);
}

.alert-card.info {
    border-left-color: var(--primary);
}

/* Bootstrap alerts */
.alert {
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    border: none;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    color: var(--success-dark);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.alert-info {
    background: var(--info-light);
    color: var(--info-dark);
}

/* ============================================================
   PROPERTY CARDS
   ============================================================ */
.property-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    border: 1px solid var(--border-color);
}

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

.property-card .card-body {
    padding: 1.25rem;
}

/* ============================================================
   DETAIL PAGES
   ============================================================ */
.detail-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.detail-label {
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.2rem;
}

.detail-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-800);
}

/* Quick stats row */
.quick-stat {
    text-align: center;
    padding: 1rem;
    position: relative;
}

.quick-stat + .quick-stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--border-color);
}

.quick-stat .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.quick-stat .label {
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    gap: 0.2rem;
}

.page-link {
    color: var(--primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm) !important;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    transition: all var(--transition-fast);
}

.page-link:hover {
    background: var(--primary-50);
    border-color: var(--primary-100);
    color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.25);
}

.page-item.disabled .page-link {
    color: var(--gray-400);
    background: var(--gray-50);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* ============================================================
   DROPDOWN MENUS
   ============================================================ */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    font-size: 0.875rem;
    animation: fadeIn 0.1s ease;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.85rem;
    color: var(--gray-700);
    font-weight: 450;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--primary-50);
    color: var(--primary);
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb {
    font-size: 0.825rem;
    margin-bottom: 0.5rem;
}

.breadcrumb-item {
    color: var(--gray-500);
}

.breadcrumb-item a {
    color: var(--gray-500);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--gray-800);
    font-weight: 500;
}

/* ============================================================
   TOOLTIPS & POPOVERS
   ============================================================ */
.tooltip-inner {
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.65rem;
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
    border-radius: var(--radius-full);
    height: 6px;
    background: var(--gray-100);
}

.progress-bar {
    border-radius: var(--radius-full);
    background: var(--primary);
}

/* ============================================================
   NAV TABS / PILLS
   ============================================================ */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--gray-500);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.65rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    border-radius: 0;
}

.nav-tabs .nav-link:hover {
    color: var(--gray-700);
    border-bottom-color: var(--gray-300);
    background: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
    background: transparent;
}

.nav-pills .nav-link {
    border-radius: var(--radius-md);
    color: var(--gray-600);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    transition: all var(--transition-fast);
}

.nav-pills .nav-link.active {
    background: var(--primary);
    color: white;
}

/* ============================================================
   UTILITY OVERRIDES
   ============================================================ */
.text-muted {
    color: var(--gray-500) !important;
}

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

.bg-primary {
    background-color: var(--primary) !important;
}

.border {
    border-color: var(--border-color) !important;
}

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

small, .small {
    font-size: 0.8rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 0;
        overflow: hidden;
    }

    .sidebar.show {
        width: var(--sidebar-width);
        box-shadow: var(--shadow-xl);
    }

    #page-content-wrapper {
        margin-left: 0;
    }

    .kpi-value {
        font-size: 1.3rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .page-header h2 {
        font-size: 1.3rem;
    }

    .login-card {
        margin: 1rem;
        padding: 2rem;
    }

    .container-fluid {
        padding: 1rem !important;
    }

    .detail-section {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .quick-stat + .quick-stat::before {
        display: none;
    }

    .table {
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 0.6rem 0.65rem;
    }

    .kpi-card {
        padding: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --sidebar-width: 220px;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    *,
    *::before,
    *::after {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .sidebar,
    .navbar,
    .btn,
    .no-print,
    #sidebarToggle,
    .dropdown-menu,
    .modal {
        display: none !important;
    }

    #page-content-wrapper {
        margin-left: 0 !important;
    }

    body {
        background: white !important;
        color: #000 !important;
        font-size: 12pt;
    }

    .card {
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    .kpi-card {
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    .table th {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .badge-status {
        border: 1px solid #999;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a[href]::after {
        content: none;
    }

    .page-header {
        margin-bottom: 1rem;
    }

    h2, h3 {
        page-break-after: avoid;
    }

    .detail-section {
        page-break-inside: avoid;
    }
}
