@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --bg-light: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --transition-speed: 0.3s;
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: #1e293b;
    overflow-x: hidden;
}

/* Sidebar Styling */
.sidebar {
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    z-index: 1000;
    padding: 32px 16px;
    background: #fff;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.02);
    transition: width var(--transition-speed) ease;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
}

.sidebar .nav {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
}

.sidebar .nav-item:last-child,
.sidebar .nav .mt-auto {
    margin-top: auto !important;
}

.sidebar .nav-header {
    list-style: none;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 8px;
    font-weight: 500;
    color: var(--secondary-color);
    transition: all var(--transition-speed);
}

.sidebar .nav-link i {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    font-size: 1.05rem;
    line-height: 1;
    text-align: center;
}


.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: #eef2ff;
    color: var(--primary-color);
}

/* Main Content Wrapper */
main,
.main-content {
    margin-left: var(--sidebar-width);
    padding: 0;
    transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

/* Card Styling */
.card {
    border: none;
    border-radius: 16px;
    background: var(--card-bg);
    backdrop-filter: blur(4px);
    box-shadow: var(--glass-shadow);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
}

/* Button UI */
.btn {
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 600;
    transition: all var(--transition-speed);
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Tables */
.table {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    vertical-align: middle;
}

.table thead th {
    background: #f1f5f9;
    border: none;
    padding: 16px;
    font-weight: 600;
    color: var(--secondary-color);
}

.table tbody td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
}

/* Auth Pages Specific */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 40px;
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Sidebar Collapsed State (Desktop Only) */
@media (min-width: 769px) {
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed main {
        margin-left: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed .sidebar .nav-link span,
    body.sidebar-collapsed .sidebar .nav-header,
    body.sidebar-collapsed .sidebar .sidebar-brand-text,
    body.sidebar-collapsed .sidebar .sidebar-brand-sub {
        display: none;
    }

    body.sidebar-collapsed .sidebar .nav-link i {
        margin-right: 0;
        font-size: 1.3rem;
        width: 100%;
        height: 24px;
        flex: 0 0 auto;
        text-align: center;
    }

    body.sidebar-collapsed .sidebar .nav-link {
        justify-content: center;
        padding: 12px 0;
    }

    body.sidebar-collapsed .sidebar .mb-5 {
        padding: 0 !important;
        text-align: center;
    }

    body.sidebar-collapsed .sidebar-toggle-btn i {
        transform: rotate(180deg);
    }
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    z-index: 1001;
    padding: 0 15px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    padding: 5px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

body.mobile-sidebar-active .sidebar-overlay {
    display: block;
}

/* Sidebar Toggle Button Styling (Desktop Only) */
@media (min-width: 769px) {
    .sidebar-toggle-btn {
        position: absolute;
        top: 20px;
        right: 10px;
        width: 30px;
        height: 30px;
        background: var(--primary-color);
        color: #fff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 1001;
        border: 2px solid #fff;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        transition: transform var(--transition-speed);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        left: -282px;
        /* Hide slightly more than width to hide shadow */
        transition: left var(--transition-speed) ease;
        padding-top: 72px;
    }

    body.mobile-sidebar-active .sidebar {
        left: 0;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }

    main,
    .main-content {
        margin-left: 0;
        padding-top: 80px;
        /* Space for mobile header */
    }

    .mobile-header {
        display: flex;
    }

    .sidebar-toggle-btn {
        display: none;
    }
}