/* ============================================================
   CréditoLegal — CSS Customizado v3.0
   Tema moderno, profissional, fintech-style
   ============================================================ */

:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --primary-dark: #0d1452;
    --secondary: #00b894;
    --secondary-light: #00e6b8;
    --accent: #6c5ce7;
    --danger: #e74c3c;
    --warning: #f39c12;
    --success: #00b894;
    --info: #0984e3;
    
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #0d1b2a;
    --bg-sidebar-hover: #1b2a4a;
    --bg-sidebar-active: #1a237e;
    --bg-header: #ffffff;
    
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;
    --text-sidebar: #a4b0be;
    --text-sidebar-active: #ffffff;
    
    --border: #e1e5eb;
    --border-light: #f1f3f5;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ── */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8cfd6; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0aab4; }

/* ── Layout Principal ── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: var(--transition);
}

.app-header {
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.app-content {
    padding: 24px;
}

/* ── Sidebar ── */
.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 72px;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-text {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.sidebar-brand-text small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: var(--text-sidebar);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-menu {
    padding: 12px 0;
    flex: 1;
}

.sidebar-section {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.25);
    margin-top: 8px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-sidebar);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    text-decoration: none;
    position: relative;
}

.sidebar-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.sidebar-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    border-left-color: var(--secondary);
}

.sidebar-item .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-item.active .icon,
.sidebar-item:hover .icon {
    opacity: 1;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ── Header ── */
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.header-toggle:hover {
    background: var(--bg-body);
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.header-user:hover {
    background: var(--bg-body);
}

.header-user-info {
    text-align: right;
}

.header-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.header-user-role {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5,
.card-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* ── KPI Cards ── */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.kpi-icon.blue { background: rgba(9,132,227,0.1); color: var(--info); }
.kpi-icon.green { background: rgba(0,184,148,0.1); color: var(--secondary); }
.kpi-icon.orange { background: rgba(243,156,18,0.1); color: var(--warning); }
.kpi-icon.red { background: rgba(231,76,60,0.1); color: var(--danger); }
.kpi-icon.purple { background: rgba(108,92,231,0.1); color: var(--accent); }

.kpi-info { flex: 1; }

.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.kpi-sub .up { color: var(--success); font-weight: 600; }
.kpi-sub .down { color: var(--danger); font-weight: 600; }

/* ── Botões ── */
.btn {
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-xs);
    padding: 8px 18px;
    transition: var(--transition);
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-light);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,35,126,0.3);
}

.btn-success {
    background: var(--secondary);
    color: #fff;
}
.btn-success:hover {
    background: var(--secondary-light);
    color: #fff;
}

.btn-outline-secondary {
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: transparent;
}
.btn-outline-secondary:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
}

/* ── Tabelas ── */
.table {
    font-size: 13px;
}

.table thead th {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    padding: 12px 16px;
    background: var(--bg-body);
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: rgba(9,132,227,0.03);
}

/* ── Badges / Status ── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-status.ativo, .badge-status.paga, .badge-status.aprovado, .badge-status.assinado { background: rgba(0,184,148,0.1); color: #00a884; }
.badge-status.inativo, .badge-status.cancelado, .badge-status.cancelada { background: rgba(99,110,114,0.1); color: #636e72; }
.badge-status.pendente, .badge-status.a_vencer { background: rgba(9,132,227,0.1); color: #0984e3; }
.badge-status.vencida, .badge-status.inadimplente, .badge-status.atrasado { background: rgba(231,76,60,0.1); color: #e74c3c; }
.badge-status.renegociado, .badge-status.renegociada { background: rgba(243,156,18,0.1); color: #e17055; }
.badge-status.enviado { background: rgba(108,92,231,0.1); color: #6c5ce7; }

/* ── Forms ── */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 13.5px;
    padding: 9px 14px;
    transition: var(--transition);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.form-label {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ── Login ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d1b2a 0%, #1a237e 50%, #1b2a4a 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
}

.login-logo h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0;
}

.login-form .form-control {
    padding: 12px 16px;
    font-size: 14px;
    border-radius: var(--radius-sm);
}

.login-form .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

/* ── Alertas ── */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(0,184,148,0.1); color: #00a884; }
.alert-danger { background: rgba(231,76,60,0.1); color: #c0392b; }
.alert-warning { background: rgba(243,156,18,0.1); color: #d68910; }
.alert-info { background: rgba(9,132,227,0.1); color: #0984e3; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 13px;
    max-width: 400px;
    margin: 0 auto;
}

/* ── Responsive ── */
@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* ── Animações ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ── DataTables customização ── */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 6px 12px;
    font-size: 13px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 4px 8px;
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* ── Google Fonts Import ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
