/* This file contains the styles for the application. It defines the layout, colors, typography, and responsive design for the SPA. */

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

:root {
    --primary-color: #228EE5;
    --secondary-color: #4E40E6;
    --accent-color: #2753E3;
    --danger-color: #f56565;
    --text-color: #2d3748;
    --bg-light: #f7fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #45A2E6 0%, #ADBCE6 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.5rem 0;
    opacity: 1;
    transition: opacity 400ms ease-in-out;
}

header.hidden {
    opacity: 0;
    pointer-events: none;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.subheader {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1rem 0 0 0;
    flex-wrap: wrap;
    text-align: center;

    @media (width <=768px) {
        display: none;
    }
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* El SVG del compás*/
#logo-compass {
    width: 30px;
    height: 30px;

    @media (width <=768px) {
        display: none;
    }
}

/* El SVG del caret-down*/
.logo svg:nth-of-type(2) {
    @media (width > 768px) {
        display: none;
    }
}

/* Botón del logo */
.logo-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;

    @media (width > 768px) {
        pointer-events: none;
    }
}

.logo-button:hover {
    /* background-color: rgba(0, 0, 0, 0.05); */
}

/* Animación del caret */
.logo-button .caret {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

/* Cuando está abierto, rotar el caret */
.logo-button[aria-expanded="true"] .caret {
    transform: rotate(180deg);
}

/* Menú desplegable */
.logo-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 200px;
    z-index: 100;

    @media (width >768px) {
        display: none;
    }

    /* Animación de apertura/cierre */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.2s;
}

/* Estado abierto */
.logo-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Items del dropdown */
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.15s;
}

.dropdown-item:hover {
    background-color: var(--bg-light);
    border-radius: 0.5rem;
}

.dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* Divisor */
.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0.25rem 0;
}

.nav-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;

    @media (width <=768px) {
        display: none;
    }

}

.nav-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    color: var(--text-color);
    background: var(--bg-light);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
}

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

.language {
    color: var(--primary-color);
    background: var(--bg-light);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;

}

/* Main Content */
main {
    flex: 1;
    padding: 2rem 0;
}

.page {
    display: none;
    animation: fadeIn 0.5s;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--bg-white);
    border-radius: 1rem;
    padding: 2rem;
    margin: 1rem 0;
    box-shadow: var(--shadow-lg);
}

h1,
h2,
h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.2rem;
}

p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* Welcome Section */
.welcome-hero {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 1rem;
    margin-bottom: 2rem;
    margin-top: 1.5rem;
}

.welcome-hero h1 {
    color: white;
}

.welcome-hero p {
    @media (width > 768px) {
        display: none;
    }
}

#screening-steps {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    display: flex;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scroll-padding: 0;
    width: 100%;

    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#screening-steps::-webkit-scrollbar {
    display: none;
}

#screening-steps>.info-card {
    /* scroll-margin: 15px; */
    flex: 0 0 100%;
    scroll-snap-align: end;
    align-items: center;
    justify-content: center;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    transition: transform 0.3s;
    cursor: pointer;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Info Sections */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.info-card {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--accent-color);
    margin-bottom: 0.5rem;
}

/* Interactive Elements */
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

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

/* Quiz Section */
.quiz-container {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 1rem;
    margin-top: 2rem;
}

.quiz-question {
    margin-bottom: 2rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-option {
    padding: 1rem;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.quiz-option:hover {
    border-color: var(--secondary-color);
    transform: translateX(5px);
}

.quiz-option.selected {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Progress Bar */
.progress-container {
    background: var(--bg-light);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-bar {
    height: 1rem;
    background: linear-gradient(90deg, var(--accent-color), var(--secondary-color));
    transition: width 0.5s;
}

.step-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: -5rem 0 0 0;
    z-index: 10;
}

/* Step Indicators */
.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.step-dot:hover {
    background: var(--secondary-color);
    transform: scale(1.2);
}

.step-dot.active {
    background: var(--primary-color);
    /* border: 2px solid var(--accent-color); */
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(44, 82, 130, 0.3);
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: #718096;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Virtual Assistant */
.assistant-bubble {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s;
    z-index: 1000;
}

.assistant-bubble.hidden {
    opacity: 0;
    pointer-events: none;
}

.assistant-bubble:hover {
    transform: scale(1.1);
}

.assistant-chat {
    position: fixed;
    bottom: 100px;
    right: 2rem;
    width: 350px;
    max-width: 90vw;
    background: white;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 999;
}

.assistant-chat.open {
    display: block;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    border-radius: 1rem 1rem 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-body {
    padding: 1rem;
    height: 300px;
    overflow-y: auto;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .nav-buttons {
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Footer */
footer {
    background: var(--bg-white);
    padding: 1rem 0;
    text-align: center;
    color: #718096;
    margin-top: auto;

    @media (width <=768px) {
        position: sticky;
        bottom: 0;
        z-index: 100;
        opacity: 1;
        transition: opacity 400ms ease-in-out;
    }
}

footer.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Animations */
.fade-in {
    animation: fadeIn 1s;
}

.slide-in {
    animation: slideIn 0.5s;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Solo aplicar hide/show en móvil */
@media (min-width: 769px) {

    header.hidden,
    footer.hidden {
        opacity: 1;
        pointer-events: auto;
    }
}