:root,
[data-bs-theme="dark"] {
    /* Design System Tokens */
    --primary-h: 210;
    --primary-s: 100%;
    --primary-l: 50%;

    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-dark: hsl(var(--primary-h), var(--primary-s), 40%);
    --primary-light: hsl(var(--primary-h), var(--primary-s), 95%);

    --bg-main: #0a0a0c;
    --bg-card: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);

    --text-main: #ffffff;
    --text-muted: #b0b0b0;
}

[data-bs-theme="light"] {
    --bg-main: #f8f9fa;
    --bg-card: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-main: #212529;
    --text-muted: #6c757d;
}

:root {
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-lg: 16px;
    --radius-md: 12px;

    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
    border-radius: var(--radius-lg);
}

.premium-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.premium-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5);
    filter: brightness(1.1);
}

/* Form Controls Tweaks */
.form-label {
    color: var(--text-muted) !important;
    font-weight: 500;
}

.form-control {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--glass-border) !important;
    color: var(--text-main) !important;
    border-radius: var(--radius-md) !important;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

.form-control:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25) !important;
    color: #fff !important;
}

/* Auth Pages Styling - Premium Update */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow: hidden;
    background: url('../img/fundo_login.jpeg') no-repeat center center fixed;
    background-size: cover;
}

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

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.4;
    animation: float 10s ease-in-out infinite;
}

.orb-1 {
    width: 350px;
    height: 350px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: #8b5cf6;
    /* premium purple contrast */
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-30px) scale(1.05);
    }
}

.auth-card {
    position: relative;
    z-index: 1;
    /* Keep above orbs */
    width: 100%;
    max-width: 420px;
    padding: 50px 40px;
    background: rgba(15, 15, 20, 0.5);
    /* extra transparent to show colors */
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.brand-title {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 30px;
}

/* Transitions */
.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Dashboard Layout */
.dashboard-container {
    display: grid;
    grid-template-columns: var(--sidebar-width, 280px) 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.3s ease;
}

.dashboard-container.sidebar-collapsed {
    --sidebar-width: 80px;
}

.sidebar {
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--glass-border);
    padding: 30px 20px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    padding: 30px 10px;
}

.sidebar-collapsed .nav-text,
.sidebar-collapsed .brand-title,
.sidebar-collapsed .user-info-text {
    display: none;
}

.sidebar-collapsed .auth-logo {
    width: 40px !important;
    height: auto;
}

.sidebar-collapsed .nav-link {
    text-align: center;
    padding: 12px 0;
}

.sidebar-collapsed .nav-link i {
    margin-right: 0 !important;
    font-size: 1.4rem;
}

.main-content {
    padding: 40px;
    background: radial-gradient(circle at top right, rgba(0, 123, 255, 0.05), transparent);
    min-width: 0;
}

.stat-card {
    padding: 25px;
    margin-bottom: 20px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 5px;
}

/* Mobile Responsiveness - Bottom Tab Bar */
@media (max-width: 768px) {
    .dashboard-container {
        display: block;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        width: 100% !important;
        flex-direction: row !important;
        align-items: center;
        justify-content: space-around;
        padding: 0 10px !important;
        z-index: 1000;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        background: var(--bg-main) !important;
    }

    /* Hide top containers and separators */
    .sidebar .mb-4.px-2,
    .sidebar .d-flex.align-items-center.mb-4,
    .sidebar hr,
    .sidebar .text-uppercase,
    .sidebar .nav-text,
    .sidebar .brand-title,
    .sidebar .user-info-text,
    .sidebar .auth-logo {
        display: none !important;
    }

    /* Transform pill navigation to horizontal row */
    .sidebar .nav-pills {
        flex-direction: row !important;
        align-items: center;
        flex: 1;
        justify-content: space-evenly;
        margin-bottom: 0 !important;
        gap: 0 !important;
    }

    .sidebar .nav-link i {
        margin-right: 0 !important;
        font-size: 1.4rem;
    }

    .sidebar .nav-link {
        padding: 10px 15px;
    }

    /* Modify theme toggle button for bottom bar */
    .sidebar .mt-auto {
        margin-top: 0 !important;
        padding-top: 0 !important;
        border-top: none !important;
        width: auto !important;
    }

    .sidebar .mt-auto button {
        background: transparent !important;
        border: none !important;
        padding: 10px 15px !important;
        width: auto !important;
    }

    .sidebar .mt-auto button i {
        margin: 0 !important;
        font-size: 1.3rem;
    }

    .sidebar .mt-auto button .nav-text {
        display: none !important;
    }

    /* Modify logout block for bottom bar */
    .user-profile-block {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin-left: 10px;
    }

    .user-profile-block a.btn {
        padding: 10px !important;
    }

    .user-profile-block a.btn i {
        font-size: 1.4rem;
        margin: 0;
    }

    .main-content {
        padding: 15px;
        padding-bottom: 90px;
        /* Space for bottom nav */
    }

    /* Fix horizontal scrolls on tables/cards */
    .table-responsive {
        border: 0;
    }

    .glass {
        padding: 20px !important;
    }
}