/* ============================================================
   Administrelo.com - Tema Visual
   Colores de marca + componentes custom
   ============================================================ */

/* ── Variables CSS ─────────────────────────────────── */
:root {
    --navy:          #1B3A5C;
    --navy-light:    #2A5280;
    --navy-dark:     #112840;
    --green:         #4CAF50;
    --green-dark:    #2E7D32;
    --green-light:   #81C784;
    --accent:        #FDCB6E;
    --accent-dark:   #F0B429;
    --alert:         #E17055;
    --info:          #42A5F5;
    --bg:            #F5F7FA;
    --bg-card:       #FFFFFF;
    --text-primary:  #2D3748;
    --text-secondary:#718096;
    --text-muted:    #A0AEC0;
    --border:        #E2E8F0;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:     0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg:     0 10px 25px rgba(0,0,0,0.1);
    --transition:    all 0.2s ease;
}

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

body {
    font-family: 'Inter', 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--navy);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--green);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}

.sidebar-brand small {
    font-size: 11px;
    opacity: 0.6;
    display: block;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav .nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.4;
    padding: 16px 12px 8px;
    margin-top: 8px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav .nav-link.active {
    background: var(--green);
    color: white;
    box-shadow: 0 2px 8px rgba(76,175,80,0.3);
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-plan {
    font-size: 11px;
    opacity: 0.5;
}

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

.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-header .page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
}

.top-header .header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-body {
    padding: 28px 32px;
}

/* ── 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-md);
}

.card-header-custom {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-custom h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
}

.card-body { padding: 20px 24px; }

/* ── Stat Cards (Dashboard) ────────────────────────── */
.stat-card {
    padding: 24px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    overflow: hidden;
    min-width: 0;
}

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

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card .stat-info {
    min-width: 0;
    flex: 1;
}

.stat-card .stat-icon.green  { background: #E8F5E9; color: var(--green); }
.stat-card .stat-icon.red    { background: #FBE9E7; color: var(--alert); }
.stat-card .stat-icon.blue   { background: #E3F2FD; color: var(--info); }
.stat-card .stat-icon.yellow { background: #FFF8E1; color: var(--accent-dark); }
.stat-card .stat-icon.navy   { background: #E8EDF2; color: var(--navy); }

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Buttons ───────────────────────────────────────── */
.btn-admin {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-admin-primary {
    background: var(--green);
    color: white;
}
.btn-admin-primary:hover {
    background: var(--green-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76,175,80,0.3);
}

.btn-admin-navy {
    background: var(--navy);
    color: white;
}
.btn-admin-navy:hover {
    background: var(--navy-light);
    color: white;
    transform: translateY(-1px);
}

.btn-admin-outline {
    background: transparent;
    color: var(--navy);
    border: 2px solid var(--border);
}
.btn-admin-outline:hover {
    border-color: var(--navy);
    background: var(--navy);
    color: white;
}

.btn-admin-accent {
    background: var(--accent);
    color: var(--navy-dark);
}
.btn-admin-accent:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

/* ── Forms ─────────────────────────────────────────── */
.form-control-admin {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-card);
}

.form-control-admin:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.15);
    outline: none;
}

.form-label-admin {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ── Tasks ─────────────────────────────────────────── */
.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.task-item:last-child { border-bottom: none; }

.task-check {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.task-check:hover { border-color: var(--green); }
.task-check.done { background: var(--green); border-color: var(--green); color: white; }

.task-title { flex: 1; font-size: 14px; }
.task-title.done { text-decoration: line-through; color: var(--text-muted); }

.priority-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}
.priority-urgent { background: #FBE9E7; color: var(--alert); }
.priority-high   { background: #FFF3E0; color: #E65100; }
.priority-medium { background: #E3F2FD; color: var(--info); }
.priority-low    { background: #F5F5F5; color: var(--text-secondary); }

/* ── Habits ────────────────────────────────────────── */
.habit-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
}

.habit-item:hover { background: var(--bg); }

.habit-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.habit-streak {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-dark);
}

/* ── Insights ──────────────────────────────────────── */
.insight-card {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    margin-bottom: 12px;
    background: var(--bg-card);
}

.insight-card.tip         { border-color: var(--info); }
.insight-card.alert       { border-color: var(--alert); }
.insight-card.celebration { border-color: var(--accent); }
.insight-card.suggestion  { border-color: var(--green); }

/* ── Flash messages ────────────────────────────────── */
.flash-message {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.flash-success { background: #E8F5E9; color: var(--green-dark); border: 1px solid #C8E6C9; }
.flash-danger  { background: #FBE9E7; color: #C62828; border: 1px solid #FFCDD2; }
.flash-info    { background: #E3F2FD; color: #1565C0; border: 1px solid #BBDEFB; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Toggle sidebar (mobile) ───────────────────────── */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--navy);
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.active {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .page-body {
        padding: 20px 16px;
    }
    .top-header {
        padding: 0 16px;
    }
}

@media (max-width: 767px) {
    /* Stat cards: más compactas en móvil */
    .stat-card {
        padding: 16px;
        gap: 10px;
    }
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }
    .stat-card .stat-value {
        font-size: 18px;
    }
    .stat-card .stat-label {
        font-size: 11px;
    }

    /* Filtros: stack vertical en móvil */
    .finanzas-filters .row {
        flex-direction: column;
    }
    .finanzas-filters .col-auto {
        width: 100%;
    }
    .finanzas-filters select,
    .finanzas-filters input[type="text"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Tabla: scroll horizontal con hint visual */
    .table-responsive {
        margin: 0 -16px;
        padding: 0 16px;
        -webkit-overflow-scrolling: touch;
    }
    .table th, .table td {
        white-space: nowrap;
        font-size: 13px;
        padding: 10px 12px;
    }
    .table th:first-child, .table td:first-child { padding-left: 16px; }
    .table th:last-child, .table td:last-child { padding-right: 16px; }

    /* Cards: padding reducido */
    .card-body {
        padding: 16px;
    }
    .card-header-custom {
        padding: 16px 16px 0;
    }
    .card-header-custom h3 {
        font-size: 14px;
    }

    /* Presupuestos: una columna */
    .budget-grid .col-md-6,
    .budget-grid .col-lg-4 {
        width: 100%;
    }

    /* Gráficas: height mínimo para que se vean bien */
    canvas {
        min-height: 200px;
    }
}

@media (max-width: 575px) {
    .stat-card .stat-value { font-size: 16px; }
    .stat-card .stat-label { font-size: 10px; }
    .stat-card .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    .stat-card {
        padding: 12px;
        gap: 8px;
    }
    .top-header .page-title { font-size: 16px; }
    .page-body { padding: 16px 12px; }

    /* Modal: fullscreen en móvil pequeño */
    .modal-dialog {
        margin: 8px;
    }
    .modal-content {
        border-radius: 16px !important;
    }
    .modal-body {
        padding: 16px 20px 20px !important;
    }

    /* Navegación de mes: más compacta */
    .month-nav h5 {
        font-size: 16px !important;
        min-width: auto !important;
    }
}

/* ── Misc ──────────────────────────────────────────── */
.text-navy   { color: var(--navy) !important; }
.text-green  { color: var(--green) !important; }
.text-accent { color: var(--accent-dark) !important; }
.text-alert  { color: var(--alert) !important; }
.bg-navy     { background: var(--navy) !important; }
.bg-green    { background: var(--green) !important; }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    font-size: 14px;
    max-width: 300px;
    margin: 0 auto;
}
