/* Modern UI System - Professional & Elegant */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Premium Palette */
    --primary: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    --dark-gradient: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    --surface-gradient: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #334155;
    /* Slate 700 for better visibility */

    --sidebar-width: 280px;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
    letter-spacing: -0.01em;
    font-size: 1rem;
    /* Improved initial readability */
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

/* Typography & Utilities */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.font-heading {
    font-family: var(--font-heading);
}

/* Glassmorphism & Cards */
.card {
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
    border-color: #cbd5e1;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Sidebar Styling */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: #111827;
    /* Fallback */
    background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    padding-bottom: 2rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

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

.sidebar-header {
    padding: 2rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h4 {
    color: #fff;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

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

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #cbd5e1;
    /* Brighter for dark background */
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-menu li a i {
    width: 24px;
    font-size: 1.2rem;
    margin-right: 12px;
    transition: transform 0.2s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sidebar-menu li a:hover i {
    transform: translateX(3px);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    transition: all 0.4s ease;
}

/* Buttons */
.btn {
    border-radius: var(--radius-md);
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    border: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
    color: white;
}

.btn-success {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: var(--danger-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Form Controls */
.form-control,
.form-select {
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    background-color: #f9fafb;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
    background-color: #fff;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Tables */
.table-responsive {
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--card-shadow);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f1f5f9;
    /* Slightly darker shift for distinction */
    color: #1e293b;
    /* Stronger text */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.table tbody td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

/* Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
    border: none;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: white;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    filter: blur(40px);
}

.stat-card.primary {
    background: var(--primary-gradient);
}

.stat-card.success {
    background: var(--success-gradient);
}

.stat-card.danger {
    background: var(--danger-gradient);
}

.stat-card.info {
    background: var(--secondary-gradient);
}

.stat-card h3 {
    font-size: 2.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.stat-card p {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin: 0;
}

/* Login Page Split Layout */
.login-split-page {
    min-height: 100vh;
    display: flex;
    background: #f8fafc;
}

.login-left {
    flex: 1;
    background: #5d76b5;
    /* Very deep modern blue/black */
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4rem;
    z-index: 1;
}

/* Beautiful Animated Grid Background */
.login-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    z-index: -2;
    mask-image: linear-gradient(to bottom, transparent, black, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black, transparent);
    animation: panGrid 40s linear infinite;
}

/* Glowing Orbs for Depth */
.login-left::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle at 20% 30%, rgba(67, 56, 202, 0.4) 0%, transparent 35%),
        radial-gradient(circle at 80% 80%, rgba(14, 165, 233, 0.3) 0%, transparent 35%);
    filter: blur(80px);
    z-index: -3;
    animation: pulseOrbs 10s ease-in-out infinite alternate;
}

@keyframes panGrid {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 64px;
    }
}

@keyframes pulseOrbs {
    0% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

.login-left-content {
    position: relative;
    z-index: 2;
    color: white;
}

.login-right {
    width: 100%;
    max-width: 550px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: white;
}

@media (max-width: 991px) {
    .login-left {
        display: none;
    }

    .login-right {
        max-width: 100%;
    }
}

/* Landing Page */
.landing-hero {
    padding: 8rem 0 5rem;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
}

.landing-nav {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.feature-icon-box {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-body);
    transition: all 0.3s;
}

.feature-card:hover .feature-icon-box {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

/* Loader */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(79, 70, 229, 0.1);
    border-radius: 50%;
    border-top-color: #4f46e5;
    animation: spin 1s ease-in-out infinite;
}

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

/* Badges */
.badge {
    padding: 0.35em 0.8em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 999px;
    letter-spacing: 0.05em;
}

.bg-primary {
    background-color: #e0e7ff !important;
    color: #4338ca !important;
}

.bg-success {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
}

.bg-danger {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
}

.bg-warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
}

.bg-info {
    background-color: #cffafe !important;
    color: #155f75 !important;
}

.bg-purple {
    background-color: #f3e8ff !important;
    color: #7e22ce !important;
}

.text-purple {
    color: #9333ea !important;
}

/* Mobile Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .mobile-toggle {
        display: block !important;
    }
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #4b5563;
    cursor: pointer;
}

/* Modals */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--hover-shadow);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animations & Utilities */
.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

.hover-lift {
    transition: transform 0.2s;
}

.hover-lift:hover {
    transform: translateY(-3px);
}

.hover-shadow {
    transition: all 0.2s;
}

.hover-shadow:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Institutional Extensions */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.3s;
}

.tiny {
    font-size: 0.75rem !important;
    /* Increased for better primary visibility */
    letter-spacing: 0.05em;
    font-weight: 700;
    /* Bolder for clarity */
    text-transform: uppercase;
}

.transition-all {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.grow:hover {
    transform: scale(1.02);
}

.grow-on-hover:hover {
    transform: scale(1.05);
}

.w-fit {
    width: fit-content !important;
}

.italic {
    font-style: italic;
}

/* Soft Themed Badges & Backgrounds */
.bg-soft-primary {
    background-color: rgba(79, 70, 229, 0.1) !important;
    color: #4338ca !important;
}

.bg-soft-success {
    background-color: rgba(16, 185, 129, 0.1) !important;
    color: #065f46 !important;
}

.bg-soft-danger {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #991b1b !important;
}

.bg-soft-warning {
    background-color: rgba(245, 158, 11, 0.1) !important;
    color: #92400e !important;
}

.bg-soft-info {
    background-color: rgba(6, 182, 212, 0.1) !important;
    color: #155f75 !important;
}

.bg-soft-secondary {
    background-color: rgba(107, 114, 128, 0.1) !important;
    color: #374151 !important;
}

/* Micro sizing */
.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Gradient Presets */
.bg-gradient-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}

/* Table Refinements */
.table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.02);
}

.table.align-middle td,
.table.align-middle th {
    vertical-align: middle;
}

.bg-gradient-brand {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
}

.backdrop-blur {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.text-bronze {
    color: #b45309 !important;
}