/**
 * Hoja de Estilos Principal
 * ruta: /assets/css/styles.css
 * @version 3.11.1
 * 24 de febrero 2026 a las 19:15 pm
 */

/* --- Inicio Bloque: VARIABLES & RESET --- */
:root {
    --bg-dark: #111827;
    --bg-card: #1f2937;
    --bg-input: #374151;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #374151;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- Fin Bloque: VARIABLES & RESET --- */

/* --- Inicio Bloque: HEADER CONTROLS --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 20px;
    flex-wrap: nowrap !important;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
    flex-wrap: nowrap !important;
}

.sync-badge-container {
    display: inline-flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 12px;
    height: 38px;
    gap: 8px;
    flex-shrink: 0;
}

.sync-icon-area {
    display: flex;
    align-items: center;
    color: var(--text-muted);
}

.sync-timer {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--accent);
    font-size: 0.95rem;
    line-height: 1;
}

.next-sync-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-right: 10px;
    white-space: nowrap;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* --- Fin Bloque: HEADER CONTROLS --- */

/* --- Inicio Bloque: LAYOUT GENERICO --- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1f2937 0%, #111827 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    font-weight: 600;
}

.error-msg {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 1rem;
    display: none;
    word-break: break-word;
}

.sidebar {
    width: 250px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-header {
    padding: 1rem 1rem 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-top: 1rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--bg-dark);
    color: var(--text-main);
}

.badge-fb-icon {
    background: #1877F2;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-right: 8px;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
    white-space: nowrap;
}

.progress-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: transparent;
    z-index: 100;
    overflow: hidden;
    display: none;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--success);
    transition: width 0.3s ease-in-out;
    box-shadow: 0 0 10px var(--success);
}

.progress-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s, top 0.5s;
    pointer-events: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-message.show {
    opacity: 1;
    top: 30px;
}

.card {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.native-card {
    margin-bottom: 0 !important;
    padding: 1.2rem;
}

.native-title {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.native-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

input,
select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    border-color: var(--accent);
}

.btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.btn:hover {
    background-color: var(--accent-hover);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-danger {
    background-color: var(--danger);
}

/* --- Fin Bloque: LAYOUT GENERICO --- */

/* --- Inicio Bloque: KPI Grids & Metrics --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background-color: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
}

.kpi-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.kpi-delta {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.kpi-label-sm {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.delta-pos,
.text-green {
    color: var(--success);
}

.delta-neg,
.text-red {
    color: var(--danger);
}

.text-yellow {
    color: var(--warning);
}

.bg-green {
    background-color: var(--success);
}

.bg-yellow {
    background-color: var(--warning);
}

.bg-red {
    background-color: var(--danger);
}

/* --- Fin Bloque: KPI Grids & Metrics --- */

/* --- Inicio Bloque: Tablas de Datos --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-main);
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.02);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.col-title {
    width: 40%;
    min-width: 250px;
}

.col-date {
    width: 12%;
    min-width: 100px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.score-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
    text-align: center;
    min-width: 40px;
    display: inline-block;
}

.score-high {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.score-med {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.score-low {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

.divider-title {
    display: flex;
    align-items: center;
    margin: 3rem 0 1.5rem 0;
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 600;
}

.divider-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 1rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Fin Bloque: Tablas de Datos --- */

/* --- Inicio Bloque: CHARTS & GROWTH STATS --- */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    margin-bottom: 2.5rem;
}

.growth-stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.growth-stat-item {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.growth-stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

.growth-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.growth-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.growth-body {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.growth-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.growth-pill {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.pill-pos {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pill-neg {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.pill-neu {
    background: rgba(156, 163, 175, 0.15);
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.2);
}

/* --- Fin Bloque: CHARTS & GROWTH STATS --- */

/* --- Inicio Bloque: TABS SYSTEM --- */
.tabs-header {
    display: flex;
    gap: 25px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    position: relative;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    padding: 0 0 1rem 0;
    font-size: 0.95rem;
    position: relative;
    transition: color 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--accent);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
}

.chart-tab-content {
    display: none;
    animation: fadeInTab 0.3s ease-in-out;
}

.chart-tab-content.active {
    display: block;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Fin Bloque: TABS SYSTEM --- */

/* --- Inicio Bloque: SWITCH UI (Toggle Demo/Prod) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--warning);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 4px;
    bottom: 4px;
    background-color: var(--warning);
    transition: .4s;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

input:checked+.slider {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: var(--success);
}

/* --- Fin Bloque: SWITCH UI (Toggle Demo/Prod) --- */