@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-sidebar: rgba(15, 23, 42, 0.95);

    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.5);

    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    /* Lighter for better visibility on dark bg */

    --border-glass: rgba(255, 255, 255, 0.1);

    /* Spacing */
    --radius-lg: 1rem;
    --radius-md: 0.75rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    /* Fancy background gradient */
    background: radial-gradient(circle at top left, #1e1b4b, transparent 40%),
        radial-gradient(circle at bottom right, #312e81, transparent 40%),
        var(--bg-dark);
}

/* Fix Input visibility globally - User Request: Black text, White background */
/* EXCLUDE checkboxes/radios so they keep their checked state colors */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.form-control {
    background-color: #ffffff !important;
    color: #0d0d0d !important;
    /* Almost black */
    border: 1px solid #ced4da !important;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    background-color: #ffffff !important;
    color: #0d0d0d !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

::placeholder {
    color: #6c757d !important;
    /* Visible gray */
}


/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-glass);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.brand-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: 0 0 20px var(--primary-glow);
}

.brand-logo span {
    color: var(--primary);
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-main);
    transform: translateX(5px);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.nav-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-glass);
    padding-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-content {
    padding: 2rem;
    animation: fadeIn 0.6s ease-out;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Typography & Elements */
h1,
h2,
h3 {
    margin-top: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Force Bootstrap override */
.text-muted {
    color: var(--text-muted) !important;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--accent);
    text-decoration: none;
}

/* Utility / Bootstrap Overrides specific */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    box-shadow: 0 4px 15px var(--primary-glow);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

/* Fix Tables to match User Request (White Background, Dark Text) */
.table:not(.table-dark-custom) {
    --bs-table-bg: #ffffff;
    --bs-table-color: #1e293b;
    /* Slate-800 */
    background-color: #ffffff;
    border-radius: var(--radius-md);
    overflow: hidden;
    /* For rounded corners */
}

.table:not(.table-dark-custom) > :not(caption) > * > * {
    background-color: #ffffff !important;
    border-bottom-color: #e2e8f0;
    /* Light border */
    color: #1e293b !important;
}

.table:not(.table-dark-custom) thead th {
    background-color: #f1f5f9 !important;
    /* Light gray header */
    color: #0f172a !important;
    font-weight: 700;
}

.table:not(.table-dark-custom) .text-muted {
    color: #64748b !important;
    /* Slate-500, visible on white */
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 150px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Mobile Responsive Layout --- */
@media (max-width: 900px) {

    /* Increased breakpoint to catch tablets too */
    .app-container {
        display: block !important;
        /* Force block layout */
        position: relative;
        overflow-x: hidden;
    }

    /* Sidebar Hidden by Default */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: -280px;
        /* Hide off-screen */
        width: 260px;
        height: 100vh;
        z-index: 1050;
        /* Above everything */
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
        background: var(--bg-sidebar);
        /* Ensure background is opaque */
    }

    /* Sidebar Visible when Active */
    .app-container.show-sidebar .sidebar {
        left: 0;
    }

    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
        /* Hidden by default */
        backdrop-filter: blur(2px);
    }

    .app-container.show-sidebar .sidebar-overlay {
        display: block;
    }

    /* Main Content Adjustments */
    .main-content {
        padding: 5rem 1rem 2rem 1rem !important;
        /* More top padding for button */
        width: 100% !important;
        margin-left: 0 !important;
    }
}