/* ============================================
   quEstudio — Estilos minimalistas v2
   ============================================ */

/* ── Lang Selector ── */
.lang-selector {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.lang-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
}

:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --bg-hover: #f5f5f7;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #a1a1a6;
    --border: #e5e5e7;
    --primary: #0071e3;
    --primary-hover: #0077ED;
    --primary-light: #e8f2ff;
    --gradient-1: #667eea;
    --gradient-2: #764ba2;
    --success: #34c759;
    --warning: #ff9f0a;
    --danger: #ff3b30;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 14px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.1), 0 8px 20px rgba(0,0,0,0.06);
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============ UTILIDADES ============ */
.gradient-text {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============ PANTALLAS ============ */
.screen { display: none; min-height: 100vh; animation: fadeIn 0.5s ease; max-width: 100vw; overflow-x: hidden; }
.screen.active { display: flex; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ============ BOTONES ============ */
.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 28px; background: var(--primary); color: white; border: none;
    border-radius: 980px; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: var(--transition); font-family: inherit;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-large { padding: 18px 36px; font-size: 18px; }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; background: var(--bg-card); color: var(--text);
    border: 1.5px solid var(--border); border-radius: 980px;
    font-size: 15px; font-weight: 500; cursor: pointer;
    transition: var(--transition); font-family: inherit;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-muted); }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 12px 24px; background: none; color: var(--primary); border: none;
    font-size: 15px; font-weight: 500; cursor: pointer;
    transition: var(--transition); font-family: inherit;
}
.btn-ghost:hover { color: var(--primary-hover); text-decoration: underline; }

.btn-back-home {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; background: var(--bg-hover); color: var(--text-secondary);
    border: none; border-radius: 980px; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: var(--transition); font-family: inherit; margin-bottom: 24px;
}
.btn-back-home:hover { background: var(--border); color: var(--text); }

/* ============ HERO ============ */
#hero {
    flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 24px; text-align: center; position: relative; overflow: hidden;
    background: linear-gradient(180deg, #f0f4ff 0%, var(--bg) 60%);
}

.hero-content { max-width: 680px; z-index: 1; }

.hero-badge {
    display: inline-block; padding: 6px 16px; background: var(--primary-light);
    color: var(--primary); border-radius: 980px; font-size: 13px;
    font-weight: 600; letter-spacing: 0.02em; margin-bottom: 24px;
}

#hero h1 { font-size: clamp(36px, 6vw, 56px); font-weight: 800; line-height: 1.1; margin-bottom: 20px; letter-spacing: -0.03em; }

.hero-subtitle {
    font-size: 18px; color: var(--text-secondary); line-height: 1.7;
    margin-bottom: 36px; max-width: 560px; margin-left: auto; margin-right: auto;
}

.hero-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 40px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-number { font-size: 32px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }

#hero .btn-primary { margin-bottom: 12px; }

.hero-visual { position: absolute; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none; }
.floating-cards { position: relative; width: 100%; height: 100%; }

.float-card {
    position: absolute; padding: 10px 20px; background: var(--bg-card);
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
    font-size: 14px; font-weight: 500; opacity: 0.5;
    animation: float 6s ease-in-out infinite;
    display: flex; align-items: center; gap: 8px;
}
.float-card .fc-icon { width: 20px; height: 20px; flex-shrink: 0; }

.c1 { top: 12%; left: 8%; animation-delay: 0s; }
.c2 { top: 20%; right: 10%; animation-delay: 1s; }
.c3 { top: 55%; left: 5%; animation-delay: 2s; }
.c4 { top: 65%; right: 6%; animation-delay: 0.5s; }
.c5 { bottom: 18%; left: 12%; animation-delay: 1.5s; }
.c6 { bottom: 28%; right: 14%; animation-delay: 2.5s; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ============ QUIZ ============ */
#quiz { flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.quiz-container { max-width: 720px; width: 100%; }
.quiz-progress { margin-bottom: 40px; }

.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    border-radius: 3px; transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); width: 20%;
}
.progress-text { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.quiz-question h2 { font-size: 28px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.quiz-question .question-subtitle { font-size: 15px; color: var(--text-secondary); margin-bottom: 32px; }

.optional-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; background: var(--bg-hover); border-radius: 980px;
    font-size: 11px; font-weight: 600; color: var(--text-muted); margin-left: 8px;
    text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle;
    white-space: nowrap;
}

.quiz-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 12px; margin-bottom: 4px; }

.quiz-option {
    display: flex; align-items: center; gap: 14px; padding: 18px 20px;
    background: var(--bg-card); border: 2px solid var(--border);
    border-radius: var(--radius); cursor: pointer; transition: var(--transition); user-select: none;
}
.quiz-option:hover { border-color: var(--text-muted); background: var(--bg-hover); transform: translateY(-2px); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(0,113,227,0.12); }

.quiz-option .opt-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-hover); border-radius: var(--radius-xs); padding: 4px;
}
.quiz-option.selected .opt-icon { background: rgba(0,113,227,0.12); }
.quiz-option .opt-icon svg { width: 22px; height: 22px; color: var(--text-secondary); }
.quiz-option.selected .opt-icon svg { color: var(--primary); }

.quiz-option .opt-text { font-size: 15px; font-weight: 500; line-height: 1.3; }

.quiz-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; gap: 12px; flex-wrap: wrap; }
.quiz-nav .btn-primary { margin-left: auto; white-space: nowrap; }
.quiz-nav .btn-ghost { white-space: nowrap; }
.quiz-nav .btn-secondary { white-space: nowrap; }

/* ============ LOADING ============ */
#loading { flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px; }
.loading-content h2 { font-size: 24px; font-weight: 700; margin-top: 24px; margin-bottom: 8px; }
.loading-content p { color: var(--text-secondary); }

.loader { position: relative; width: 80px; height: 80px; margin: 0 auto; }
.loader-ring { position: absolute; width: 100%; height: 100%; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
.loader-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ RESULTADOS ============ */
#results { flex-direction: column; align-items: center; padding: 40px 24px 80px; }
.results-container { max-width: 960px; width: 100%; }
.results-header { margin-bottom: 36px; }
.results-header h2 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.results-subtitle { color: var(--text-secondary); font-size: 16px; margin-bottom: 16px; }

/* --- Filtro de ubicación --- */
.location-filter {
    background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: var(--radius); padding: 16px 20px; margin-top: 16px;
}
.location-filter-header {
    display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 12px;
}
.location-filter-header svg { color: var(--primary); }

.location-selects { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.location-selects select {
    flex: 1 1 0; min-width: 0; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    font-family: inherit; font-size: 14px; background: var(--bg);
    color: var(--text); cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 32px;
}
.location-selects select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,0.12); }
.location-selects select:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-clear-location {
    width: 32px; height: 32px; border: none; border-radius: 50%;
    background: var(--bg-hover); color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); flex-shrink: 0;
}
.btn-clear-location:hover { background: var(--danger); color: white; }

/* ── Accordion CCAA (detalle) ── */
.centros-accordion { display: flex; flex-direction: column; gap: 8px; }
.ccaa-group {
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    overflow: hidden; transition: var(--transition);
}
.ccaa-group[open] { box-shadow: var(--shadow-sm); }
.ccaa-summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; font-size: 15px; font-weight: 700;
    color: var(--text); cursor: pointer; user-select: none;
    background: var(--bg-hover); transition: var(--transition);
    list-style: none;
}
.ccaa-summary::-webkit-details-marker { display: none; }
.ccaa-summary::before {
    content: '▸'; margin-right: 10px; transition: transform 0.2s ease;
    font-size: 12px; color: var(--text-muted);
}
.ccaa-group[open] > .ccaa-summary::before { transform: rotate(90deg); }
.ccaa-group[open] > .ccaa-summary { border-bottom: 1.5px solid var(--border); }
.ccaa-summary:hover { background: var(--border); }
.ccaa-count {
    background: var(--primary-light); color: var(--primary);
    font-size: 12px; font-weight: 700; padding: 2px 10px;
    border-radius: 980px; margin-left: auto;
}
.ccaa-group .centros-grid { padding: 12px; }

/* ── Filtro centros en detalle ── */
.detail-centros-filter {
    display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap;
    margin-bottom: 12px;
}
.detail-centros-search {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; background: var(--bg); border: 1.5px solid var(--border);
    border-radius: 980px; flex: 1 1 240px; min-width: 0; transition: var(--transition);
}
.detail-centros-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,113,227,0.12); }
.detail-centros-search svg { color: var(--text-muted); flex-shrink: 0; }
.detail-centros-search input {
    flex: 1; border: none; outline: none; font-size: 14px;
    font-family: inherit; background: none; color: var(--text); min-width: 0;
}
.detail-centros-search input::placeholder { color: var(--text-muted); }
.detail-centros-selects { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-centros-selects select {
    padding: 10px 32px 10px 14px; border: 1.5px solid var(--border);
    border-radius: var(--radius-xs); font-family: inherit; font-size: 13px;
    background: var(--bg); color: var(--text); cursor: pointer;
    appearance: none; min-width: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.detail-centros-selects select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,0.12); }
.detail-centros-selects select:disabled { opacity: 0.5; cursor: not-allowed; }
.detail-centros-count {
    font-size: 14px; color: var(--text-secondary); margin-bottom: 16px;
}
.no-centros-filtered {
    text-align: center; padding: 32px 16px; color: var(--text-muted);
    font-size: 14px;
}

.location-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 980px; font-size: 11px; font-weight: 600;
}
.location-badge.available { background: #d4edda; color: #155724; }
.location-badge.unavailable { background: #fff3cd; color: #856404; }

.results-grid { display: flex; flex-direction: column; gap: 16px; margin-bottom: 48px; }

.result-card {
    display: flex; gap: 20px; padding: 24px;
    background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: var(--radius); cursor: pointer; transition: var(--transition);
    animation: slideUp 0.5s ease both; position: relative; overflow: hidden;
}
.result-card:hover { border-color: var(--text-muted); box-shadow: var(--shadow); transform: translateY(-2px); }
.result-card.unavailable-card { opacity: 0.6; }
.result-card.unavailable-card:hover { opacity: 0.85; }

.result-card .card-rank {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 50%;
    font-size: 18px; font-weight: 800; flex-shrink: 0; color: white;
}
.result-card:nth-child(1) .card-rank { background: linear-gradient(135deg, #ffd700, #ffaa00); }
.result-card:nth-child(2) .card-rank { background: linear-gradient(135deg, #c0c0c0, #a0a0a0); }
.result-card:nth-child(3) .card-rank { background: linear-gradient(135deg, #cd7f32, #b06820); }
.result-card:nth-child(n+4) .card-rank { background: var(--bg-hover); color: var(--text-secondary); }

.card-body { flex: 1; min-width: 0; }
.card-body h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.01em; }

.card-family {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-secondary); margin-bottom: 10px;
}
.card-family .family-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.card-family .family-icon-svg { width: 16px; height: 16px; }

.card-desc {
    font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.card-location {
    display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
    font-size: 12px; font-weight: 500;
}
.card-location svg { width: 14px; height: 14px; flex-shrink: 0; }

.card-metrics { display: flex; gap: 20px; flex-wrap: wrap; }
.metric { display: flex; flex-direction: column; }
.metric-value { font-size: 15px; font-weight: 700; color: var(--text); }
.metric-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }

.card-match {
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; min-width: 80px; flex-shrink: 0;
}
.match-circle { position: relative; width: 64px; height: 64px; }
.match-circle svg { transform: rotate(-90deg); }
.match-circle circle { fill: none; stroke-width: 5; }
.match-circle .bg { stroke: var(--border); }
.match-circle .fill { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.match-percent { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 16px; font-weight: 800; color: var(--primary); }
.match-label { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 4px; }

.results-footer { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }

/* ============ EXPLORAR ============ */
#explore { flex-direction: column; padding: 40px 24px 80px; }
.explore-container { max-width: 1100px; width: 100%; margin: 0 auto; }
.explore-header { margin-bottom: 36px; }
.explore-header h2 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.explore-header > p { color: var(--text-secondary); font-size: 16px; margin-bottom: 24px; }

.explore-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; }

.search-box {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px; background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: 980px; flex: 1; min-width: 0; transition: var(--transition);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,113,227,0.12); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input { flex: 1; border: none; outline: none; font-size: 15px; font-family: inherit; background: none; color: var(--text); }
.search-box input::placeholder { color: var(--text-muted); }

.explore-location-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.explore-location-filter select {
    padding: 14px 36px 14px 16px; border: 1.5px solid var(--border);
    border-radius: 980px; font-family: inherit; font-size: 14px;
    background: var(--bg-card); color: var(--text); cursor: pointer;
    appearance: none; min-width: 0; flex: 1 1 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.explore-location-filter select:disabled { opacity: 0.5; cursor: not-allowed; }
.explore-location-filter select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0,113,227,0.12); }

.explore-grid { display: flex; flex-direction: column; gap: 24px; }
.familia-section { animation: slideUp 0.4s ease both; }

.familia-header {
    display: flex; align-items: center; gap: 14px; padding: 16px 0;
    cursor: pointer; user-select: none; border-bottom: 1.5px solid var(--border);
    transition: var(--transition);
}
.familia-header:hover { opacity: 0.8; }

.familia-icon {
    width: 48px; height: 48px; background: var(--bg-hover);
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.familia-icon svg { width: 26px; height: 26px; color: var(--text-secondary); }

.familia-info { flex: 1; }
.familia-info h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.familia-info p { font-size: 13px; color: var(--text-secondary); }

.familia-count {
    background: var(--bg-hover); color: var(--text-secondary);
    padding: 4px 12px; border-radius: 980px; font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.familia-toggle { width: 24px; height: 24px; color: var(--text-muted); transition: transform 0.3s ease; flex-shrink: 0; }
.familia-section.open .familia-toggle { transform: rotate(180deg); }

.familia-grados { display: none; padding: 16px 0; }
.familia-section.open .familia-grados {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px;
}

.grado-mini-card {
    padding: 20px; background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: var(--radius); cursor: pointer; transition: var(--transition);
}
.grado-mini-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.grado-mini-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.grado-mini-card p {
    font-size: 13px; color: var(--text-secondary);
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 12px;
}

.mini-metrics { display: flex; gap: 16px; flex-wrap: wrap; }
.mini-metric { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.mini-metric svg { width: 14px; height: 14px; }
.mini-metric.salary { color: var(--primary); }
.mini-metric.empleo { color: var(--success); }
.mini-metric.location-mini { color: var(--text-muted); }

/* ============ DETALLE ============ */
#detail { flex-direction: column; padding: 40px 24px 80px; }
.detail-container { max-width: 820px; width: 100%; margin: 0 auto; }

.detail-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; background: var(--bg-hover); color: var(--text-secondary);
    border: none; border-radius: 980px; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: var(--transition); font-family: inherit; margin-bottom: 28px;
}
.detail-back:hover { background: var(--border); color: var(--text); }

.detail-title-section { margin-bottom: 32px; }

.detail-family-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 980px; font-size: 13px; font-weight: 600; margin-bottom: 12px;
}
.detail-family-badge svg { width: 16px; height: 16px; }

.detail-title-section h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 12px; }
.detail-title-section .detail-desc { font-size: 17px; color: var(--text-secondary); line-height: 1.7; }

.detail-duration {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; color: var(--text-secondary); margin-top: 8px;
}
.detail-duration svg { width: 16px; height: 16px; }

.detail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 16px; margin-bottom: 40px; }

.detail-stat {
    padding: 24px; background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: var(--radius); text-align: center;
}
.detail-stat .ds-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.detail-stat .ds-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.detail-stat .ds-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.detail-stat.salary .ds-value { color: var(--primary); }
.detail-stat.empleo .ds-value { color: var(--success); }
.detail-stat.tendencia .ds-value { font-size: 18px; }

.detail-section { margin-bottom: 32px; }
.detail-section h2 {
    font-size: 20px; font-weight: 700; margin-bottom: 16px;
    letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px;
}
.detail-section h2 .section-icon { width: 24px; height: 24px; color: var(--primary); flex-shrink: 0; }

.detail-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.detail-list li {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; background: var(--bg-hover);
    border-radius: var(--radius-xs); font-size: 14px; line-height: 1.5;
}
.detail-list li::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--primary); margin-top: 8px; flex-shrink: 0;
}
.detail-list.salidas li::before { background: var(--success); }
.detail-list.puntos li::before { background: var(--gradient-1); }

.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-tag { padding: 6px 14px; background: var(--bg-hover); border-radius: 980px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }

.salary-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.salary-range { flex: 1; height: 10px; background: var(--border); border-radius: 5px; position: relative; overflow: hidden; }
.salary-range .range-fill { position: absolute; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2)); }
.salary-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.empleo-visual { margin-top: 12px; }
.empleo-bar-container { height: 14px; background: var(--border); border-radius: 7px; overflow: hidden; }
.empleo-bar-fill { height: 100%; border-radius: 7px; transition: width 1s ease; }
.empleo-detail-text { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--text-secondary); }

/* --- Centros / Dónde estudiarlo --- */
.centros-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.centro-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: var(--bg-hover);
    border-radius: var(--radius-xs); font-size: 14px;
}
.centro-item .centro-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.centro-item .centro-icon.publico { background: #dbeafe; color: #1d4ed8; }
.centro-item .centro-icon.concertado { background: #fef3c7; color: #92400e; }
.centro-item .centro-icon.privado { background: #fce7f3; color: #9d174d; }
.centro-item .centro-icon svg { width: 18px; height: 18px; }

.centro-info { flex: 1; }
.centro-name { font-weight: 600; font-size: 14px; }
.centro-location { font-size: 12px; color: var(--text-secondary); }
.centro-badges { display: flex; gap: 6px; margin-top: 4px; }
.centro-badge {
    font-size: 10px; padding: 2px 8px; border-radius: 980px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
}
.centro-badge.publico { background: #dbeafe; color: #1d4ed8; }
.centro-badge.concertado { background: #fef3c7; color: #92400e; }
.centro-badge.privado { background: #fce7f3; color: #9d174d; }
.centro-badge.bilingue { background: #d1fae5; color: #065f46; }

.no-centros {
    text-align: center; padding: 20px; background: var(--bg-hover);
    border-radius: var(--radius-xs); color: var(--text-muted); font-size: 14px;
}

.detail-cta {
    text-align: center; padding: 32px;
    background: linear-gradient(135deg, var(--primary-light), #f0e8ff);
    border-radius: var(--radius); margin-top: 40px;
}
.detail-cta p { font-size: 15px; color: var(--text-secondary); margin-bottom: 16px; }
.detail-cta .btn-primary { margin-right: 8px; }

/* ============ MODAL ============ */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); z-index: 999;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; animation: fadeIn 0.3s ease;
}
.modal-content {
    background: var(--bg-card); border-radius: var(--radius); padding: 36px;
    max-width: 960px; width: 100%; max-height: 80vh; overflow-y: auto;
    box-shadow: var(--shadow-xl); position: relative;
}
.modal-close {
    position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
    background: var(--bg-hover); border: none; border-radius: 50%;
    font-size: 20px; cursor: pointer; display: flex; align-items: center;
    justify-content: center; color: var(--text-secondary); transition: var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }

.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 20px; margin-top: 24px; }
.compare-col { padding: 20px; background: var(--bg-hover); border-radius: var(--radius); }
.compare-col h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1.5px solid var(--border); }
.compare-row { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.compare-row:last-child { border-bottom: none; }
.compare-row .cr-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.compare-row .cr-value { font-size: 14px; font-weight: 600; }

/* ============ DEMANDA BADGE ============ */
.demanda-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 980px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.demanda-badge.muy-alta { background: #d4edda; color: #155724; }
.demanda-badge.alta { background: #cce5ff; color: #004085; }
.demanda-badge.media-alta { background: #fff3cd; color: #856404; }
.demanda-badge.media { background: #f8f9fa; color: #6c757d; }

/* ============ TENDENCIA BADGES ============ */
.tendencia-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.tendencia-badge svg { width: 16px; height: 16px; }
.tendencia-badge.up { color: var(--success); }
.tendencia-badge.stable { color: var(--warning); }
.tendencia-badge.down { color: var(--danger); }

/* ============ GLOBAL OVERFLOW FIX ============ */
html, body { overflow-x: hidden; max-width: 100vw; }
*, *::before, *::after { box-sizing: border-box; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .lang-selector { top: 10px; right: 10px; padding: 2px; }
    .lang-btn { padding: 4px 10px; font-size: 12px; }

    .hero-stats { gap: 24px; }
    .float-card { display: none; }
    #hero { padding: 30px 16px; }
    #hero h1 { font-size: clamp(28px, 7vw, 42px); }
    .hero-subtitle { font-size: 16px; }
    .btn-large { padding: 14px 24px; font-size: 15px; }
    .btn-ghost { font-size: 14px; padding: 10px 16px; }

    /* Quiz */
    #quiz { padding: 24px 16px; }
    .quiz-container { max-width: 100%; }
    .quiz-question h2 { font-size: 22px; word-break: break-word; }
    .quiz-question .question-subtitle { font-size: 14px; }
    .quiz-options { grid-template-columns: 1fr; }
    .quiz-option { padding: 14px 16px; }
    .quiz-option .opt-text { font-size: 14px; }
    .quiz-nav {
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 24px;
    }
    .quiz-nav .btn-secondary { padding: 10px 16px; font-size: 13px; order: 1; }
    .quiz-nav .btn-ghost {
        order: 3;
        width: 100%;
        justify-content: center;
        padding: 8px 12px;
        font-size: 13px;
    }
    .quiz-nav .btn-primary {
        order: 2;
        margin-left: auto;
        padding: 10px 18px;
        font-size: 14px;
    }

    /* Results */
    #results { padding: 24px 16px 60px; }
    .results-header h2 { font-size: 26px; }
    .result-card { flex-direction: column; padding: 18px; gap: 14px; }
    .result-card .card-rank { width: 36px; height: 36px; font-size: 14px; }
    .card-body h3 { font-size: 16px; }
    .card-desc { font-size: 13px; }
    .card-match { flex-direction: row; gap: 12px; }
    .match-circle { width: 48px; height: 48px; }
    .match-percent { font-size: 13px; }
    .card-metrics { gap: 10px; }
    .metric-value { font-size: 13px; }
    .location-selects { flex-direction: column; }
    .location-selects select { min-width: 100%; }
    .results-footer { flex-direction: column; align-items: center; }
    .results-footer button { width: 100%; justify-content: center; }

    /* Explore */
    #explore { padding: 24px 16px 60px; }
    .explore-header h2 { font-size: 26px; }
    .explore-filters { flex-direction: column; }
    .search-box { min-width: 100%; padding: 12px 16px; }
    .search-box input { font-size: 14px; }
    .explore-location-filter select { width: 100%; min-width: 100%; }
    .explore-location-filter { flex-direction: column; }
    .ccaa-summary { font-size: 14px; padding: 12px 14px; }
    .ccaa-group .centros-grid { padding: 8px; }
    .detail-centros-filter { flex-direction: column; }
    .detail-centros-search { 
        flex: 1 1 100%; 
        min-width: 100%; 
        padding: 10px 14px; 
        gap: 8px; 
    }
    .detail-centros-search input { font-size: 13px; }
    .detail-centros-selects { flex-direction: column; }
    .detail-centros-selects select { width: 100%; }
    .familia-header { gap: 10px; padding: 14px 0; }
    .familia-icon { width: 40px; height: 40px; }
    .familia-info h3 { font-size: 16px; }
    .familia-info p { font-size: 12px; }
    .familia-count { font-size: 12px; padding: 3px 10px; }
    .familia-section.open .familia-grados { grid-template-columns: 1fr; }
    .grado-mini-card { padding: 16px; }
    .grado-mini-card h4 { font-size: 14px; }

    /* Detail */
    #detail { padding: 24px 16px 60px; }
    .detail-title-section h1 { font-size: clamp(22px, 5vw, 30px); }
    .detail-title-section .detail-desc { font-size: 15px; }
    .detail-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .detail-stat { padding: 16px; }
    .detail-stat .ds-value { font-size: 22px; }
    .detail-stat.tendencia .ds-value { font-size: 14px; }
    .detail-section h2 { font-size: 18px; }
    .salary-labels { font-size: 11px; }
    .empleo-detail-text { flex-direction: column; gap: 4px; font-size: 12px; }
    .centro-item { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
    .detail-cta { padding: 24px 16px; }
    .detail-cta .btn-primary,
    .detail-cta .btn-secondary { width: 100%; justify-content: center; margin: 4px 0; }

    /* Compare */
    .compare-grid { grid-template-columns: 1fr; }
    .modal { padding: 12px; }
    .modal-content { padding: 24px 16px; }
}

@media (max-width: 480px) {
    #hero { padding: 24px 12px; }
    .hero-stats { flex-direction: column; gap: 12px; }
    .stat-number { font-size: 26px; }
    .btn-large { padding: 14px 22px; font-size: 15px; width: 100%; justify-content: center; }
    .btn-ghost { width: 100%; justify-content: center; }

    .quiz-question h2 { font-size: 20px; }
    .quiz-nav .btn-secondary { padding: 8px 14px; font-size: 12px; }
    .quiz-nav .btn-primary { padding: 10px 16px; font-size: 13px; }

    .detail-stats { grid-template-columns: 1fr; }
    .result-card .card-rank { width: 32px; height: 32px; font-size: 13px; }
    .card-body h3 { font-size: 15px; }

    .explore-header h2 { font-size: 22px; }
    .results-header h2 { font-size: 22px; }
    .detail-centros-search { padding: 8px 12px; gap: 6px; }
    .detail-centros-search input { font-size: 12px; }
}

@media (max-width: 360px) {
    .lang-selector { top: 6px; right: 6px; }
    .lang-btn { padding: 3px 8px; font-size: 11px; }
    #hero h1 { font-size: 26px; }
    .hero-subtitle { font-size: 14px; }
    .quiz-question h2 { font-size: 18px; }
    .quiz-option { padding: 12px 14px; gap: 10px; }
    .quiz-option .opt-icon { width: 28px; height: 28px; }
    .quiz-option .opt-text { font-size: 13px; }
}

/* ============ SCROLL BAR ============ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ ANIMACIONES DE TARJETAS ============ */
.result-card:nth-child(1) { animation-delay: 0.1s; }
.result-card:nth-child(2) { animation-delay: 0.2s; }
.result-card:nth-child(3) { animation-delay: 0.3s; }
.result-card:nth-child(4) { animation-delay: 0.4s; }
.result-card:nth-child(5) { animation-delay: 0.5s; }
.result-card:nth-child(6) { animation-delay: 0.6s; }
.result-card:nth-child(7) { animation-delay: 0.7s; }
.result-card:nth-child(8) { animation-delay: 0.8s; }
.result-card:nth-child(9) { animation-delay: 0.9s; }
.result-card:nth-child(10) { animation-delay: 1.0s; }
