/* includes/styles.css */

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

:root {
    --bg:           #f1f1f1;
    --bg2:          #ffffff;
    --bg3:          #00000016;
    --border:       #f1f1f1;
    --border2:      #cccccc;
    --text:         #4d4d4d;
	--text-dark:    #1a1a1a;
    --text-muted:   #64748b;
    --text-dim:     #3d4d63;
    --accent:       #4587b8;
    --accent2:      #202349;
    --green:        #22c55e;
    --yellow:       #f59e0b;
    --red:          #ef4444;
    --orange:       #f97316;

    /* Colores Canales */
    --c-meta-ads:    #1877f2;
    --c-google-ads:  #ea4335;
    --c-meta-social: #00b2ff;
    --c-linkedin:    #0a66c2;
	--c-nticweb:	 #4587b8;
    --c-becas:       #8b5cf6;
    --c-ucm:         #b91010;
    --c-ia:          #f59e0b;
    --c-organico:    #22c55e;
    --c-directo:     #64748b;
    --c-referral:    #94a3b8;
    --c-sin-origen:  #334155;

    /*Colores Embudo*/
    --e-preinscritos:  #d4d4d4;
    --e-cv-enviado:  #FFF2CC;
    --e-reserva-entrevista:  #ffe396;
    --e-entrevistado:  #FF6D01;
    --e-preadmitidos:  #65d3db;
    --e-alumnos:  #acd698;

    /*Colores programas*/
    --p-bd:     #02c594;
    --p-ds:     #a0cc02;
    --p-de:     #76aa9f;
    --p-cs:     #ff7b00;
    --p-iagen:  #01eeff;
    --p-mk:     #ffd000;
    --p-mkmo:   #b700ff;

    /*colores Gráfico*/
    --g-01:         #4bc0c0;
    --g-02:         #ff6384;
    --g-03:         #36a2eb;
    --g-04:         #ed8754;
    --g-05:         #26e7a6;
    --g-06:         #fab1b2;
    --g-07:         #febc3b;
    --g-08:         #8b75d7;
    --g-09:         #cff67b;
    --g-10:         #94dafb;
    --g-cuadricula: #00000005;
    --g-tooltip:    #000000c2;
    --g-ejes:       #64748b;
    --g-legend:     #4d4d4d;
    --g-labels:     #f1f1f1;

    --nav-h: 60px;
    --radius: 10px;
    --shadow: 0 4px 24px rgba(0,0,0,0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ── NAV ── */
.topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 8px;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.topnav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
}

.brand-icon { font-size: 1.3rem; }

.brand-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--accent);
    background: rgba(59,130,246,0.12);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
}

.topnav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.topnav-links::-webkit-scrollbar { display: none; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--bg3);
    color: var(--text);
}

.nav-link.active {
    background: rgba(59,130,246,0.15);
    color: var(--accent);
}

.nav-icon { font-size: 0.9rem; }

.topnav-actions { margin-left: auto; }

.btn-logout {
    padding: 6px 14px;
    border: 1px solid var(--border2);
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.btn-logout:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ── PAGE ── */
.page {
    margin-top: var(--nav-h);
    padding: 24px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.page-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── FILTERS ── */
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    outline: none;
    min-width: 130px;
    transition: border-color 0.15s;
}

.filter-select:focus { border-color: var(--accent); }

.btn-reset {
    align-self: flex-end;
    padding: 7px 16px;
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.15s;
}

.btn-reset:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── CARDS ── */
.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.card-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.card-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    color: var(--text);
    letter-spacing: -0.03em;
}

.card-value.green { color: var(--green); }
.card-value.yellow { color: var(--yellow); }
.card-value.red { color: var(--red); }

/* ── TABLE ── */
.table-wrap {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto; 
    margin-bottom: 24px;
}

.table-title {
    padding: 14px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--accent2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

thead th.num { text-align: right; }

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text);
}

tbody td.num {
    text-align: right;
    font-family: 'DM Mono', monospace;
    font-size: 0.82rem;
}

tbody tr:last-child td { border-bottom: none; }

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

tbody tr.total-row td {
    font-weight: 700;
    background: var(--bg3);
    color: var(--text);
}

/* Pijama para la tabla (Zebra striping) */
tbody tr:nth-child(even) td {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Mantenemos el hover ligeramente más notable */
tbody tr:not(.total-row):hover td { 
    background-color: rgba(0, 0, 0, 0.05); 
}

/* ── CANAL BADGE ── */
.canal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.canal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── CONVERSION ── */
.conv {
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 5px;
}

.conv.high  { color: var(--green);  background: rgba(34,197,94,0.12); }
.conv.mid   { color: var(--yellow); background: rgba(245,158,11,0.12); }
.conv.low   { color: var(--red);    background: rgba(239,68,68,0.12); }
.conv.zero  { color: var(--text-muted); }

/* ── LOADING ── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
    font-size: 0.85rem;
    gap: 10px;
}

.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── LOGIN ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
}

.image-login {
    max-width: 250px;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .icon { font-size: 2.5rem; display: block; margin-bottom: 8px; }

.login-logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-logo p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus { border-color: var(--accent); }

.btn-login {
    width: 100%;
    padding: 11px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.15s;
}

.btn-login:hover { opacity: 0.88; }

.login-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--red);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.82rem;
    margin-bottom: 16px;
    text-align: center;
}

@media (max-width: 768px) {
    .page { padding: 12px; }
    .filters { gap: 6px; }
    .filter-select { min-width: 100px; }
    .cards-row { grid-template-columns: repeat(2, 1fr); }
    thead th, tbody td { padding: 8px 8px; font-size: 0.75rem; }
}


@media (max-width: 768px) {
    .page { padding: 12px; }
    .filters { gap: 6px; }
    .filter-select { min-width: 100px; }
    .cards-row { grid-template-columns: repeat(2, 1fr); }
    thead th, tbody td { padding: 8px 8px; font-size: 0.75rem; }
}