/* ============================================================
   Sistema RH — Design System "Corporativo Sólido"
   Paleta navy + grays quentes, sem gradientes, cantos retos
   ============================================================ */

:root {
    --sidebar-width: 248px;

    /* Superfícies e bordas */
    --bg: #f7f7f5;
    --surface: #ffffff;
    --border: #e7e5e4;
    --border-strong: #d6d3d1;

    /* Texto */
    --text: #1c1917;
    --text-secondary: #44403c;
    --text-muted: #78716c;

    /* Cor de ação (default — sobrescrita inline pela APP_PRIMARY_COLOR) */
    --primary: #1d3a5f;
    --primary-hover: #14283f;
    --primary-soft: #eef2f7;

    /* Cores semânticas (mais sóbrias que Tailwind) */
    --success: #0f766e;
    --success-soft: #ecfdf5;
    --warning: #b45309;
    --warning-soft: #fef3c7;
    --danger: #991b1b;
    --danger-soft: #fef2f2;

    /* Tipografia */
    --font: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

    /* Cantos */
    --radius-sm: 3px;
    --radius: 4px;
    --radius-lg: 6px;

    /* Sombras (quase imperceptíveis) */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

* { font-family: var(--font); }

body {
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Numerais alinhados em colunas — distinção corporativa */
.stat-value, .table-custom td, .num, .badge {
    font-feature-settings: "tnum" 1, "lnum" 1;
}

/* ----------------------------------------
   Sidebar
   ---------------------------------------- */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    min-height: 100vh;
    background: #13283e !important;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar .sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    padding: 1rem 1rem 0.875rem !important;
}

#sidebar h5 { font-size: 1.0625rem; }

#sidebar .text-muted { color: #94a3b8 !important; }
#sidebar .border-secondary, #sidebar .border-top { border-color: rgba(255, 255, 255, 0.08) !important; }

#sidebar .nav-link {
    border-radius: var(--radius);
    margin: 1px 0;
    padding: 7px 12px;
    color: #cbd5e1 !important;
    font-size: 0.875rem;
    font-weight: 400;
    transition: background 0.12s, color 0.12s;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

#sidebar .nav-link i {
    color: #94a3b8;
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

#sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff !important;
}

#sidebar .nav-link:hover i { color: #cbd5e1; }

#sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff !important;
    font-weight: 500;
    box-shadow: inset 2px 0 0 #94c3ff;
}

#sidebar .nav-link.active i { color: #ffffff; }

/* ----------------------------------------
   Wrapper / topbar
   ---------------------------------------- */
#page-content-wrapper { margin-left: var(--sidebar-width); }

.navbar {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: none !important;
    padding: 0.625rem 1rem !important;
    min-height: 52px;
}

/* ----------------------------------------
   Avatar / Notification
   ---------------------------------------- */
.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    flex-shrink: 0;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    border: 1.5px solid var(--surface);
}

/* ----------------------------------------
   Buttons
   ---------------------------------------- */
.btn {
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.4375rem 0.875rem;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    line-height: 1.4;
}

.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.5625rem 1.125rem; font-size: 0.9375rem; }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: #ffffff !important;
}

.btn-success { background: var(--success); border-color: var(--success); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #ffffff; }
.btn-danger { background: var(--danger); border-color: var(--danger); }

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-strong);
    background: var(--surface);
}

.btn-outline-secondary:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--text-muted);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #ffffff;
}

/* ----------------------------------------
   Forms
   ---------------------------------------- */
.form-control, .form-select {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.875rem;
    padding: 0.4375rem 0.75rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.12s, box-shadow 0.12s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 58, 95, 0.12);
    outline: none;
}

.input-group-text {
    background: var(--bg);
    border-color: var(--border-strong);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(29, 58, 95, 0.12); }

/* ----------------------------------------
   Cards / Surfaces
   ---------------------------------------- */
.stat-card,
.entity-card,
.employee-card,
.doc-category-card,
.filter-bar,
.custom-breadcrumb,
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: border-color 0.12s;
}

.card { box-shadow: none; }
.card-header { background: var(--bg); border-bottom: 1px solid var(--border); font-weight: 600; }

.stat-card { padding: 1rem 1.125rem; }
.row > [class*="col"] > .stat-card:only-child { height: 100%; }

.entity-card {
    padding: 1rem 1.125rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.employee-card { padding: 0.875rem 1rem; }

.doc-category-card {
    padding: 1rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.filter-bar { padding: 0.875rem 1rem; margin-bottom: 1rem; }

.custom-breadcrumb {
    padding: 0.5rem 0.875rem;
    margin-bottom: 1.25rem;
    font-size: 0.8125rem;
}

/* Hover sutil: muda borda em vez de translate/shadow */
.stat-card:hover,
.employee-card:hover {
    border-color: var(--border-strong);
}

.entity-card:hover,
.doc-category-card:hover {
    border-color: var(--primary);
    color: inherit;
}

/* ----------------------------------------
   Stat Card content
   ---------------------------------------- */
.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.stat-card .stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-top: 0.125rem;
}

.stat-card .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.375rem;
}

/* Bootstrap "bg-opacity-10" + cores semânticas */
.bg-primary.bg-opacity-10 { background-color: rgba(29, 58, 95, 0.08) !important; color: var(--primary) !important; }
.bg-success.bg-opacity-10 { background-color: rgba(15, 118, 110, 0.10) !important; color: var(--success) !important; }
.bg-warning.bg-opacity-10 { background-color: rgba(180, 83, 9, 0.10) !important; color: var(--warning) !important; }
.bg-danger.bg-opacity-10 { background-color: rgba(153, 27, 27, 0.08) !important; color: var(--danger) !important; }
.bg-info.bg-opacity-10 { background-color: rgba(29, 58, 95, 0.06) !important; color: var(--primary) !important; }

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary { background-color: var(--primary) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-warning { background-color: var(--warning) !important; }
.bg-danger { background-color: var(--danger) !important; }
.bg-light { background-color: var(--bg) !important; }
.bg-white { background-color: var(--surface) !important; }

/* ----------------------------------------
   Tables
   ---------------------------------------- */
.table-custom {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.table-custom thead th {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.625rem 1rem;
}

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

.table-custom tbody tr:last-child td { border-bottom: none; }
.table-custom tbody tr:hover { background: var(--bg); }

table thead th { font-weight: 600; }

/* ----------------------------------------
   Page header
   ---------------------------------------- */
.page-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.page-header h4 {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.125rem;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header h4 i { color: var(--text-muted); font-size: 1.125rem; }

.page-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0;
}

/* ----------------------------------------
   Tasks
   ---------------------------------------- */
.task-row { transition: background 0.12s; }
.task-row:hover { background: var(--bg) !important; }
.task-overdue { border-left: 3px solid var(--danger) !important; }
.task-warning { border-left: 3px solid var(--warning) !important; }
.task-ok { border-left: 3px solid var(--success) !important; }

/* ----------------------------------------
   Progress
   ---------------------------------------- */
.progress { background: var(--border); border-radius: var(--radius-sm); }
.progress-bar { background-color: var(--primary); }

.progress-circle { position: relative; width: 60px; height: 60px; }
.progress-circle svg { transform: rotate(-90deg); }
.progress-circle .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 700;
}

.mini-progress {
    width: 50px;
    height: 50px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mini-progress canvas { position: absolute; top: 0; left: 0; }
.mini-progress .mini-value { font-size: 0.65rem; font-weight: 700; z-index: 1; }

/* ----------------------------------------
   Badges
   ---------------------------------------- */
.badge {
    font-weight: 500;
    font-size: 0.7rem;
    padding: 0.3em 0.6em;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
}

/* ----------------------------------------
   Login
   ---------------------------------------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1rem;
    position: relative;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 32px 32px;
    background-position: -1px -1px;
    opacity: 0.5;
    pointer-events: none;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 1;
}

.login-card h3 {
    font-weight: 600;
    color: var(--text);
    font-size: 1.375rem;
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
}

.login-card p { color: var(--text-muted); font-size: 0.875rem; }

/* ----------------------------------------
   Upload area
   ---------------------------------------- */
.upload-area {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 1.75rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    background: var(--bg);
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.upload-area i { font-size: 2rem; color: var(--text-muted); }

/* ----------------------------------------
   Alerts / Dropdowns
   ---------------------------------------- */
.alert {
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.875rem;
    padding: 0.625rem 0.875rem;
}

.alert-success { background: var(--success-soft); border-color: rgba(15, 118, 110, 0.2); color: var(--success); }
.alert-danger  { background: var(--danger-soft);  border-color: rgba(153, 27, 27, 0.2);  color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: rgba(180, 83, 9, 0.2);   color: var(--warning); }
.alert-info    { background: var(--primary-soft); border-color: rgba(29, 58, 95, 0.2);   color: var(--primary); }

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.25rem;
}

.dropdown-item {
    border-radius: 3px;
    font-size: 0.875rem;
    padding: 0.4375rem 0.625rem;
}

.dropdown-item:hover { background: var(--bg); }
.dropdown-item:active { background: var(--primary); color: #ffffff; }

.dropdown-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.5rem 0.625rem 0.375rem;
}

.dropdown-divider { border-color: var(--border); margin: 0.25rem 0; }

/* ----------------------------------------
   Animations
   ---------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.2s ease; }

/* ----------------------------------------
   Misc
   ---------------------------------------- */
.chart-container { position: relative; height: 250px; }

footer { background: var(--surface) !important; border-top: 1px solid var(--border) !important; flex-shrink: 0; }
footer .small { font-size: 0.8125rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

hr { border-color: var(--border); opacity: 1; }

/* Scrollbar */
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }

/* ----------------------------------------
   Responsive
   ---------------------------------------- */
@media (max-width: 768px) {
    #sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
    #sidebar.toggled { margin-left: 0; }
    #page-content-wrapper { margin-left: 0; }

    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
        display: none;
    }

    .sidebar-overlay.active { display: block; }
}

/* ----------------------------------------
   Print
   ---------------------------------------- */
@media print {
    #sidebar, .navbar, .btn, .filter-bar { display: none !important; }
    #page-content-wrapper { margin-left: 0 !important; }
    body { background: #fff; }
}
