
/* =================================
   STUDYSOS - DISEÑO PRINCIPAL
================================= */

:root {
    --bg: #f7f9ff;
    --surface: #ffffff;
    --surface-soft: #eff4ff;
    --text: #17233f;
    --muted: #71809c;
    --primary: #3478f6;
    --primary-dark: #205bd0;
    --border: #e6ecf6;
    --shadow: 0 15px 45px rgba(34, 76, 145, 0.08);
    --navbar: rgba(255,255,255,0.82);
}

body.dark-mode {
    --bg: #0c1222;
    --surface: #141e33;
    --surface-soft: #1b2943;
    --text: #edf3ff;
    --muted: #a1aec6;
    --primary: #6c9eff;
    --primary-dark: #4380f0;
    --border: #293650;
    --shadow: 0 15px 45px rgba(0,0,0,0.22);
    --navbar: rgba(12,18,34,0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    transition: background .35s, color .35s;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
}

.container {
    width: min(1160px, 90%);
    margin: auto;
}

/* FONDOS */

.background-glow {
    position: fixed;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    filter: blur(110px);
    opacity: .12;
    pointer-events: none;
    z-index: -1;
}

.glow-one {
    background: #4387ff;
    top: -200px;
    left: -100px;
}

.glow-two {
    background: #7a66ff;
    right: -200px;
    top: 400px;
}

/* NAVBAR */

.navbar {
    width: 100%;
    height: 82px;
    padding: 0 5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--navbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo-icon {
    width: 39px;
    height: 39px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #3478f6, #6d9eff);
    color: white;
}

.logo-dot {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 35px;
}

.nav-links a {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    transition: color .2s;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.theme-toggle,
.menu-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    display: grid;
    place-items: center;
    transition: .25s;
}

.theme-toggle:hover,
.menu-toggle:hover {
    color: var(--primary);
    transform: rotate(12deg);
}

.nav-button,
.primary-button,
.secondary-button,
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 12px;
    font-weight: 700;
    transition: .3s ease;
}

.nav-button {
    padding: 13px 19px;
    color: white;
    background: var(--primary);
    font-size: 13px;
}

.nav-button:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

.menu-toggle {
    display: none;
}

/* HERO */

.hero {
    min-height: 650px;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    align-items: center;
    gap: 55px;
    padding-top: 70px;
    padding-bottom: 85px;
}

.hero-content {
    animation: slide-up .8s ease both;
}

.announcement {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 15px;
    background: var(--surface-soft);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 30px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.announcement-dot,
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #24c78b;
    box-shadow: 0 0 12px #24c78b;
}

.hero h1 {
    font-family: 'Manrope', sans-serif;
    font-size: clamp(46px, 5.3vw, 70px);
    line-height: 1.12;
    letter-spacing: -3.5px;
    margin-top: 27px;
    font-weight: 800;
}

.gradient-text {
    background: linear-gradient(100deg, #3478f6, #6c65f5, #28a6d8);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.hero-description {
    color: var(--muted);
    line-height: 1.9;
    font-size: 16px;
    max-width: 530px;
    margin-top: 25px;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 13px;
    margin-top: 32px;
}

.primary-button {
    border: 0;
    padding: 16px 23px;
    background: linear-gradient(120deg, #3478f6, #5e7ff2);
    color: white;
    box-shadow: 0 10px 25px rgba(52,120,246,.25);
}

.primary-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(52,120,246,.35);
}

.secondary-button {
    padding: 15px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.secondary-button:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-4px);
}

.hero-social-proof {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 42px;
}

.avatar-stack {
    display: flex;
}

.avatar-stack span {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--bg);
    margin-left: -8px;
    display: grid;
    place-items: center;
    background: #dbe8ff;
    color: #2454a4;
    font-size: 12px;
    font-weight: 800;
}

.avatar-stack span:first-child {
    margin-left: 0;
}

.hero-social-proof strong {
    font-size: 13px;
}

.hero-social-proof p {
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px;
}

/* HERO VISUAL */

.hero-visual {
    position: relative;
    animation: float-in 1s .2s ease both;
}

.dashboard-preview {
    position: relative;
    z-index: 2;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 28px;
    box-shadow: var(--shadow);
    transform: rotate(1.5deg);
    transition: transform .4s;
}

.dashboard-preview:hover {
    transform: rotate(0) translateY(-5px);
}

.preview-header,
.progress-info,
.preview-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-label {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1.3px;
    font-weight: 800;
}

.preview-header h3 {
    font-size: 20px;
    margin-top: 8px;
}

.preview-avatar {
    width: 43px;
    height: 43px;
    background: linear-gradient(135deg, #3478f6, #8b83ff);
    color: white;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.progress-card {
    background: var(--surface-soft);
    border-radius: 17px;
    padding: 22px;
    margin-top: 30px;
}

.progress-info span {
    color: var(--muted);
    font-size: 12px;
}

.progress-info h2 {
    font-size: 19px;
    margin-top: 5px;
}

.progress-info > i {
    color: #24b88c;
}

.progress-track {
    height: 9px;
    background: var(--border);
    border-radius: 20px;
    margin-top: 22px;
    overflow: hidden;
}

.progress-fill {
    width: 72%;
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, #3478f6, #64b9f6);
    animation: progress-grow 1.5s ease both;
}

.progress-card > p {
    color: var(--muted);
    font-size: 11px;
    margin-top: 12px;
}

.preview-bottom {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.mini-subject {
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 13px;
}

.mini-icon {
    width: 39px;
    height: 39px;
    border-radius: 12px;
    display: grid;
    place-items: center;
}

.mini-icon.blue {
    color: #3478f6;
    background: #e7efff;
}

.mini-icon.purple {
    color: #8b66ee;
    background: #f0eaff;
}

.mini-subject strong {
    display: block;
    font-size: 12px;
}

.mini-subject span {
    color: var(--muted);
    font-size: 10px;
}

.floating-card {
    position: absolute;
    z-index: 3;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: var(--shadow);
    font-size: 11px;
    font-weight: 700;
    animation: floating 4s ease-in-out infinite;
}

.floating-card i {
    color: var(--primary);
}

.floating-top {
    right: -25px;
    top: -30px;
}

.floating-bottom {
    left: -30px;
    bottom: -25px;
    animation-delay: -2s;
}

/* ESTADÍSTICAS */

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 27px 35px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.stat-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-right: 1px solid var(--border);
}

.stat-item:last-child {
    border: none;
}

.stat-item > i {
    width: 45px;
    height: 45px;
    padding: 12px;
    color: var(--primary);
    background: var(--surface-soft);
    border-radius: 13px;
}

.stat-item strong {
    font-size: 13px;
    display: block;
}

.stat-item span {
    font-size: 11px;
    color: var(--muted);
}

/* ASIGNATURAS */

.subjects-section {
    padding-top: 125px;
    padding-bottom: 110px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 40px;
}

.eyebrow {
    font-size: 10px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1.7px;
}

.section-heading h2,
.ai-content h2 {
    font-family: 'Manrope', sans-serif;
    font-size: clamp(30px, 4vw, 43px);
    line-height: 1.25;
    letter-spacing: -1.8px;
    margin-top: 14px;
}

.section-heading p,
.ai-content > p {
    color: var(--muted);
    line-height: 1.8;
    margin-top: 12px;
    font-size: 14px;
}

.section-tag {
    color: var(--primary);
    font-size: 12px;
    background: var(--surface-soft);
    padding: 10px 15px;
    border-radius: 30px;
    white-space: nowrap;
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.subject-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 27px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: transform .35s, box-shadow .35s, border-color .35s;
}

.subject-card::before {
    content: "";
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--surface-soft);
    right: -65px;
    top: -75px;
    transition: transform .4s;
}

.subject-card:hover {
    transform: translateY(-9px);
    border-color: #9bbcff;
    box-shadow: 0 20px 40px rgba(45,99,183,.12);
}

.subject-card:hover::before {
    transform: scale(1.7);
}

.subject-icon {
    position: relative;
    width: 51px;
    height: 51px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    margin-bottom: 24px;
}

.icon-blue { background: #e7efff; color: #3478f6; }
.icon-purple { background: #f0eaff; color: #9068eb; }
.icon-orange { background: #fff0df; color: #e79a38; }
.icon-green { background: #e1f7ee; color: #28a879; }
.icon-pink { background: #ffe8f1; color: #e16a9a; }
.icon-cyan { background: #e0f7fb; color: #259bb8; }

.subject-level {
    color: var(--primary);
    font-size: 9px;
    letter-spacing: 1.3px;
    font-weight: 800;
}

.subject-card h3 {
    font-size: 21px;
    margin-top: 9px;
    position: relative;
}

.subject-card p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.8;
    min-height: 45px;
    margin-top: 10px;
    position: relative;
}

.subject-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    margin-top: 20px;
}

/* PROFESOR IA */

.ai-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 65px;
    align-items: center;
    padding: 65px;
    border-radius: 30px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
}

.ai-content {
    position: relative;
    z-index: 2;
}

.ai-content > p {
    max-width: 470px;
}

.ai-benefits {
    list-style: none;
    margin: 25px 0 30px;
    display: grid;
    gap: 15px;
}

.ai-benefits li {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 13px;
    color: var(--muted);
}

.ai-benefits i {
    color: #24b88c;
    width: 18px;
}

.ai-visual {
    min-width: 0;
}

.chat-window {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transform: rotate(-2deg);
    transition: transform .4s;
}

.chat-window:hover {
    transform: rotate(0) scale(1.02);
}

.chat-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, #3478f6, #8067f5);
    color: white;
    display: grid;
    place-items: center;
}

.chat-top strong {
    display: block;
    font-size: 13px;
}

.chat-top span {
    font-size: 10px;
    color: var(--muted);
}

.online-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 5px;
}

.chat-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.message {
    max-width: 88%;
    padding: 13px;
    font-size: 12px;
    line-height: 1.7;
    border-radius: 13px;
}

.ai-message {
    background: var(--surface-soft);
    align-self: flex-start;
}

.user-message {
    background: #3478f6;
    color: white;
    align-self: flex-end;
}

.chat-placeholder {
    padding: 12px;
    text-align: center;
    color: var(--muted);
    font-size: 10px;
}

.chat-placeholder i {
    width: 13px;
    vertical-align: middle;
}

.chat-input-preview {
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    color: var(--muted);
    font-size: 11px;
}

.chat-input-preview button {
    border: 0;
    background: var(--primary);
    color: white;
    padding: 10px;
    border-radius: 10px;
    opacity: .6;
}

/* FUNCIONES */

.features-section {
    padding-top: 120px;
    padding-bottom: 120px;
}

.centered {
    text-align: center;
    display: block;
    max-width: 700px;
    margin: 0 auto 45px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 17px;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 25px;
    transition: .35s;
}

.feature-card:hover {
    transform: translateY(-7px);
    box-shadow: var(--shadow);
    border-color: #a8c6ff;
}

.feature-card > i {
    color: var(--primary);
    width: 28px;
    height: 28px;
    margin-bottom: 22px;
}

.feature-card h3 {
    font-size: 16px;
}

.feature-card p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.8;
    margin-top: 10px;
}

/* CTA */

.final-cta {
    text-align: center;
    padding: 65px 25px;
    margin-bottom: 80px;
    border-radius: 28px;
    background: linear-gradient(120deg, #235dd6, #3478f6, #7468ed);
    color: white;
    position: relative;
    overflow: hidden;
}

.final-cta::before,
.final-cta::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    filter: blur(2px);
}

.final-cta::before {
    top: -120px;
    left: -50px;
}

.final-cta::after {
    bottom: -150px;
    right: -30px;
}

.final-cta > div {
    position: relative;
    z-index: 1;
}

.final-cta .eyebrow {
    color: #d5e5ff;
}

.final-cta h2 {
    font-family: 'Manrope', sans-serif;
    font-size: clamp(28px, 4vw, 42px);
    margin-top: 15px;
    letter-spacing: -1px;
}

.final-cta h2 span {
    display: block;
    color: #d9e7ff;
}

.final-cta p {
    color: #e0eaff;
    margin-top: 15px;
    font-size: 14px;
}

.cta-button {
    margin-top: 28px;
    background: white;
    color: #245ed1;
    padding: 15px 23px;
    font-size: 13px;
}

.cta-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

/* FOOTER */

.footer {
    border-top: 1px solid var(--border);
    padding: 35px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer p,
.footer > span {
    color: var(--muted);
    font-size: 11px;
}

/* NOTIFICACIONES */

.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translate(-50%, 30px);
    background: #17233f;
    color: white;
    padding: 15px 22px;
    border-radius: 12px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: .3s;
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ANIMACIONES */

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(35px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float-in {
    from {
        opacity: 0;
        transform: translateX(35px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes progress-grow {
    from { width: 0; }
    to { width: 72%; }
}

/* ENTRADAS AL HACER SCROLL */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity .7s ease, transform .7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* RESPONSIVE */

@media (max-width: 900px) {

    .hero {
        grid-template-columns: 1fr;
        gap: 70px;
    }

    .hero-content {
        max-width: 650px;
    }

    .hero-visual {
        max-width: 550px;
        width: 90%;
        margin: auto;
    }

    .subjects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ai-section {
        grid-template-columns: 1fr;
        padding: 40px;
    }

    .ai-visual {
        max-width: 550px;
        width: 100%;
        margin: auto;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-links {
        gap: 18px;
    }
}

@media (max-width: 650px) {

    .navbar {
        height: 72px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        width: 100%;
        padding: 25px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        gap: 22px;
        box-shadow: var(--shadow);
    }

    .nav-links.active {
        display: flex;
        animation: slide-up .25s ease;
    }

    .nav-button {
        display: none;
    }

    .menu-toggle {
        display: grid;
    }

    .hero {
        padding-top: 60px;
        padding-bottom: 70px;
        min-height: auto;
    }

    .hero h1 {
        font-size: 46px;
        letter-spacing: -2.5px;
    }

    .hero-description {
        font-size: 14px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .floating-top {
        right: -10px;
    }

    .floating-bottom {
        left: -10px;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stat-item {
        justify-content: flex-start;
        border-right: 0;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .subjects-grid {
        grid-template-columns: 1fr;
    }

    .ai-section {
        padding: 25px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }
}

/* RESPETAR PREFERENCIAS DE MOVIMIENTO */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* =================================
   STUDYSOS - CATALOGO DE MATERIAS
================================= */

.catalog-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.catalog-search {
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 0 17px;
    transition: .3s;
}

.catalog-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(52,120,246,.10);
}

.catalog-search i {
    color: var(--primary);
    width: 20px;
}

.catalog-search input {
    width: 100%;
    height: 53px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}

.catalog-search input::placeholder {
    color: var(--muted);
}

.catalog-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 17px;
    margin-top: 23px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.filter-group label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
}

.filter-group select {
    height: 45px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    outline: none;
    cursor: pointer;
    min-width: 0;
}

.filter-group select:focus {
    border-color: var(--primary);
}

.catalog-results {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.catalog-results strong {
    color: var(--primary);
    font-size: 13px;
}

.catalog-results span {
    color: var(--muted);
    font-size: 11px;
}

.reset-button {
    display: flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    color: var(--muted);
    border: none;
    font-size: 11px;
    font-weight: 700;
}

.reset-button:hover {
    color: var(--primary);
}

.reset-button i {
    width: 14px;
}

.subject-card {
    animation: slide-up .5s ease both;
}

.subject-course {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 7px;
    background: var(--surface-soft);
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    margin-top: 14px;
}

.subject-modality {
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-top: 13px;
}

.subject-link {
    border: none;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 55px 20px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 20px;
}

.no-results i {
    color: var(--primary);
    width: 35px;
    height: 35px;
    margin-bottom: 15px;
}

.no-results h3 {
    margin-bottom: 8px;
}

.no-results p {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 650px) {
    .catalog-panel {
        padding: 17px;
    }

    .catalog-filters {
        grid-template-columns: 1fr;
    }

    .catalog-results {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* PÁGINAS DE ASIGNATURAS */

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 7%;
    border-bottom: 1px solid rgba(120, 140, 180, 0.2);
}

.subject-header .logo {
    font-size: 25px;
    font-weight: 800;
    color: #3978ed;
    text-decoration: none;
}

.back-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.subject-main {
    width: min(1100px, 90%);
    margin: 50px auto;
}

.subject-hero {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 35px;
    border-radius: 25px;
    background: linear-gradient(135deg, #e6efff, #f1eaff);
    color: #172b50;
    animation: subjectAppear 0.6s ease;
}

.subject-big-icon {
    font-size: 65px;
}

.subject-eyebrow {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #3978ed;
}

.subject-hero h1 {
    font-size: clamp(28px, 5vw, 44px);
    margin: 5px 0;
}

.subject-hero p:last-child {
    line-height: 1.6;
}

.subject-content {
    margin-top: 45px;
}

.subject-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.subject-toolbar h2 {
    margin-right: auto;
}

.subject-toolbar select {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: white;
    color: #172b50;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
}

.topic-card {
    padding: 25px;
    border: 1px solid rgba(120, 140, 180, 0.25);
    border-radius: 18px;
    background: var(--card-bg, white);
    animation: subjectAppear 0.5s ease both;
    transition: transform 0.25s, box-shadow 0.25s;
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(40, 90, 160, 0.12);
}

.topic-number {
    color: #3978ed;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
}

.topic-card h3 {
    margin: 15px 0 10px;
}

.topic-card p {
    line-height: 1.6;
    opacity: 0.8;
}

.topic-status {
    display: inline-block;
    margin-top: 12px;
    color: #3978ed;
    font-size: 12px;
    font-weight: 700;
}

.ai-study-card {
    margin-top: 40px;
    padding: 30px;
    border-radius: 20px;
    background: linear-gradient(135deg, #e7efff, #eee8ff);
    color: #172b50;
}

@keyframes subjectAppear {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .subject-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 25px;
    }

    .subject-header {
        padding: 18px 5%;
    }

    .subject-main {
        margin: 25px auto;
    }
}

/* =================================
   STUDYSOS - CHAT DEL TUTOR IA
================================= */

.tutor-page {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

.tutor-main {
    width: min(950px, 92%);
    margin: 45px auto;
}

/* CABECERA DE LA ASIGNATURA */

.tutor-heading {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 25px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.tutor-heading .subject-big-icon {
    width: 65px;
    height: 65px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    color: var(--primary);
    border-radius: 18px;
    flex-shrink: 0;
}

.tutor-heading h1 {
    font-size: clamp(23px, 4vw, 32px);
    margin-bottom: 7px;
}

.tutor-heading p {
    color: var(--muted);
    line-height: 1.6;
}

.tutor-heading select {
    margin-top: 13px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
}

/* VENTANA DEL CHAT */

.tutor-chat {
    margin-top: 25px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-welcome {
    padding: 35px 25px 20px;
    text-align: center;
}

.chat-welcome h2 {
    font-size: 23px;
    margin-bottom: 10px;
}

.chat-welcome p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

/* BOTONES DE FUNCIONES */

.tutor-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 20px 25px;
}

.tutor-actions button {
    padding: 12px 16px;
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 11px;
    font-size: 13px;
    font-weight: 600;
    transition: .25s;
}

.tutor-actions button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* MENSAJES */

.chat-messages {
    min-height: 180px;
    max-height: 450px;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-top: 1px solid var(--border);
}

.chat-message {
    max-width: 80%;
    padding: 15px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.chat-message p {
    white-space: pre-wrap;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--surface-soft);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

/* CUADRO PARA ESCRIBIR */

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.chat-form textarea {
    flex: 1;
    min-width: 0;
    min-height: 55px;
    max-height: 150px;
    resize: vertical;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

.chat-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52,120,246,.10);
}

.chat-form textarea::placeholder {
    color: var(--muted);
}

.chat-form button {
    padding: 16px 22px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    transition: .25s;
}

.chat-form button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.chat-disclaimer {
    padding: 0 20px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 11px;
}

/* DISEÑO PARA MÓVILES */

@media (max-width: 600px) {

    .tutor-main {
        margin: 25px auto;
    }

    .tutor-heading {
        align-items: flex-start;
        padding: 20px;
        gap: 15px;
    }

    .tutor-heading .subject-big-icon {
        width: 48px;
        height: 48px;
    }

    .chat-welcome {
        padding: 25px 15px 15px;
    }

    .tutor-actions {
        padding: 12px;
    }

    .tutor-actions button {
        flex: 1 1 45%;
        font-size: 12px;
        padding: 12px 8px;
    }

    .chat-messages {
        padding: 15px;
    }

    .chat-message {
        max-width: 92%;
    }

    .chat-form {
        padding: 12px;
        gap: 8px;
    }

    .chat-form button {
        padding: 15px;
    }
}
.subject-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.subject-header .theme-toggle {
    flex-shrink: 0;
}

body.dark-mode .subject-header {
    background: var(--navbar);
    border-color: var(--border);
}

body.dark-mode .subject-header .logo {
    color: var(--primary);
}

body.dark-mode .tutor-heading {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

@media (max-width: 500px) {
    .subject-header-actions {
        gap: 8px;
    }

    .back-link {
        font-size: 12px;
    }
}