/* ============================================================
   RCS CPaaS Platform - Main Stylesheet
   ============================================================ */

/* ---------- CSS Custom Properties (Light) ---------- */
:root {
    --rcs-primary: #0d6efd;
    --rcs-primary-rgb: 13,110,253;
    --rcs-secondary: #6c757d;
    --rcs-success: #198754;
    --rcs-warning: #ffc107;
    --rcs-danger: #dc3545;
    --rcs-info: #0dcaf0;

    --rcs-gradient-start: #0d6efd;
    --rcs-gradient-end: #6610f2;

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 60px;

    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #0a1628;
    --bg-topbar: #ffffff;
    --bg-input: #f8f9fa;

    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-sidebar: rgba(255,255,255,0.65);
    --text-sidebar-active: #ffffff;
    --text-sidebar-label: rgba(255,255,255,0.35);
    --text-muted: #adb5bd;

    --border-color: #dee2e6;
    --border-card: rgba(0,0,0,0.08);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-dropdown: 0 10px 40px rgba(0,0,0,0.12);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* ---------- Dark Theme ---------- */
[data-bs-theme="dark"] {
    --bg-body: #0b0f19;
    --bg-card: #111827;
    --bg-topbar: #111827;
    --bg-input: #1e293b;

    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --border-color: #1f2937;
    --border-card: rgba(255,255,255,0.06);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-dropdown: 0 10px 40px rgba(0,0,0,0.5);
}

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--rcs-primary); text-decoration: none; }
a:hover { color: color-mix(in srgb, var(--rcs-primary) 80%, black); }

/* ---------- App Layout ---------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-normal);
}

.main-content {
    flex: 1;
    padding: 1.5rem;
}

/* ---------- Top Bar ---------- */
.app-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 1020;
    transition: left var(--transition-normal);
}

.topbar-left, .topbar-right { display: flex; align-items: center; }
.topbar-right { gap: 0.5rem; }

.sidebar-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.sidebar-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--rcs-gradient-start), var(--rcs-gradient-end));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}
.brand-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.topbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.95rem;
}
.topbar-btn:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.topbar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    padding: 2px 5px;
    min-width: 16px;
    text-align: center;
}

.topbar-user {
    padding: 0.25rem 0.5rem;
    border: none;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    text-decoration: none;
}
.topbar-user:hover {
    background: var(--bg-input);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rcs-gradient-start), var(--rcs-gradient-end));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.user-avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}
.user-name { font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.75rem; }

.notification-dropdown {
    width: 360px;
    max-height: 420px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-dropdown);
    border-radius: var(--radius-md);
    padding: 0;
}
.notification-dropdown .dropdown-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
}
.notification-list { max-height: 320px; overflow-y: auto; }
.notification-item {
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid var(--border-color);
    white-space: normal;
}
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background: var(--bg-input); }
.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}
.notification-empty { color: var(--text-muted); }
.notification-dropdown .dropdown-footer {
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border-color);
}
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.825rem;
    line-height: 1.4;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: width var(--transition-normal), transform var(--transition-normal);
    overflow: hidden;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: #fff;
    width: 100%;
    overflow: hidden;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--rcs-gradient-start), var(--rcs-gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(13,110,253,0.3);
}

.brand-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
    white-space: nowrap;
}
.brand-title {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.3px;
}
.brand-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0;
}

.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.sidebar-section { margin-bottom: 0.5rem; }

.sidebar-section-title {
    padding: 0.5rem 1.25rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-sidebar-label);
    white-space: nowrap;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    gap: 0.7rem;
    white-space: nowrap;
    position: relative;
}
.sidebar-link:hover {
    color: var(--text-sidebar-active);
    background: rgba(255,255,255,0.04);
}

.sidebar-icon {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.sidebar-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
    font-weight: 600;
}

.sidebar-chevron {
    font-size: 0.6rem;
    transition: transform var(--transition-fast);
}

.sidebar-menu-item.active > .sidebar-link {
    color: var(--text-sidebar-active);
    background: rgba(13,110,253,0.12);
    border-left-color: var(--rcs-primary);
}
.sidebar-menu-item.active > .sidebar-link .sidebar-icon {
    color: var(--rcs-primary);
}

.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgba(0,0,0,0.15);
}
.sidebar-submenu .sidebar-link {
    padding: 0.4rem 1.25rem 0.4rem 3.5rem;
    font-size: 0.8rem;
    font-weight: 400;
}
.sidebar-submenu-item.active > .sidebar-link {
    color: var(--text-sidebar-active);
    background: rgba(13,110,253,0.08);
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.sidebar-credits {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.5rem;
}
.credits-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-sidebar-label);
    font-weight: 600;
}
.credits-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-top: 0.15rem;
}
.credits-currency {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-sidebar);
}
.sidebar-version {
    text-align: center;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.2);
    padding-top: 0.25rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1025;
    backdrop-filter: blur(2px);
}

/* ---------- Sidebar Collapsed ---------- */
.app-wrapper.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}
.app-wrapper.sidebar-collapsed .app-main,
.app-wrapper.sidebar-collapsed .app-topbar {
    margin-left: var(--sidebar-collapsed-width);
    left: var(--sidebar-collapsed-width);
}
.app-wrapper.sidebar-collapsed .sidebar-section-title,
.app-wrapper.sidebar-collapsed .sidebar-label,
.app-wrapper.sidebar-collapsed .sidebar-badge,
.app-wrapper.sidebar-collapsed .sidebar-chevron,
.app-wrapper.sidebar-collapsed .brand-text,
.app-wrapper.sidebar-collapsed .sidebar-footer .sidebar-credits,
.app-wrapper.sidebar-collapsed .sidebar-footer .sidebar-version {
    display: none;
}
.app-wrapper.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.6rem;
}
.app-wrapper.sidebar-collapsed .sidebar-submenu .sidebar-link {
    padding: 0.4rem 0.75rem;
    justify-content: flex-start;
}
.app-wrapper.sidebar-collapsed .sidebar-submenu {
    position: absolute;
    left: var(--sidebar-collapsed-width);
    top: auto;
    min-width: 200px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    z-index: 1035;
    box-shadow: var(--shadow-dropdown);
    background: var(--bg-sidebar);
}

/* ---------- Cards & Panels ---------- */
.card {
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-header-primary {
    background: linear-gradient(135deg, var(--rcs-gradient-start), var(--rcs-gradient-end));
    color: #fff;
    border: none;
}
.card-header-primary .card-title { color: #fff; margin: 0; }

.card-body { padding: 1.25rem; }

.stat-card {
    border: none;
    border-radius: var(--radius-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card), 0 8px 25px rgba(0,0,0,0.06);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
.stat-icon-primary {
    background: rgba(13,110,253,0.1);
    color: var(--rcs-primary);
}
.stat-icon-success {
    background: rgba(25,135,84,0.1);
    color: var(--rcs-success);
}
.stat-icon-warning {
    background: rgba(255,193,7,0.1);
    color: var(--rcs-warning);
}
.stat-icon-danger {
    background: rgba(220,53,69,0.1);
    color: var(--rcs-danger);
}
.stat-icon-info {
    background: rgba(13,202,240,0.1);
    color: var(--rcs-info);
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}
.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
}
.stat-change.positive { color: var(--rcs-success); }
.stat-change.negative { color: var(--rcs-danger); }

/* ---------- Tables ---------- */
.table {
    font-size: 0.85rem;
    color: var(--text-primary);
}
.table > thead > tr > th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom-width: 1px;
    padding: 0.75rem;
}
.table > tbody > tr > td {
    padding: 0.75rem;
    vertical-align: middle;
}
.table > tbody > tr:hover {
    background: var(--bg-input);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}
.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-top: 0.75rem;
}
.dataTables_wrapper .dataTables_paginate {
    padding-top: 0.75rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-color) !important;
    margin: 0 2px;
    font-size: 0.8rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--rcs-primary) !important;
    border-color: var(--rcs-primary) !important;
    color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg-input) !important;
    border-color: var(--border-color) !important;
}

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control:focus, .form-select:focus {
    border-color: var(--rcs-primary);
    box-shadow: 0 0 0 3px rgba(13,110,253,0.12);
    background: var(--bg-card);
    color: var(--text-primary);
}
.form-control::placeholder { color: var(--text-muted); }

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.input-group-text {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ---------- Buttons ---------- */
.btn {
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.9rem;
    transition: all var(--transition-fast);
}
.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
}
.btn-primary {
    background: linear-gradient(135deg, var(--rcs-gradient-start), var(--rcs-gradient-end));
    border: none;
}
.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(13,110,253,0.3);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}
.btn-ghost:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* ---------- Page Header ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header h1, .page-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--text-primary);
}
.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}
.page-breadcrumb {
    font-size: 0.8rem;
}
.page-breadcrumb .breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
}
.page-breadcrumb .breadcrumb-item.active {
    color: var(--text-primary);
}

/* ---------- Alerts ---------- */
.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.85rem;
    padding: 0.85rem 1rem;
}
.alert-success { background: rgba(25,135,84,0.1); color: var(--rcs-success); }
.alert-danger { background: rgba(220,53,69,0.1); color: var(--rcs-danger); }
.alert-warning { background: rgba(255,193,7,0.15); color: #b8860b; }
.alert-info { background: rgba(13,202,240,0.1); color: #0a7c98; }

[data-bs-theme="dark"] .alert-warning { color: #ffc107; }

.alert-fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

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

/* ---------- Badges ---------- */
.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25em 0.55em;
    border-radius: 4px;
}
.badge-active, .badge-success {
    background: rgba(25,135,84,0.12) !important;
    color: var(--rcs-success) !important;
}
.badge-inactive, .badge-danger {
    background: rgba(220,53,69,0.12) !important;
    color: var(--rcs-danger) !important;
}
.badge-pending, .badge-warning {
    background: rgba(255,193,7,0.15) !important;
    color: #b8860b !important;
}
.badge-info {
    background: rgba(13,202,240,0.12) !important;
    color: #0a7c98 !important;
}

/* ---------- Dropdowns ---------- */
.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-dropdown);
    border-radius: var(--radius-md);
    padding: 0.4rem;
    background: var(--bg-card);
}
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}
.dropdown-item:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}
.dropdown-item-text {
    padding: 0.5rem 0.75rem;
}
.dropdown-header {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ---------- Modals ---------- */
.modal-content {
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
}
.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
}
.modal-title {
    font-weight: 700;
    font-size: 1rem;
}

/* ---------- Footer ---------- */
.app-footer {
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: auto;
}
.footer-links a {
    color: var(--text-secondary);
    font-size: 0.78rem;
    transition: color var(--transition-fast);
}
.footer-links a:hover {
    color: var(--rcs-primary);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Utilities ---------- */
.text-gradient {
    background: linear-gradient(135deg, var(--rcs-gradient-start), var(--rcs-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--rcs-gradient-start), var(--rcs-gradient-end)) !important;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hover-card {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.hover-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}
.empty-state h5 {
    color: var(--text-secondary);
    font-weight: 600;
}
.empty-state p {
    max-width: 360px;
    margin: 0.5rem auto 1.5rem;
    font-size: 0.85rem;
}

/* ---------- Chart Containers ---------- */
.chart-container {
    position: relative;
    width: 100%;
}
.chart-container canvas {
    max-width: 100%;
}

/* ---------- Responsive ---------- */

/* Tablet */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main,
    .app-topbar {
        margin-left: 0;
        left: 0;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .app-wrapper.sidebar-collapsed .app-main,
    .app-wrapper.sidebar-collapsed .app-topbar {
        margin-left: 0;
        left: 0;
    }
}

/* Mobile */
@media (max-width: 575.98px) {
    .main-content {
        padding: 1rem;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-header h1, .page-header h4 {
        font-size: 1.15rem;
    }
    .stat-value { font-size: 1.35rem; }
    .topbar-search { display: none !important; }
    .notification-dropdown {
        width: calc(100vw - 1rem);
        max-width: 360px;
        right: -0.5rem !important;
    }
}

/* ---------- Print ---------- */
@media print {
    .app-sidebar,
    .app-topbar,
    .app-footer,
    .sidebar-overlay {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
    }
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}
