:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f4f6f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f8fafc;
    --topbar-bg: rgba(255, 255, 255, 0.95);
    --topbar-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --sidebar-bg: #0b1120;
    --sidebar-text: #e2e8f0;
    --topbar-bg: rgba(15, 23, 42, 0.95);
    --topbar-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.2);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
}

/* Desktop: fixed-width column that stays in view while the page scrolls. */
@media (min-width: 992px) {
    .app-sidebar {
        width: 250px;
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: 100vh;
        overflow-y: auto;
    }
}

/* Below lg the menu is an off-canvas drawer (opened from the top bar), so the
   column itself takes no space in the flow. */
@media (max-width: 991.98px) {
    .app-sidebar {
        width: 0;
        box-shadow: none;
    }

    #app-sidebar {
        --bs-offcanvas-width: 260px;
        --bs-offcanvas-bg: var(--sidebar-bg);
        --bs-offcanvas-color: var(--sidebar-text);
    }
}

.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background: #1d4ed8;
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
}

.app-sidebar .nav-link:focus-visible,
.app-topbar .btn:focus-visible,
.app-breadcrumbs a:focus-visible,
#theme-toggle:focus-visible,
.skip-link:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 2px;
}

#main-content:focus {
    outline: none;
}

.app-sidebar .navbar-brand {
    color: var(--sidebar-text);
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.app-sidebar .nav-link {
    color: var(--sidebar-text);
    opacity: 0.85;
    border-radius: 6px;
    padding: 0.55rem 0.85rem;
    margin-bottom: 2px;
    transition: all 0.15s ease-in-out;
}

.app-sidebar .nav-link:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.08);
}

.app-sidebar .nav-link.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.app-sidebar .badge-soon {
    font-size: 0.65rem;
    vertical-align: middle;
    margin-left: 0.35rem;
}

.app-main {
    flex-grow: 1;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header / Topbar Elegante */
.app-topbar {
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--topbar-shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: 60px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Breadcrumbs Elegantes */
.app-breadcrumbs {
    --bs-breadcrumb-divider: '›';
    font-size: 0.9rem;
    font-weight: 500;
}

.app-breadcrumbs .breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.app-breadcrumbs .breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.app-breadcrumbs .breadcrumb-item a:hover {
    color: var(--text-primary);
}

.app-breadcrumbs .breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 600;
}

/* Componentes do Topbar */
.topbar-badge {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 20px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.pulse-dot {
    animation: pulseAnimation 2s infinite ease-in-out;
}

@keyframes pulseAnimation {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

#theme-toggle {
    color: var(--text-primary);
    border-color: var(--border-color);
    background-color: var(--bg-primary);
    transition: all 0.15s ease-in-out;
}

#theme-toggle:hover {
    background-color: var(--bg-secondary);
    border-color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
    .pulse-dot {
        animation: none;
    }

    .app-sidebar .nav-link,
    .app-topbar,
    #theme-toggle,
    .app-breadcrumbs .breadcrumb-item a {
        transition: none;
    }
}

/* ---- Login ---- */
.login-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

.login-art {
    flex: 1 1 55%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--sidebar-bg) 0%, #0b1120 100%);
    color: var(--sidebar-text);
    padding: 3rem;
}

.login-art-caption {
    max-width: 420px;
}

.login-art-caption h2 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}

.login-art-caption p {
    color: #94a3b8;
    margin: 0;
}

.login-art-icon {
    font-size: 3rem;
    color: #60a5fa;
    display: block;
    margin-bottom: 1rem;
}

.login-form-panel {
    flex: 1 1 45%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem 2rem;
}

.login-theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--bg-primary);
    border-color: var(--border-color);
}
