/* CIMS Web - Premium Design System */
:root {
    --primary: #6366f1; /* Vibrant Indigo */
    --primary-dark: #4f46e5;
    --secondary: #ec4899; /* Pink accent */
    
    /* Light Theme (Default) */
    --bg-main: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --white: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.7);
    --border: #e2e8f0;
    --header-bg: rgba(255, 255, 255, 0.8);
    --input-bg: rgba(255, 255, 255, 0.5);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Dark Theme Overrides */
.dark-theme {
    --bg-main: #0f172a; /* Slate 900 */
    --text-main: #f1f5f9; /* Slate 100 */
    --text-muted: #94a3b8; /* Slate 400 */
    --white: #1e293b; /* Slate 800 */
    --card-bg: rgba(30, 41, 59, 0.7); /* Slate 800 with glass */
    --border: #334155; /* Slate 700 */
    --header-bg: rgba(15, 23, 42, 0.8);
    --input-bg: rgba(30, 41, 59, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

/* Typography */
h1, h2, h3 { font-weight: 800; letter-spacing: -0.025em; }
p { line-height: 1.6; }

/* Components: Glass Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: background 0.3s, border 0.3s;
}

/* Button System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    gap: 0.5rem;
    color: var(--text-main);
}

.input-field {
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    transition: all 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Auth Page specific */
.auth-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    transition: background 0.3s;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.6s ease-out;
}

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

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

/* Sidebar Base Style */
aside#sidebar {
    width: 280px;
    background: var(--white);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100vh;
    transition: background 0.3s, border 0.3s;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

aside#sidebar::-webkit-scrollbar {
    width: 4px;
}

aside#sidebar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

aside#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    aside#sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1001;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }

    aside#sidebar.active {
        left: 0;
    }

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

    #sidebar-overlay.active {
        display: block;
    }

    main#content-area {
        padding: 1.5rem !important;
    }
}

@media (max-width: 768px) {
    #stats-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-content {
        grid-template-columns: 1fr !important;
    }

    header h1 {
        font-size: 1.5rem !important;
    }
}

/* Table Responsiveness */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 1rem;
    border-radius: var(--radius-sm);
}

.table-container table {
    min-width: 600px; /* Force scroll on very narrow screens */
}

/* Printing utilities */
.hidden-print { display: none; }
@media print {
    body { background: #fff !important; }
}

/* Filter Grid Responsiveness */
.filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr !important;
    }
}
