/* ==========================================================================
   WD Gestão Prev — Novo Gerenciador Moderno (Design System 2026)
   ========================================================================== */

:root {
    --bg-body: #0b0f19;
    --bg-surface: #111827;
    --bg-surface-elevated: #1a2234;
    --bg-hover: rgba(255, 255, 255, 0.04);
    --border-color: #1f2937;
    --border-light: rgba(255, 255, 255, 0.08);

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --brand-primary: #3b82f6;
    --brand-primary-hover: #2563eb;
    --brand-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --purple: #8b5cf6;

    --sidebar-width: 270px;
    --header-height: 70px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-hover: rgba(0, 0, 0, 0.03);
    --border-color: #e2e8f0;
    --border-light: rgba(0, 0, 0, 0.06);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    font-size: 0.925rem;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Layout Shell */
#app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: var(--transition);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-badge {
    width: 38px;
    height: 38px;
    background: var(--brand-gradient);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-category {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item-btn {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.nav-item-btn i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-item-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item-btn:hover i {
    color: var(--brand-primary);
}

.nav-item-btn.active {
    background: rgba(59, 130, 246, 0.12);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-item-btn.active i {
    color: var(--brand-primary);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
}

/* Main Content Area */
#main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* Header */
#top-header {
    height: var(--header-height);
    background-color: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

[data-theme="light"] #top-header {
    background-color: rgba(255, 255, 255, 0.85);
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search input {
    width: 100%;
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem 0.5rem 2.4rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    transition: var(--transition);
}

.header-search input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.header-search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

/* Page Content */
#content-area {
    flex: 1;
    padding: 2rem;
}

/* Sections */
.app-section {
    display: none;
    animation: fadeIn 0.25s ease-out forwards;
}

.app-section.active {
    display: block;
}

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

/* UI Cards */
.card-modern {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: var(--transition);
}

.card-modern:hover {
    border-color: var(--border-light);
}

.card-header-modern {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body-modern {
    padding: 1.5rem;
}

/* KPI Stat Cards */
.kpi-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
    border-color: var(--border-light);
}

.kpi-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.kpi-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.kpi-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Status Badges */
.badge-status {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge-concluido { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-pendente  { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-analise   { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-irregular { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Modern Table */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern th {
    background-color: var(--bg-surface-elevated);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table-modern td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    vertical-align: middle;
}

.table-modern tbody tr {
    transition: var(--transition);
}

.table-modern tbody tr:hover {
    background-color: var(--bg-hover);
}

/* Form Controls */
.form-control-modern {
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 0.95rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    width: 100%;
    transition: var(--transition);
}

.form-control-modern:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Buttons */
.btn-modern {
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-modern-primary {
    background: var(--brand-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-modern-primary:hover {
    opacity: 0.95;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
    color: white;
}

.btn-modern-secondary {
    background-color: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-modern-secondary:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 992px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.show {
        transform: translateX(0);
    }
    #main-wrapper {
        margin-left: 0;
    }
    .header-search {
        display: none;
    }
}

