/* ============================================
   Sistema OS - Modern Dashboard Theme
   ============================================ */

:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --darker: #0f172a;
    --light: #f1f5f9;
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 0.75rem;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ---- Navbar ---- */
.navbar-app {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1.5rem;
    box-shadow: var(--shadow-sm);
    z-index: 1030;
}

.navbar-app .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.navbar-app .brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.navbar-app .brand-logo-img {
    max-height: 36px;
    max-width: 140px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.navbar-app .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 0.85rem !important;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.navbar-app .nav-link:hover {
    color: var(--primary);
}

.navbar-app .nav-link.active,
.navbar-app .nav-link.show {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.navbar-app .nav-link.dropdown-toggle::after {
    margin-left: 0.35rem;
    vertical-align: 0.1em;
}

.navbar-app .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    box-shadow: var(--shadow-lg);
    padding: 0.4rem;
    margin-top: 0.5rem;
}

.navbar-app .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: 0.4rem;
    padding: 0.5rem 0.75rem;
}

.navbar-app .dropdown-item i {
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
}

.navbar-app .dropdown-item:hover {
    background: #eef2ff;
    color: var(--primary);
}

.navbar-app .dropdown-item:hover i {
    color: var(--primary);
}

.navbar-app .dropdown-item.active {
    background: #eef2ff;
    color: var(--primary);
    font-weight: 600;
}

.navbar-app .dropdown-item.active i {
    color: var(--primary);
}

.navbar-app .user-avatar-sm {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.navbar-app .navbar-toggler {
    border: none;
    padding: 0.35rem 0.5rem;
}

.navbar-app .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ---- Main Content ---- */
.main-content {
    min-height: 100vh;
}

/* ---- Top Bar (título da página + ações) ---- */
.topbar {
    background: transparent;
    padding: 1.25rem 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.topbar .page-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Menu colapsado (mobile/tablet) */
@media (max-width: 991.98px) {
    .navbar-app .navbar-collapse {
        margin-top: 0.75rem;
        border-top: 1px solid var(--border-color);
        padding-top: 0.5rem;
    }
    .navbar-app .nav-link {
        border-bottom: none !important;
        border-radius: 0.5rem;
    }
    .navbar-app .nav-link.active {
        background: #eef2ff;
    }
    .navbar-app .navbar-nav {
        gap: 0.15rem;
    }
}

/* ---- Content Area ---- */
.content-area {
    padding: 1.5rem;
}

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

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* ---- Stat Cards (tiles) ---- */
/* Data/color stays in the small icon chip + left accent; the card itself is a
   quiet white surface — a large saturated block is louder than the number it holds. */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.3rem;
    font-variant-numeric: proportional-nums;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-primary { border-left-color: var(--primary); }
.stat-primary .stat-icon { background: #eef2ff; color: #4338ca; }

.stat-success { border-left-color: #10b981; }
.stat-success .stat-icon { background: #dcfce7; color: #15803d; }

.stat-warning { border-left-color: #f59e0b; }
.stat-warning .stat-icon { background: #fef3c7; color: #b45309; }

.stat-danger { border-left-color: #ef4444; }
.stat-danger .stat-icon { background: #fee2e2; color: #b91c1c; }

.stat-info { border-left-color: #06b6d4; }
.stat-info .stat-icon { background: #cffafe; color: #0e7490; }

.stat-dark { border-left-color: #475569; }
.stat-dark .stat-icon { background: #e2e8f0; color: #1e293b; }

/* ---- Tables ---- */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table {
    margin: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Badges (estilo "tag" suave, tonalizado) ---- */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.4em 0.8em;
    border-radius: 999px;
    letter-spacing: 0.01em;
}

.badge.bg-primary   { background: #eef2ff !important; color: #4338ca; }
.badge.bg-secondary { background: #f1f5f9 !important; color: #475569; }
.badge.bg-success   { background: #dcfce7 !important; color: #15803d; }
.badge.bg-danger    { background: #fee2e2 !important; color: #b91c1c; }
.badge.bg-warning   { background: #fef3c7 !important; color: #b45309; }
.badge.bg-info      { background: #cffafe !important; color: #0e7490; }
.badge.bg-dark      { background: #e2e8f0 !important; color: #1e293b; }
.badge.bg-light     { background: #f8fafc !important; color: #475569; border: 1px solid var(--border-color); }

.bg-purple {
    background-color: #7c3aed !important;
    color: #fff;
}

/* ---- Buttons ---- */
.btn {
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-action.btn-view   { background: #eff6ff; color: #3b82f6; }
.btn-action.btn-edit   { background: #fef3c7; color: #d97706; }
.btn-action.btn-delete { background: #fee2e2; color: #ef4444; }
.btn-action.btn-download { background: #ecfdf5; color: #059669; }
.btn-action.btn-pago     { background: #eef2ff; color: #6366f1; }

.btn-action.btn-view:hover   { background: #3b82f6; color: #fff; }
.btn-action.btn-edit:hover   { background: #d97706; color: #fff; }
.btn-action.btn-delete:hover { background: #ef4444; color: #fff; }
.btn-action.btn-download:hover { background: #059669; color: #fff; }
.btn-action.btn-pago:hover     { background: #6366f1; color: #fff; }

/* ---- Forms ---- */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(79,70,229,0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(14,165,233,0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
}

.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    position: relative;
    z-index: 1;
}

.login-card .login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    margin: 0 auto 1.25rem;
}

.login-card h4 {
    text-align: center;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: var(--dark);
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

/* ---- Filter Bar ---- */
.filter-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ---- Alert ---- */
.alert {
    border-radius: var(--radius);
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ---- Responsive ---- */
@media (max-width: 575.98px) {
    .content-area {
        padding: 1rem;
    }
    .stat-card .stat-value {
        font-size: 1.35rem;
    }
}

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

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

/* ---- Chart Container ---- */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ---- Logo Preview ---- */
.logo-preview {
    max-width: 200px;
    max-height: 100px;
    object-fit: contain;
    border-radius: 8px;
    border: 2px dashed var(--border-color);
    padding: 0.5rem;
}

/* ---- Action Buttons Group ---- */
.action-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

/* ---- Input Group Custom ---- */
.input-group .btn-outline-primary {
    border: 1.5px solid var(--border-color);
    color: var(--primary);
}

.input-group .btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.input-group .form-select {
    border-right: none;
}

.input-group .btn-outline-primary {
    border-left: none;
}
