/* ============================================================
   CHERI SMS - Modern Design Token System
   Ported from WebForms to ASP.NET Core MVC

   CSS Cascade: This file loads AFTER login-themes.css,
   so :root variables here consume the --lp-* palette values.
   ============================================================ */

/* === LIGHT MODE (DEFAULT) === */
:root {
    /* Primary Colors - driven by color theme picker (login-themes.css) */
    --primary-color: var(--lp-primary, #6366f1);
    --primary-hover: var(--lp-hover, #4f46e5);
    --primary-dark: var(--lp-dark, #3730a3);
    --primary-light: var(--lp-light, #eef2ff);
    --primary-lighter: var(--lp-lighter, #e0e7ff);
    --primary-50: var(--lp-light, #eef2ff);
    --primary-100: var(--lp-lighter, #e0e7ff);
    --primary-200: #c7d2fe;
    --primary-500: var(--lp-primary, #6366f1);
    --primary-600: var(--lp-hover, #4f46e5);
    --primary-700: #4338ca;
    --primary-800: var(--lp-dark, #3730a3);
    --primary-900: #312e81;

    /* Secondary Colors - Purple */
    --secondary-color: #8b5cf6;
    --secondary-hover: #7c3aed;
    --secondary-light: #f5f3ff;

    /* Accent Color - Amber */
    --accent-color: #f59e0b;
    --accent-hover: #d97706;
    --accent-light: #fffbeb;

    /* Semantic Colors */
    --success-color: #10b981;
    --success-light: #ecfdf5;
    --success-dark: #059669;
    --warning-color: #f59e0b;
    --warning-light: #fffbeb;
    --warning-dark: #d97706;
    --danger-color: #ef4444;
    --danger-light: #fef2f2;
    --danger-dark: #dc2626;
    --info-color: #06b6d4;
    --info-light: #ecfeff;
    --info-dark: #0891b2;

    /* Background Colors */
    --bg-page: #fafafa;
    --bg-card: #ffffff;
    --bg-sidebar: var(--lp-sidebar-bg, linear-gradient(180deg, #6366f1 0%, #4f46e5 50%, #3730a3 100%));
    --bg-input: #ffffff;
    --bg-hover: #f8fafc;
    --bg-table-header: #f8fafc;
    --bg-selected: #eef2ff;
    --bg-overlay: rgba(0, 0, 0, 0.5);

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #334155;
    --text-muted: #4b5563;
    --text-on-primary: #ffffff;
    --text-on-dark: #f1f5f9;
    --text-link: var(--lp-primary, #6366f1);
    --text-link-hover: var(--lp-hover, #4f46e5);

    /* Border Colors */
    --border-color: #e2e8f0;
    --border-focus: var(--lp-primary, #6366f1);
    --border-hover: #cbd5e1;
    --border-light: #f1f5f9;
    --border-input: var(--lp-lighter, #c7d2fe);

    /* Section Header */
    --section-header-bg: var(--lp-section-header-bg, linear-gradient(135deg, #6366f1, #8b5cf6));

    /* Focus Shadow */
    --focus-shadow: var(--lp-focus-shadow, 0 0 0 0.15rem rgba(99,102,241,.25));

    /* Sidebar-specific */
    --sidebar-bg: var(--lp-sidebar-bg, linear-gradient(180deg, #6366f1 0%, #4f46e5 50%, #3730a3 100%));
    --sidebar-hover: rgba(255, 255, 255, 0.15);
    --sidebar-active: rgba(255, 255, 255, 0.25);
    --text-primary-sidebar: #ffffff;
    --text-secondary-sidebar: rgba(255, 255, 255, 0.95);

    /* Typography */
    --font-heading: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;

    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    --leading-tight: 1.3;
    --leading-normal: 1.5;
    --leading-relaxed: 1.6;

    /* Spacing (8px grid) */
    --space-0: 0;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --shadow-focus: var(--lp-focus-shadow, 0 0 0 3px rgba(99, 102, 241, 0.3));

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;
    --transition-modal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-sidebar: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-toast: 600;
    --z-tooltip: 700;
}


/* ============================================================
   SIDEBAR SCOPED VARIABLE OVERRIDES
   Restore white text within .sidebar scope
   ============================================================ */

.sidebar {
    --text-primary: #ffffff !important;
    --text-secondary: rgba(255, 255, 255, 0.95) !important;
    --text-muted: rgba(255, 255, 255, 0.7) !important;
    --border-color: rgba(255, 255, 255, 0.2) !important;
    --text-link: #ffffff !important;
    --text-link-hover: #ffffff !important;
    color: #ffffff !important;
}

.sidebar a {
    color: #ffffff !important;
}

.sidebar .submenu > a,
.sidebar .submenu .submenu-header {
    color: rgba(255, 255, 255, 0.95) !important;
}

.sidebar .submenu > a:hover,
.sidebar .submenu .submenu-header:hover {
    color: #ffffff !important;
}

.sidebar .menu-title {
    color: #ffffff !important;
}


/* ============================================================
   GLOBAL OVERRIDES - Apply modern styles when theme is active
   ============================================================ */

/* Body background */
body {
    background-color: var(--bg-page) !important;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: var(--leading-normal);
}

/* Headings */
h1, h2, h3, .h1, .h2, .h3 {
    font-family: var(--font-heading);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

/* Links */
a {
    color: var(--text-link);
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--text-link-hover);
}


/* ============================================================
   MODAL OVERRIDES
   ============================================================ */

.modal-backdrop.show {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    border: none !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-5);
}

.modal-title {
    font-family: var(--font-heading);
    font-weight: var(--font-semibold);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: var(--space-4) var(--space-5);
}

.modal.fade .modal-dialog {
    transition: transform var(--transition-modal), opacity var(--transition-modal);
    transform: translateY(20px);
}

.modal.show .modal-dialog {
    transform: translateY(0);
}


/* ============================================================
   TAB OVERRIDES
   ============================================================ */

.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    border: none;
    padding: 0.75rem 1rem;
    position: relative;
    transition: color var(--transition-fast);
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    border: none;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color) !important;
    background: transparent !important;
    border: none !important;
    font-weight: var(--font-semibold);
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}


/* ============================================================
   DROPDOWN OVERRIDES
   ============================================================ */

.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.25rem;
    background-color: var(--bg-card);
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--bg-hover);
    color: var(--primary-color);
}

.dropdown-divider {
    border-color: var(--border-color);
}


/* ============================================================
   NOTIFICATION BADGE PULSE ANIMATION
   ============================================================ */

@keyframes notification-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: var(--font-bold);
    color: #ffffff;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-radius: var(--radius-full);
    animation: notification-pulse 2s ease-in-out infinite;
}


/* ============================================================
   AVATAR STYLES
   ============================================================ */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 72px; height: 72px; }


/* ============================================================
   SCROLLBAR STYLING (Modern thin scrollbars)
   ============================================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}


/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* Hover lift effect */
.hover-lift {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Print: Always use light mode */
@media print {
    :root {
        --bg-page: #ffffff;
        --bg-card: #ffffff;
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-color: #cccccc;
    }
}
