/* ============================================
   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;
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --body-bg: #f1f5f9;
    --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; }

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-brand h5 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: #fff;
}

.sidebar-brand small {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 400;
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-nav .nav-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    padding: 0.75rem 1.25rem 0.4rem;
    margin-top: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav a.active {
    color: #fff;
    background: rgba(79, 70, 229, 0.15);
    border-left-color: var(--primary);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-footer .user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-footer .user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.sidebar-footer .user-email {
    font-size: 0.7rem;
    color: #64748b;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* ---- Top Bar ---- */
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

.topbar .breadcrumb {
    font-size: 0.8rem;
    margin: 0;
    background: none;
    padding: 0;
}

.btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.25rem;
    margin-right: 0.75rem;
}

/* ---- 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 ---- */
.stat-card {
    border: none;
    border-radius: var(--radius);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    color: #fff;
    box-shadow: var(--shadow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    opacity: 0.85;
    font-weight: 500;
}

.stat-primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat-success { background: linear-gradient(135deg, #059669, #10b981); }
.stat-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.stat-danger  { background: linear-gradient(135deg, #dc2626, #ef4444); }
.stat-info    { background: linear-gradient(135deg, #0284c7, #0ea5e9); }
.stat-dark    { background: linear-gradient(135deg, #334155, #475569); }

/* ---- 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 ---- */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.35em 0.75em;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

.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-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; }

/* ---- 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: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .btn-sidebar-toggle {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

@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;
}
