@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Fira+Sans:wght@300;400;500;600;700&display=swap');

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
    --brand:        #00bfc3;
    --brand-dark:   #0097a0;
    --bg-app:       #F1F5F9;
    --bg-surface:   #FFFFFF;
    --bg-hover:     #F8FAFC;
    --sidebar-bg:   #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #00bfc3;
    --text-primary: #1E293B;
    --text-muted:   #64748b;
    --border:       #e2e8f0;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:    0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
    --radius:       10px;
    --radius-sm:    6px;
    --transition:   0.2s ease;
}

/* ─── Base ───────────────────────────────────────────────────── */
html, body {
    font-family: 'Fira Sans', 'Segoe UI', sans-serif;
    font-size: 16px;
    color: var(--text-primary);
    background-color: var(--bg-app);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
}

/* ─── Layout ─────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-app);
}

.app-content {
    flex: 1;
    padding: 1.5rem;
    overflow-x: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 1.25rem 0.75rem;
    min-height: 100vh;
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0 1.25rem;
    text-decoration: none;
}

.sidebar-logo img {
    max-width: 140px;
    height: auto;
    filter: brightness(0) invert(1);
}

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 0 0 1rem;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 400;
    transition: background-color var(--transition), color var(--transition);
    text-decoration: none;
    margin-bottom: 2px;
}

.sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.06);
    color: #e2e8f0;
    text-decoration: none;
}

.sidebar .nav-link.active {
    background-color: rgba(0, 191, 195, 0.15);
    color: var(--sidebar-active) !important;
    font-weight: 500;
}

.sidebar .nav-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.5);
    padding: 0.75rem 0.875rem 0.25rem;
}

/* Submenu config */
.sidebar .collapse .nav-link {
    font-size: 0.85rem;
    padding-left: 2.25rem;
}

.sidebar .dropdown-toggle::after {
    margin-left: auto;
}

/* ─── Cards / Panels ─────────────────────────────────────────── */
.card-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card-panel-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* KPI cards */
.kpi-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    text-align: center;
    transition: box-shadow var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
}

.kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    font-family: 'Fira Code', monospace;
}

/* ─── Tables ─────────────────────────────────────────────────── */
.table {
    color: var(--text-primary);
    font-size: 0.875rem;
    border-color: var(--border);
}

.table thead th {
    background-color: var(--bg-hover) !important;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    background-color: var(--bg-surface) !important;
    border-color: var(--border);
    padding: 0.625rem 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover td {
    background-color: #f0fdfe !important;
    cursor: pointer;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn-brand {
    background-color: var(--brand);
    border: none;
    color: #fff;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.25rem;
    transition: background-color var(--transition), box-shadow var(--transition);
    cursor: pointer;
}

.btn-brand:hover {
    background-color: var(--brand-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 191, 195, 0.35);
}

.btn-resetear,
.btn-outline-secondary {
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition), border-color var(--transition);
    cursor: pointer;
}

.btn-resetear:hover,
.btn-outline-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--brand);
    color: var(--brand);
}

/* ─── Form Controls ──────────────────────────────────────────── */
.form-control,
.form-select {
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 191, 195, 0.15);
    outline: none;
}

.input-filtrar,
.select-filtrar {
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--transition);
}

.input-filtrar:hover,
.select-filtrar:hover {
    border-color: var(--brand);
    background-color: var(--bg-surface);
}

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-divider {
    border: none;
    border-top: 2px solid var(--border);
    margin: 0.75rem 0 1.25rem;
}

/* ─── Badges ─────────────────────────────────────────────────── */
.badge-positive {
    background-color: #dcfce7;
    color: #16a34a;
    font-weight: 500;
    padding: 0.3em 0.65em;
    border-radius: 999px;
    font-size: 0.75rem;
}

.badge-negative {
    background-color: #fee2e2;
    color: #dc2626;
    font-weight: 500;
    padding: 0.3em 0.65em;
    border-radius: 999px;
    font-size: 0.75rem;
}

.badge-neutral {
    background-color: #fef9c3;
    color: #ca8a04;
    font-weight: 500;
    padding: 0.3em 0.65em;
    border-radius: 999px;
    font-size: 0.75rem;
}

/* ─── Modals / Overlays ──────────────────────────────────────── */
.overlay-panel {
    background-color: var(--bg-surface);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
}

/* ─── Spinner ────────────────────────────────────────────────── */
.spinner-border {
    color: var(--brand);
}

/* ─── Login ──────────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    border-radius: var(--radius);
    background-color: var(--bg-surface);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.login-logo {
    width: 180px;
    margin: 0 auto 2rem;
    display: block;
}

/* ─── Keyword Cloud ──────────────────────────────────────────── */
#keyword-cloud canvas {
    animation: fadeInCloud 0.8s ease-in-out;
}

@keyframes fadeInCloud {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }
