/* Variables de diseño premium (Paleta cálida de cafetería combinada con Filament PHP) */
:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #1e1b18; /* Marrón café oscuro profundo */
    --sidebar-hover: #2d2925;
    --primary: #d97706; /* Ámbar/Panadería */
    --primary-hover: #b45309;
    --primary-light: #fef3c7;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-white: #ffffff;
    --border-color: #e5e7eb;
    --success: #10b981;
    --success-light: #ecfdf5;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --border-radius: 12px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
}

/* Reset general */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Clases de utilidad */
.hide {
    display: none !important;
}

/* --- 1. LOGIN PÁGINA --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(217, 119, 6, 0.1) 0%, rgba(0, 0, 0, 0.02) 90%), #f3f4f6;
}

.login-card {
    background-color: var(--bg-card);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    font-size: 2.5rem;
    display: inline-block;
    margin-bottom: 0.5rem;
    animation: bounce 2s infinite;
}

.login-logo h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

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

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #4b5563;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: #f9fafb;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15);
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    background-color: var(--danger-light);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-block {
    display: width;
    width: 100%;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.login-footer code {
    background-color: #f3f4f6;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

/* --- 2. LAYOUT APP PRINCIPAL --- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Panel Lateral (Sidebar) */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    flex-shrink: 0;
}

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

.sidebar-header .logo-icon {
    font-size: 2rem;
    animation: none;
    margin-bottom: 0;
}

.sidebar-title h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.sidebar-title span {
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-grow: 1;
}

.nav-item {
    background: none;
    border: none;
    color: #9ca3af;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--sidebar-hover);
    color: var(--text-white);
}

.nav-item.active {
    border-left: 3px solid var(--primary);
    background-color: rgba(217, 119, 6, 0.08);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.user-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-info span {
    font-size: 0.75rem;
    color: #9ca3af;
}

.logout-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Área de Contenido Principal */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Barra superior (Topbar) */
.topbar {
    background-color: var(--bg-card);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-left h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.month-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f3f4f6;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.month-selector-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.month-selector-wrapper input {
    border: none;
    background: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
}

/* Botones especiales */
.btn-success {
    background-color: var(--success);
    color: var(--text-white);
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--text-white);
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #e5e7eb;
    color: #374151;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

/* Paneles y Secciones */
.content-view {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Grilla de Métricas */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.metric-info span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-info h3 {
    font-size: 1.85rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.metric-icon {
    font-size: 1.5rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-income .metric-icon {
    background-color: var(--success-light);
    color: var(--success);
}

.card-expense .metric-icon {
    background-color: var(--danger-light);
    color: var(--danger);
}

.card-balance .metric-icon {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* Paneles de Contenido */
.card-panel {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.panel-header span {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Grillas del dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Sección de reporte */
.report-download-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(255, 255, 255, 1) 100%);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.download-text h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #78350f;
}

.download-text p {
    font-size: 0.9rem;
    color: #92400e;
    margin-top: 0.25rem;
    max-width: 600px;
}

/* --- TABLA DE TRANSACCIONES --- */
.filter-bar {
    border-bottom: none;
    margin-bottom: 1rem;
    padding-bottom: 0;
}

.filters {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.filters select {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: #f9fafb;
    font-size: 0.875rem;
    outline: none;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: #f9fafb;
}

.data-table tbody tr {
    transition: var(--transition);
}

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

/* Etiquetas e insignias */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-income {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-expense {
    background-color: var(--danger-light);
    color: var(--danger);
}

.cell-amount {
    font-weight: 700;
}

.cell-amount.income {
    color: var(--success);
}

.cell-amount.expense {
    color: var(--danger);
}

.btn-delete {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.btn-delete:hover {
    background-color: var(--danger-light);
}

/* --- MODALES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: var(--transition);
}

.modal-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: var(--text-main);
}

#transaction-form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Animaciones */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Diseño Responsivo Móvil */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        flex-direction: row;
        align-items: center;
    }
    .sidebar-header {
        border-bottom: none;
        padding-bottom: 0;
    }
    .sidebar-nav {
        flex-direction: row;
        margin-top: 0;
        flex-grow: unset;
        gap: 0.25rem;
    }
    .nav-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    .nav-item span {
        display: none;
    }
    .sidebar-footer {
        border-top: none;
        padding-top: 0;
        gap: 0.5rem;
    }
    .user-profile {
        display: none;
    }
    .topbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        align-items: stretch;
    }
    .topbar-right {
        flex-wrap: wrap;
    }
    .content-view {
        padding: 1rem;
    }
    .report-download-section {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* --- ESTILOS DE SERVICIOS --- */
input[type="file"] {
    padding: 0.5rem;
    cursor: pointer;
}

.btn-view-doc {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary);
    background-color: var(--primary-light);
    border-radius: 6px;
    text-decoration: none;
    transition: var(--transition);
}

.btn-view-doc:hover {
    background-color: var(--primary);
    color: white;
}

.btn-view-doc.disabled {
    background-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    pointer-events: none;
}

