/* Style System for NEXO - Advanced Transport Management App */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-base: #0b1326;
    --bg-surface: rgba(23, 31, 51, 0.7);
    --bg-surface-hover: rgba(45, 52, 73, 0.8);
    --bg-card: rgba(30, 41, 59, 0.7);
    
    --primary: #c0c1ff;
    --primary-hover: #8083ff;
    --primary-glow: rgba(128, 131, 255, 0.15);
    --primary-gradient: linear-gradient(135deg, #8083ff 0%, #494bd6 100%);
    
    --accent: #ddb7ff;
    --accent-hover: #6f00be;
    
    --success: #4ade80;
    --warning: #ffdcc5;
    --danger: #f87171;
    --text-primary: #dae2fd;
    --text-secondary: #c7c4d7;
    --text-muted: #908fa0;
    
    --border-color: rgba(255, 255, 255, 0.05);
    --border-hover: rgba(255, 255, 255, 0.12);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #151931;
    color: #A096A2;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
    color: white;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.brand-title h1 {
    font-size: 22px;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-title p {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Quick Selectors (Rutas / Cuentas) */
.quick-selectors {
    display: flex;
    gap: 12px;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 35px 10px 15px;
    font-size: 13px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.select-wrapper::after {
    content: "▼";
    font-size: 8px;
    color: var(--text-secondary);
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Navigation System (Tabs) */
aside .nav-tabs {
    display: flex;
    flex-direction: column;
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 0;
}

.tab-btn {
    flex: none;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #A096A2;
    padding: 12px 24px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    background: #3d3f5b !important;
    color: #E7D1BB !important;
    border-left: 2px solid #E7D1BB !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Main Content Views */
.view-panel {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view-panel.active {
    display: block;
}

/* Cards & Grid Layouts */
.grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

/* Card Headers */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Metric / Stat Card */
.metric-box {
    margin-top: 10px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 32px;
    font-weight: 800;
    font-family: var(--font-heading);
    margin: 5px 0;
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: #ffffff !important;
}

.metric-value.income {
    color: var(--success) !important;
}

.metric-value.expense {
    color: var(--danger) !important;
}

.metric-value.balance {
    color: var(--primary) !important;
}

/* Estilos específicos de Stitch para Paneles Financieros */
.financial-card.income-card {
    border-top: 3px solid var(--success) !important;
    box-shadow: inset 0 1px 15px rgba(74, 222, 128, 0.08), 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.financial-card.expense-card {
    border-top: 3px solid var(--danger) !important;
    box-shadow: inset 0 1px 15px rgba(248, 113, 113, 0.08), 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.financial-card.balance-card {
    border-top: 3px solid var(--accent) !important;
    box-shadow: inset 0 1px 15px rgba(221, 183, 255, 0.08), 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

/* Custom Visible Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #191c35;
}
::-webkit-scrollbar-thumb {
    background: #4a4d74;
    border-radius: 5px;
    border: 2px solid #191c35;
}
::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 10px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #191c35;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #4a4d74;
    border-radius: 5px;
    border: 2px solid #191c35;
}

/* Alerts Block */
.alerts-banner {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: pulseBorder 2s infinite;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    color: #fca5a5;
}

.alert-item.warning {
    color: #fde047;
}

.alert-icon {
    font-size: 18px;
}

/* Drag & Drop Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 35px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: var(--transition-smooth);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-zone-icon {
    font-size: 38px;
    margin-bottom: 12px;
    color: var(--primary);
}

.upload-zone-text h4 {
    font-size: 15px;
    margin-bottom: 5px;
}

.upload-zone-text p {
    font-size: 11px;
    color: var(--text-muted);
}

/* Custom Table Design */
.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

th {
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge.danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge.info {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 13.5px;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    border: none;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11.5px;
}

/* Interactive Calendar (Attendance) */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-top: 8px;
}

.calendar-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 2px 0;
}

.calendar-day {
    min-height: 36px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3px 4px;
    cursor: pointer;
    position: relative;
    transition: var(--transition-smooth);
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

.calendar-day-number {
    font-size: 12px;
    font-weight: 700;
}

.calendar-day-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    align-self: center;
}

.calendar-day.presente {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
}
.calendar-day.presente .calendar-day-status {
    background: var(--success);
}

.calendar-day.ausente {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
}
.calendar-day.ausente .calendar-day-status {
    background: var(--danger);
}

.calendar-day.cubierto {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.25);
}
.calendar-day.cubierto .calendar-day-status {
    background: var(--warning);
}

.calendar-day.manual {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.25);
}
.calendar-day.manual .calendar-day-status {
    background: var(--accent);
}

.calendar-day.selected {
    background: rgba(59, 130, 246, 0.25) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.calendar-day.festivo {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
}
.calendar-day.festivo::after {
    content: "🎉";
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 9px;
    opacity: 0.8;
}

/* Modals & Visual Overlays (Detailed Image / Forms) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 25px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

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

/* Detailed Viewer (Zoom / Pan for Invoices) */
.viewer-modal-content {
    max-width: 800px;
    width: 95%;
    display: flex;
    flex-direction: column;
    height: 80vh;
}

.viewer-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #000;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    cursor: grab;
}

.viewer-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

/* Float buttons for mobile shortcuts */
.fab-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 99;
}

.fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transition: var(--transition-smooth);
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
}

/* Mobile responsive bottom navigation */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: rgba(11, 15, 25, 0.95);
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(15px);
    z-index: 98;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    font-family: var(--font-body);
    font-weight: 500;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.mobile-nav-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.mobile-nav-btn.active {
    color: var(--primary);
}

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

@keyframes pulseBorder {
    0% { border-color: rgba(239, 68, 68, 0.25); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.1); }
    50% { border-color: rgba(239, 68, 68, 0.5); box-shadow: 0 0 10px 2px rgba(239, 68, 68, 0.15); }
    100% { border-color: rgba(239, 68, 68, 0.25); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.1); }
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .nav-tabs {
        display: none; /* Switch to mobile bottom nav */
    }
    .mobile-nav {
        display: flex;
    }
    header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    .quick-selectors {
        justify-content: space-between;
    }
    .grid-cols-2, .grid-cols-3 {
        grid-template-columns: 1fr;
    }
    body {
        padding-bottom: 90px;
    }
}

/* Estilos para Categorías Colapsables (Details/Summary Accordion) */
details.category-details {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-smooth);
    padding: 6px 0;
}

details.category-details summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
    list-style: none; /* Ocultar flecha nativa en Chrome/Firefox */
}

details.category-details summary::-webkit-details-marker {
    display: none; /* Ocultar flecha nativa en Safari */
}

details.category-details summary:hover {
    background: rgba(255, 255, 255, 0.03);
}

details.category-details summary .category-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

details.category-details summary .category-arrow {
    font-size: 10px;
    color: var(--text-muted);
    display: inline-block;
    transition: transform 0.2s ease;
}

details.category-details[open] summary .category-arrow {
    transform: rotate(90deg);
}

details.category-details .movements-list {
    padding: 8px 10px 8px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
}

details.category-details .movement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
}

details.category-details .movement-item:last-child {
    border-bottom: none;
}

details.category-details .movement-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

details.category-details .movement-desc {
    color: var(--text-primary);
    font-weight: 500;
}

details.category-details .movement-date {
    color: var(--text-muted);
    font-size: 10px;
}

details.category-details .movement-amount {
    font-weight: bold;
    color: var(--danger);
}

/* Corregir visibilidad del texto en selectores desplegables */
select option {
    background-color: #ffffff !important;
    color: #121824 !important;
}
