/* ============================================
   ATMedia CRM - Modern UI Design System
   ============================================ */

:root {
    /* Color Palette - Light Theme (White, Red, Black) */
    --primary: #dc2626;
    --primary-dark: #b91c1c;
    --primary-light: #ef4444;
    --secondary: #991b1b;
    --accent: #dc2626;
    --success: #16a34a;
    --warning: #ea580c;
    --danger: #dc2626;
    --info: #2563eb;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    --gradient-secondary: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-success: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    --gradient-dark: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    
    /* Backgrounds - Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f4f6;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    
    /* Text - Light Theme */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-dark: #111827;
    
    /* Borders & Shadows */
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(220, 38, 38, 0.2);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============================================
   Base Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

  html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
}

.app-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-left {
    animation: slideInLeft 0.6s ease-out;
}

.animate-slide-right {
    animation: slideInRight 0.6s ease-out;
}

.animate-scale {
    animation: scaleIn 0.4s ease-out;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

/* ============================================
   Modern Cards
   ============================================ */

.modern-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Compact filters card under page header */
.filters-card {
    padding: 0.6rem 1rem;
    margin-top: 0.5rem;
}

.filters-card .form-label-modern {
    display: none;
}

.filters-card .form-control-modern {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
}

.filters-card .btn-modern {
    padding: 0.5rem 0.9rem;
    font-size: 0.84rem;
}

.modern-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
    border-width: 2px;
}

.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.gradient-card {
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    color: white;
    box-shadow: var(--shadow-lg);
}

/* ============================================
   Buttons
   ============================================ */

.btn-modern {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all var(--transition-base);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary-modern {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    color: white;
}

.btn-secondary-modern {
    background: #ffffff;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary-modern:hover {
    background: #f9fafb;
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   Forms
   ============================================ */

.form-control-modern {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-dark);
    transition: all var(--transition-base);
    width: 100%;
}

textarea.form-control-modern {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    resize: vertical;
    box-sizing: border-box;
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    background: #ffffff;
}

.form-control-modern::placeholder {
    color: var(--text-muted);
}

.form-label-modern {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

/* ============================================
   Tables
   ============================================ */

.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-modern thead {
    background: #f9fafb;
    border-bottom: 2px solid var(--primary);
}

.table-modern thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

.table-modern tbody tr {
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.table-modern tbody tr:hover {
    background: #f9fafb;
    transform: scale(1.01);
    border-left: 3px solid var(--primary);
}

.table-modern tbody td {
    padding: 1rem;
    color: var(--text-dark);
    background: #ffffff;
}

/* ============================================
   Status Badges
   ============================================ */

.badge-modern {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
    border: 1px solid #16a34a;
}

.badge-warning {
    background: rgba(234, 88, 12, 0.1);
    color: #c2410c;
    border: 1px solid #ea580c;
}

.badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
    border: 1px solid var(--danger);
}

.badge-info {
    background: rgba(37, 99, 235, 0.1);
    color: #1e40af;
    border: 1px solid var(--info);
}

.badge-primary {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
    border: 1px solid var(--primary);
}

.badge-secondary {
    background: rgba(107, 114, 128, 0.1);
    color: #374151;
    border: 1px solid #6b7280;
}

/* ============================================
   KPI Cards
   ============================================ */

.kpi-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.kpi-card:hover::before {
    transform: scaleX(1);
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
}

.kpi-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Enhanced Avatar Circle */
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
    background: var(--gradient-primary);
    font-size: 0.875rem;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar-modern {
    width: 240px;
    height: 100vh;
    background: #ffffff;
    border-right: 2px solid var(--border-color);
    padding: 0;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 100vh;
}

/* Black Sidebar */
.sidebar-black {
    background: #000000;
    border-right-color: rgba(255, 255, 255, 0.1);
}

.sidebar-black .sidebar-nav-link {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-black .sidebar-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

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

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    padding: 1.25rem 1rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
    flex-shrink: 0;
}

.sidebar-logo-img {
    max-width: 180px;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.sidebar-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    list-style: none;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    margin: 0;
    min-height: 0;
    max-height: calc(100vh - 150px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(220, 38, 38, 0.4) rgba(0, 0, 0, 0.05);
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(220, 38, 38, 0.4);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(220, 38, 38, 0.6);
}

/* Black sidebar scrollbar */
.sidebar-black .sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

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

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

.sidebar-nav-item {
    margin-bottom: 0.5rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    position: relative;
}

.sidebar-nav-link:hover {
    background: var(--bg-card-hover);
    color: var(--primary);
    transform: translateX(5px);
}

.sidebar-nav-link.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

.sidebar-nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1.125rem;
}

.sidebar-nav-link span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9375rem;
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
    margin-left: 240px;
    margin-right: 0;
    padding: 1rem 1.25rem;
    min-height: 100vh;
    background: var(--bg-secondary);
    width: calc(100% - 240px);
    max-width: 100%;
    transition: margin-left var(--transition-base);
    box-sizing: border-box;
}

.page-header {
    margin-bottom: 1.25rem;
    animation: fadeIn 0.6s ease-out;
    padding: 0;
}

/* Adjust main content */
.main-content-consistent {
    padding: 1rem 1.25rem;
    margin-right: 0;
    width: calc(100% - 240px);
    max-width: 100%;
    box-sizing: border-box;
}

/* Logo Image Styles */
.sidebar-logo-black .sidebar-logo-img {
    filter: brightness(0) invert(1);
}

.sidebar-logo-black .sidebar-logo-fallback {
    color: #ffffff;
}


.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 0.5rem;
}

.page-title-black {
    color: #000000 !important;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

/* ============================================
   Login Page
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(220, 38, 38, 0.1);
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 6s ease-in-out infinite;
    top: -200px;
    right: -200px;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 8s ease-in-out infinite reverse;
    bottom: -150px;
    left: -150px;
}

.login-card {
    background: #ffffff;
    backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-xl);
    z-index: 1;
    animation: scaleIn 0.6s ease-out;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.login-logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-logo p {
    color: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* Desktop (1920px and above) */
@media (min-width: 1920px) {
    .sidebar-modern {
        width: 240px;
    }
    
    .main-content,
    .main-content-consistent {
        margin-left: 240px;
        margin-right: 0;
        width: calc(100% - 240px);
        max-width: 100%;
        padding: 1.25rem 1.5rem;
        box-sizing: border-box;
    }
}

/* Large Desktop (1440px - 1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
    .sidebar-modern {
        width: 240px;
        height: 100vh;
        max-height: 100vh;
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    
    .main-content,
    .main-content-consistent {
        margin-left: 240px;
        margin-right: 0;
        width: calc(100% - 240px);
        max-width: 100%;
        padding: 1rem 1.25rem;
        box-sizing: border-box;
    }
}

/* Desktop (1200px - 1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
    .sidebar-modern {
        width: 240px;
        height: 100vh;
        max-height: 100vh;
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    
    .main-content,
    .main-content-consistent {
        margin-left: 240px;
        margin-right: 0;
        width: calc(100% - 240px);
        max-width: 100%;
        padding: 1rem 1.25rem;
        box-sizing: border-box;
    }
}

/* iPad Pro Landscape (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
    .sidebar-modern {
        width: 220px;
        height: 100vh;
        max-height: 100vh;
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    
    .main-content,
    .main-content-consistent {
        margin-left: 220px;
        margin-right: 0;
        width: calc(100% - 220px);
        max-width: 100%;
        padding: 1rem 1.125rem;
        box-sizing: border-box;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .kpi-value {
        font-size: 2rem;
    }
}

/* Tablet / iPad Portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar-modern {
        width: 220px;
        height: 100vh;
        max-height: 100vh;
        transform: translateX(-100%);
    }
    
    .sidebar-modern.active {
        transform: translateX(0);
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    
    .main-content,
    .main-content-consistent {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        box-sizing: border-box;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .kpi-value {
        font-size: 1.75rem;
    }
    
    .modern-card {
        padding: 1.25rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* Responsive Tables */
    .table-modern th,
    .table-modern-full th {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }
    
    .table-modern td,
    .table-modern-full td {
        padding: 0.875rem;
    }
    
    /* Responsive Cards */
    .modern-card {
        padding: 1.25rem;
    }
    
    /* Responsive Forms */
    .form-control-modern {
        font-size: 0.875rem;
    }
}

/* Mobile Landscape / Small Tablet (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .sidebar-modern {
        width: 200px;
        height: 100vh;
        max-height: 100vh;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-modern.active {
        transform: translateX(0);
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content,
    .main-content-consistent {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        box-sizing: border-box;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .page-subtitle {
        font-size: 0.875rem;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
    
    .kpi-label {
        font-size: 0.75rem;
    }
    
    .modern-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .btn-modern {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .table-responsive {
        font-size: 0.8125rem;
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    
    .sidebar-nav-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .sidebar-logo {
        padding: 1rem 0.75rem;
        min-height: 60px;
    }
    
    .sidebar-logo-img {
        max-width: 140px;
        max-height: 50px;
    }
}

/* Mobile Portrait (up to 575px) */
@media (max-width: 575px) {
    .sidebar-modern {
        width: 100%;
        max-width: 280px;
        height: 100vh;
        max-height: 100vh;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-modern.active {
        transform: translateX(0);
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content,
    .main-content-consistent {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
        padding: 0.75rem;
        box-sizing: border-box;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .page-subtitle {
        font-size: 0.8125rem;
    }
    
    .kpi-value {
        font-size: 1.25rem;
    }
    
    .kpi-label {
        font-size: 0.7rem;
    }
    
    .modern-card {
        padding: 0.875rem;
        margin-bottom: 0.875rem;
        border-radius: 8px;
    }
    
    .btn-modern {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .page-header {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.75rem;
    }
    
    .sidebar-nav {
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }
    
    .sidebar-nav-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .sidebar-nav-link i {
        margin-right: 0.5rem;
        width: 18px;
        font-size: 0.875rem;
    }
    
    .sidebar-logo {
        padding: 0.875rem 0.75rem;
        min-height: 60px;
    }
    
    .sidebar-logo-img {
        max-width: 120px;
        max-height: 45px;
    }
    
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .g-3, .g-4 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }
}

/* ============================================
   Global Spacing Consistency
   ============================================ */

.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

[class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Consistent margins - reduce excessive gaps */
.mb-5 {
    margin-bottom: 1.25rem !important;
}

.mt-5 {
    margin-top: 1.25rem !important;
}

.mb-4 {
    margin-bottom: 1rem !important;
}

.mt-4 {
    margin-top: 1rem !important;
}

.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.g-4 {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}

/* ============================================
   Loading States
   ============================================ */

.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-card) 0%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 100%
    );
    background-size: 2000px 100%;
    animation: shimmer 2s infinite;
}

/* ============================================
   Scrollbar
   ============================================ */

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

::-webkit-scrollbar-track {
    background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ============================================
   Additional Modern Components
   ============================================ */

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    flex-shrink: 0;
}

.progress-modern {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-modern::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background: var(--gradient-primary);
    transition: width 0.5s ease;
}

/* ============================================
   Loading Spinner
   ============================================ */

.spinner-modern {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-secondary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Empty States
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============================================
   Responsive Improvements
   ============================================ */

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 2px solid var(--border-color);
    flex-shrink: 0;
    background: #ffffff;
    margin-top: auto;
    min-height: 80px;
}

.sidebar-black .sidebar-footer {
    background: #000000;
    border-top-color: rgba(255, 255, 255, 0.1);
}

.sidebar-black .sidebar-footer .btn-modern {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-black .sidebar-footer .btn-modern:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.sidebar-toggle i {
    font-size: 1.25rem;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (min-width: 1024px) {
    .sidebar-toggle {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    .sidebar-toggle {
        display: flex;
    }
    
    .sidebar-modern.active ~ .sidebar-overlay,
    .sidebar-overlay.active {
        display: block;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .sidebar-modern,
    .btn-modern,
    .sidebar-toggle {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* ============================================
   Overrides for Bootstrap
   ============================================ */

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, 
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

/* ============================================
   Accessibility Improvements
   ============================================ */

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================
   Dark Mode Support (Already Dark)
   ============================================ */

@media (prefers-color-scheme: light) {
    /* Keep dark theme as default */
}

/* ============================================
   Performance Optimizations
   ============================================ */

.animate-fade-in,
.animate-slide-left,
.animate-slide-right,
.animate-scale {
    will-change: transform, opacity;
}

/* ============================================
   Custom Scrollbar for Tables
   ============================================ */

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ============================================
   Global Spacing Consistency - Reduced Gaps
   ============================================ */

/* Consistent row spacing */
.row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

[class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Reduce excessive margins */
.mb-5 {
    margin-bottom: 1.25rem !important;
}

.mt-5 {
    margin-top: 1.25rem !important;
}

.mb-4 {
    margin-bottom: 1rem !important;
}

.mt-4 {
    margin-top: 1rem !important;
}

/* Consistent gutter spacing */
.g-3 {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.g-4 {
    --bs-gutter-x: 1.25rem;
    --bs-gutter-y: 1.25rem;
}
