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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #2563eb;
    --secondary: #1e40af;
    --accent: #3b82f6;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray: #64748b;
    --border: #e2e8f0;
    
    /* Colores para las características */
    --color-1: #CEDEFF;
    --color-2: #D0CEFF;
    --color-3: #FFD9FC;
    --color-4: #FFEFBE;
    --color-5: #B8E0E3;
    --color-6: #F1F6FF;
}

body {
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.75;
    overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

html {
    scroll-behavior: smooth;
}

*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 40px;
}

@media (max-width: 768px) {
    .container {
        padding: 0 24px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 20px;
    }
}

/* Header */
.site-header {
    background: rgba(255, 255, 255, 0.92);
    color: var(--dark);
    border-bottom: 1px solid var(--border);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.3s ease, background 0.3s ease;
    backdrop-filter: blur(12px);
}

.site-header.header-scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.nav-link {
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
    padding: 8px 14px;
    border-radius: 999px;
}

.nav-link:hover {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

.theme-toggle-public {
    min-width: 42px;
}

.theme-toggle-label {
    display: none;
}

body.menu-open {
    overflow: hidden;
}

.nav-backdrop {
    position: fixed;
    inset: 72px 0 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 998;
}

@media (max-width: 1023px) {
    #nav-panel {
        position: fixed;
        top: 74px;
        right: 10px;
        width: min(92vw, 360px);
        max-height: calc(100dvh - 88px);
        overflow-y: auto;
        border: 1px solid #dbe3f0 !important;
        border-radius: 18px;
        padding: 14px 14px 16px;
        box-shadow: 0 26px 44px rgba(15, 23, 42, 0.24);
        z-index: 999;
        backdrop-filter: blur(8px);
    }

    #nav-panel nav {
        gap: 8px;
    }

    #nav-panel .nav-link {
        display: block;
        border-radius: 12px;
        padding: 11px 12px;
    }

    .nav-actions {
        margin-top: 6px;
        border-top: 1px solid #e2e8f0;
        padding-top: 12px;
    }

    .nav-actions > a,
    .nav-actions > button,
    .nav-actions > div {
        width: 100%;
        justify-content: center;
    }

    #theme-toggle-public {
        gap: 8px;
        justify-content: center;
    }

    .theme-toggle-label {
        display: inline;
    }
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 172px 0 96px;
    text-align: center;
    position: relative;
    margin-top: 80px;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 45%),
        radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.12), transparent 40%);
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    animation: heroFade 0.8s ease-out both;
}

.hero h1 {
    font-size: clamp(2.5rem, 3.6vw, 3.6rem);
    margin-bottom: 18px;
    font-weight: 700;
}

.hero p {
    font-size: clamp(1.05rem, 1.7vw, 1.45rem);
    margin-bottom: 28px;
    opacity: 0.92;
}

.btn {
    display: inline-block;
    background-color: white;
    color: var(--primary);
    padding: 15px 34px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.25s ease, box-shadow 0.25s ease, color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
    border: 2px solid transparent;
    font-size: 1.05rem;
    box-shadow: 0 8px 22px rgba(0,0,0,0.14);
    cursor: pointer;
}

.btn:active {
    transform: translateY(-1px);
}

.btn:hover {
    background-color: transparent;
    border-color: white;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.btn-secondary {
    background-color: transparent;
    border-color: white;
    color: white;
}

.btn-secondary:hover {
    background-color: white;
    color: var(--primary);
}

/* Secciones */
section {
    padding: 104px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 58px;
    color: var(--secondary);
}

.section-title h2 {
    font-size: clamp(2.1rem, 3vw, 2.8rem);
    font-weight: 700;
    display: inline-block;
}

/* Qué es Navi */
.about-content {
    display: flex;
    align-items: center;
    gap: 52px;
}

.about-text {
    flex: 1;
}

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.85;
}

.about-list {
    margin: 25px 0;
}

.about-list li {
    margin-bottom: 15px;
    line-height: 1.8;
    font-size: 1.06rem;
    position: relative;
    padding-left: 30px;
    color: #334155;
}

.about-list li:before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
    font-size: 1.5rem;
}

.about-image {
    flex: 1;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    height: 440px;
    background-size: cover;
    background-position: center;
    background-image: url("/static/images/portada.jpg");
}

/* Características */
.features {
    background-color: #f1f5f9;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
}

@media (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.15);
}

.feature-icon {
    font-size: 2.7rem;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
}

.feature-card h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    position: relative;
    z-index: 2;
}

.feature-card p {
    position: relative;
    z-index: 2;
}

/* Colores específicos para cada característica */
.feature-card:nth-child(1) {
    background-color: var(--color-1);
}
.feature-card:nth-child(1) .feature-icon {
    color: #3b4fce;
}
.feature-card:nth-child(1) h3 {
    color: #2d3b9e;
}

.feature-card:nth-child(2) {
    background-color: var(--color-2);
}
.feature-card:nth-child(2) .feature-icon {
    color: #5a56d9;
}
.feature-card:nth-child(2) h3 {
    color: #4541b3;
}

.feature-card:nth-child(3) {
    background-color: var(--color-3);
}
.feature-card:nth-child(3) .feature-icon {
    color: #d94cb3;
}
.feature-card:nth-child(3) h3 {
    color: #b33a94;
}

.feature-card:nth-child(4) {
    background-color: var(--color-4);
}
.feature-card:nth-child(4) .feature-icon {
    color: #d9a734;
}
.feature-card:nth-child(4) h3 {
    color: #b3892a;
}

.feature-card:nth-child(5) {
    background-color: var(--color-5);
}
.feature-card:nth-child(5) .feature-icon {
    color: #2a9d8f;
}
.feature-card:nth-child(5) h3 {
    color: #1f756b;
}

.feature-card:nth-child(6) {
    background-color: var(--color-6);
}
.feature-card:nth-child(6) .feature-icon {
    color: #3b82f6;
}
.feature-card:nth-child(6) h3 {
    color: #2563eb;
}

/* Galería */
.gallery {
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.gallery-item {
    border-radius: 12px;
    overflow: hidden;
    height: 250px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

/* Objetivos */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
}

.objectives-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.objectives-table th, .objectives-table td {
    padding: 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

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

.objectives-table th {
    background-color: var(--primary);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
}

.objectives-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.objectives-table tr {
    transition: background-color 0.2s ease;
}

.objectives-table tr:hover {
    background-color: #f1f5f9;
}

/* CTA */
.cta {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-align: center;
    padding: 92px 0;
}

.cta h2 {
    font-size: clamp(2.2rem, 3vw, 2.7rem);
    margin-bottom: 20px;
    font-weight: 700;
}

.cta p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 30px;
    opacity: 0.9;
}

.cta .btn {
    background-color: white;
    color: var(--primary);
}

.cta .btn:hover {
    background-color: transparent;
    color: white;
    border-color: white;
    transform: translateY(-4px);
}

@keyframes heroFade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
footer {
    background-color: var(--dark);
    color: white;
    padding: 60px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

/* LOGO DEL FOOTER CORREGIDO */
.footer-logo img {
    height: 40px;  /* Tamaño consistente con el header */
    width: auto;
}

.footer-links h3, .footer-contact h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.25s ease, transform 0.25s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: white;
    transform: translateX(4px);
}

.footer-contact p {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 50%;
    color: white;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.social-icons a:hover {
    background-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
}

.copyright {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.9rem;
    color: #cbd5e1;
}

/* Estilos para usuario logueado */
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-welcome {
    color: var(--dark);
    font-weight: 500;
}

.logout-btn {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.logout-btn:hover {
    background-color: #ef4444;
    color: white;
}

.btn-login-nav {
    background-color: var(--primary);
    color: white !important;
    padding: 8px 20px !important;
    border-radius: 20px;
}

.btn-login-nav:hover {
    background-color: var(--secondary);
    color: white !important;
}

.btn-signup-nav {
    background-color: transparent;
    color: var(--primary) !important;
    border: 2px solid var(--primary);
    padding: 8px 20px !important;
    border-radius: 20px;
}

.btn-signup-nav:hover {
    background-color: var(--primary);
    color: white !important;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 140px 0 80px;
        margin-top: 72px;
    }

    .hero h1 {
        font-size: 2.2rem;
    }
    
    .about-content {
        flex-direction: column;
        gap: 32px;
    }

    .about-image {
        height: 320px;
    }

    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .hero-buttons .btn {
        margin: 5px 0;
        width: 100%;
        max-width: 300px;
    }

    .btn-secondary {
        margin-left: 0;
    }

    .objectives-table th, .objectives-table td {
        padding: 14px;
        font-size: 0.95rem;
    }

    .section-title h2 {
        font-size: 1.9rem;
    }

    section {
        padding: 80px 0;
    }

    .features-grid {
        gap: 24px;
    }

    .feature-card {
        padding: 24px;
    }
}

/* ==========================
   MODO NOCTURNO - PÚBLICO
   ========================== */
body.theme-dark {
    background-color: #0b1220;
    color: #e2e8f0;
}

body.theme-dark .site-header,
body.theme-dark .site-header.header-scrolled {
    background: rgba(15, 23, 42, 0.9);
    border-bottom-color: #243247;
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.35);
}

body.theme-dark .hero {
    background: linear-gradient(135deg, #1e1b4b, #1e3a8a 55%, #1d4ed8);
}

body.theme-dark .features,
body.theme-dark .gallery,
body.theme-dark #conoce-a-navi,
body.theme-dark #objetivos {
    background-color: #0f172a;
}

body.theme-dark .section-title,
body.theme-dark .section-title h2,
body.theme-dark .about-subtitle,
body.theme-dark .about-text p,
body.theme-dark .about-list li,
body.theme-dark .footer-links h3,
body.theme-dark .footer-contact h3,
body.theme-dark .research-content p,
body.theme-dark .stat-desc,
body.theme-dark .footer-contact p {
    color: #cbd5e1;
}

body.theme-dark .section-title h2::after {
    background: linear-gradient(90deg, #818cf8, #60a5fa);
}

body.theme-dark .about-image,
body.theme-dark .gallery-item,
body.theme-dark .table-wrap,
body.theme-dark .objectives-table,
body.theme-dark .feature-card {
    border-color: #243247;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.4);
}

body.theme-dark .objectives-table th,
body.theme-dark .objectives-table td {
    border-bottom-color: #243247;
}

body.theme-dark .objectives-table tr:nth-child(even) {
    background-color: #0b1220;
}

body.theme-dark .objectives-table tr,
body.theme-dark .objectives-table td {
    background-color: #111827;
    color: #e2e8f0;
}

body.theme-dark .objectives-table tr:hover {
    background-color: #1e293b;
}

body.theme-dark .feature-card {
    color: #0f172a;
}

body.theme-dark .nav-link {
    color: #cbd5e1;
}

body.theme-dark .nav-link:hover {
    color: #a5b4fc;
    background-color: rgba(129, 140, 248, 0.18);
}

body.theme-dark .theme-toggle-public {
    border-color: #334155 !important;
    color: #cbd5e1 !important;
    background: #111827;
}

body.theme-dark .theme-toggle-public:hover {
    border-color: #475569 !important;
    color: #e2e8f0 !important;
    background: #1e293b;
}

body.theme-dark #nav-toggle,
body.theme-dark #nav-panel {
    border-color: #334155 !important;
}

body.theme-dark #nav-toggle {
    color: #cbd5e1 !important;
    background: #111827;
}

body.theme-dark #nav-toggle:hover {
    background: #1e293b !important;
}

body.theme-dark #nav-panel {
    background: rgba(15, 23, 42, 0.98) !important;
}

body.theme-dark .nav-backdrop {
    background: rgba(2, 6, 23, 0.6);
}

body.theme-dark .nav-actions {
    border-top-color: #2c3a50;
}

body.theme-dark footer {
    background-color: #020617;
}

body.theme-dark .footer-links a,
body.theme-dark .copyright {
    color: #94a3b8;
}

body.theme-dark .footer-links a:hover,
body.theme-dark .social-icons a:hover {
    color: #ffffff;
}