@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
    background-color: #f9fafb;
}

/* Fix for main content with fixed sidebar */
@media (min-width: 1024px) {
    .dashboard-container .main-content {
        margin-left: 16rem !important;
        width: calc(100% - 16rem) !important;
        flex: none !important;
    }
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 16rem;
    height: 100vh;
    background-color: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    z-index: 30;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-logo-icon {
    width: 2rem;
    height: 2rem;
    background-color: #000;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.sidebar-logo-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    /* Smooth scrolling */
    scroll-behavior: smooth;
    /* iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav-item-active {
    width: 100%;
    justify-content: flex-start;
    background-color: #f3f4f6;
    color: #111827;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.sidebar-nav-item-inactive {
    width: 100%;
    justify-content: flex-start;
    color: #4b5563;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-nav-item-inactive:hover {
    color: #111827;
    background-color: #f9fafb;
}

.sidebar-nav-icon {
    width: 1rem;
    height: 1rem;
    margin-right: 0.75rem;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header Styles */
.header {
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}

.header-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Dashboard Content Styles */
.dashboard-main {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.metric-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: #111827;
    line-height: 1;
}

/* Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

/* Transactions Table */
.transactions-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.transactions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.transactions-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

/* Badges */
.badge-revenue {
    background-color: #dcfce7;
    color: #166534;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-expense {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-completed {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-pending {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Variables CSS personalizadas */
:root {
    --gray-light: #f8f9fa;
    --gray-medium: #dee2e6;
    --gray-dark: #343a40;
    --blue-soft: #5c7cfa;
}

/* Layout global */
body {
    background-color: var(--gray-light);
    color: var(--gray-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Header personalizado */
.fcd-header {
    background: white;
    border-bottom: 1px solid var(--gray-medium);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fcd-header h1 {
    color: var(--gray-dark);
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* Footer personalizado */
.fcd-footer {
    background: var(--gray-light);
    border-top: 1px solid var(--gray-medium);
    color: #6c757d;
    font-size: 0.875rem;
}

/* Cards profesionales */
.fcd-card {
    background: white;
    border: 1px solid var(--gray-medium);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Tablas responsivas */
.fcd-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fcd-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--gray-dark);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.fcd-table td {
    border-top: 1px solid var(--gray-medium);
}

/* Botones estandarizados */
.btn-primary {
    background: var(--blue-soft);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #4c6ef5;
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--gray-dark);
    border: 1px solid var(--gray-medium);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* Navegación móvil */
@media (max-width: 768px) {
    .fcd-nav {
        display: none;
    }
    
    .fcd-nav.active {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--gray-medium);
        z-index: 50;
    }
}

/* Estados financieros árbol */
.financial-tree {
    font-family: 'Fira Code', monospace;
}

.tree-level-1 { padding-left: 0; font-weight: 600; }
.tree-level-2 { padding-left: 1rem; }
.tree-level-3 { padding-left: 2rem; }
.tree-level-4 { padding-left: 3rem; }

/* KPI Cards */
.kpi-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--blue-soft);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-dark);
    line-height: 1;
}

.kpi-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

/* Alertas y notificaciones */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1edff;
    color: #0c4a6e;
    border: 1px solid #7dd3fc;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Collapsible Sidebar Styles */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #6b7280;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.sidebar-nav-item:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.sidebar-nav-item.active {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.sidebar-nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* Desktop Layout - Ensure proper margin for fixed sidebar */
@media (min-width: 1024px) {
    .lg\:ml-64 {
        margin-left: 16rem !important;
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 1023px) {
    .lg\:ml-64 {
        margin-left: 0 !important;
    }
    
    .lg\:translate-x-0 {
        transform: translateX(0) !important;
    }
    
    .lg\:static {
        position: static !important;
    }
    
    .lg\:inset-0 {
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Sidebar specific scrollbar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: #f9fafb;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Financial Planning Table */
.financial-planning-table {
    position: relative;
}

.financial-planning-table th.sticky,
.financial-planning-table td.sticky {
    position: sticky;
    left: 0;
    z-index: 10;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.financial-planning-table input[type="number"] {
    -moz-appearance: textfield;
}

.financial-planning-table input[type="number"]::-webkit-outer-spin-button,
.financial-planning-table input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.financial-planning-table select,
.financial-planning-table input {
    font-size: 0.875rem;
}

.financial-planning-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* ===== RESPONSIVE SIDEBAR ===== */

/* Hamburger Menu Button */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.hamburger-btn:hover {
    background-color: #f3f4f6;
}

.hamburger-btn svg {
    width: 1.5rem;
    height: 1.5rem;
    color: #374151;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.sidebar-overlay.active {
    display: block;
}

/* Prevent body scrolling when mobile sidebar is open */
body.overflow-hidden {
    overflow: hidden;
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    .dashboard-container {
        position: relative;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 16rem;
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport height for mobile */
        z-index: 50;
        transform: translateX(-100%); /* Hide sidebar by default */
        transition: transform 0.3s ease-in-out;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        max-height: 100vh;
        max-height: 100dvh;
        /* Safe area handling for devices with notches */
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
    }
    
    .sidebar.open {
        transform: translateX(0); /* Show sidebar when open */
    }
    
    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
    }
    
    .hamburger-btn {
        display: inline-flex;
    }
    
    /* Smaller header on mobile */
    .header {
        padding: 0.75rem 1rem;
    }
    
    .header-content .flex {
        width: 100%;
    }
    
    .header-actions {
        display: none; /* Hide on very small screens */
    }
    
    .header-title {
        font-size: 1.25rem;
    }
    
    .header-subtitle {
        font-size: 0.75rem;
    }
    
    .dashboard-main {
        padding: 1rem;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 14rem;
    }
    
    .header {
        padding: 1rem 1.25rem;
    }
    
    .dashboard-main {
        padding: 1.25rem;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 14rem; /* Slightly smaller in landscape */
    }
    
    .header {
        padding: 0.5rem 1rem;
    }
    
    .header-title {
        font-size: 1.125rem;
    }
    
    .dashboard-main {
        padding: 0.75rem;
    }
} 