/* ==============================
   VARIÁVEIS DE TEMA (BIOMEDICINA PREMIUM)
   ============================== */
:root {
    --bg-dark: #090B10;
    --bg-surface: rgba(20, 25, 38, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #F3F4F6;
    --text-muted: #9CA3AF;
    
    /* Paleta Biomédica/Tecnológica */
    --primary: #00F0FF;     /* Ciano Neon (DNA) */
    --primary-glow: rgba(0, 240, 255, 0.3);
    --secondary: #6B21A8;   /* Roxo profundo */
    --accent-green: #10B981; /* Sucesso / Correto */
    --accent-red: #EF4444;   /* Erro / Alerta */
    --accent-yellow: #F59E0B; /* XP / Conquistas */
    --accent-orange: #F97316; /* Streaks / Calor */

    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;
}

/* ==============================
   RESET & GLOBAL
   ============================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Controlado via app container */
    position: relative;
}

/* Background Animated Blobs */
#background-blobs {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: drift 20s infinite alternate ease-in-out;
}
.blob-1 {
    width: 400px; height: 400px;
    background: var(--primary);
    top: -10%; left: -10%;
}
.blob-2 {
    width: 500px; height: 500px;
    background: var(--secondary);
    bottom: -20%; right: -10%;
    animation-delay: -5s;
}
.blob-3 {
    width: 300px; height: 300px;
    background: #0D9488; /* Teal */
    top: 40%; left: 60%;
    animation-delay: -10s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* ==============================
   MAIN CONTAINER (MOBILE-APP FEEL)
   ============================== */
#app-container {
    width: 100%;
    max-width: 480px; /* Mobile first / App constraints */
    height: 100vh;
    max-height: 900px;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@media (min-width: 500px) {
    #app-container {
        height: 90vh;
        border-radius: var(--radius-lg);
    }
}

/* Views Management */
.view {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out forwards;
}
.view.active-view {
    display: flex;
}

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

/* Utility Scroll Area */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: none; /* Firefox */
}
.content-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* ==============================
   TYPOGRAPHY & UTILS
   ============================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

.text-highlight { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-orange { color: var(--accent-orange); }
.text-yellow { color: var(--accent-yellow); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.p-4 { padding: 1.5rem; }

.flex-col { display: flex; flex-direction: column; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.pull-right { float: right; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}
.btn-block { width: 100%; }
.btn-primary {
    background: linear-gradient(135deg, #00F0FF 0%, #0080FF 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 0 15px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px var(--primary-glow);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-main);
}
.btn-outline:hover {
    background: rgba(255,255,255,0.05);
}
.btn-outline.border-red { border-color: var(--accent-red); }
.btn-outline.border-red:hover { background: rgba(239, 68, 68, 0.1); }
.btn-outline.border-green { border-color: var(--accent-green); }
.btn-outline.border-green:hover { background: rgba(16, 185, 129, 0.1); }

.btn-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    transition: 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.2); }

/* Glass Panel */
.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

/* ==============================
   VIEWS SPECIFIC CSS
   ============================== */

/* LOGIN */
.login-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}
.logo-box { text-align: center; margin-bottom: 3rem; }
.logo-box h1 { font-size: 2.5rem; margin-top: 1rem; }
.floating-icon {
    font-size: 4rem;
    color: var(--primary);
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}
.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-group input {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem 1rem 1rem 3rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}
.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0,0,0,0.5);
}
.form-footer { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; color: var(--text-muted); }

/* DASHBOARD */
.app-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.user-info { display: flex; align-items: center; gap: 1rem; }
.avatar {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--secondary), var(--primary));
    display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem;
}
.greeting h2 { font-size: 1.2rem; }
.badge {
    background: rgba(0, 240, 255, 0.2);
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
}
.gamification-stats { display: flex; gap: 0.5rem; }
.stat-pill {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex; align-items: center; gap: 0.4rem;
    transition: all 0.3s;
}

@keyframes popPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background-color: rgba(245, 158, 11, 0.4); border-color: rgba(245, 158, 11, 0.8); box-shadow: 0 0 15px rgba(245, 158, 11, 0.5); }
    100% { transform: scale(1); }
}

.xp-pop {
    animation: popPulse 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}


.section-title h3 { font-size: 1.2rem; margin-bottom: 1rem; }

.modules-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.module-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.module-card:hover {
    background: rgba(255,255,255,0.06);
    transform: translateX(5px);
}
.card-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; color: white;
}
.bg-blue { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.bg-purple { background: linear-gradient(135deg, #A855F7, #6B21A8); }
.bg-orange { background: linear-gradient(135deg, #F97316, #C2410C); }
.bg-green { background: linear-gradient(135deg, #10B981, #047857); }

.card-content { flex: 1; }
.card-content h4 { font-size: 1rem; font-weight: 600; }
.card-content p { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }
.arrow-icon { color: var(--text-muted); }

.progress-section { padding: 1.5rem; }
.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    margin: 1rem 0;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    border-radius: 5px;
    transition: width 0.5s ease-out;
}
.progress-text { font-size: 0.85rem; color: var(--text-muted); }

/* SUB-HEADER (for internal views) */
.sub-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.sub-header h2 { font-size: 1.2rem; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; flex: 1; }

/* MODULE CONTEXTS */
.video-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: url('https://images.unsplash.com/photo-1579154204601-01588f351e67?auto=format&fit=crop&w=600&q=80') center/cover;
    position: relative;
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    overflow: hidden;
}
.video-placeholder::before {
    content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.5);
}
.video-placeholder > * { z-index: 1; }
.main-play-icon { font-size: 4rem; color: white; cursor: pointer; transition: 0.2s; }
.main-play-icon:hover { color: var(--primary); transform: scale(1.1); }
.video-placeholder p { margin-top: 1rem; font-weight: 500; }

/* AUDIO MODULE */
.audio-disc {
    width: 150px; height: 150px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #1f2937, #374151, #1f2937);
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 4px solid var(--primary);
    animation: spin 5s linear infinite paused;
    font-size: 3rem; color: var(--primary);
}
.audio-controls { width: 100%; }
.audio-bar-bg {
    width: 100%; height: 6px; background: rgba(255,255,255,0.1);
    border-radius: 3px; position: relative; cursor: pointer;
}
.audio-bar-fill {
    height: 100%; background: var(--primary); border-radius: 3px;
    position: absolute; left:0; top:0;
}
.audio-handle {
    width: 16px; height: 16px; background: #fff; border-radius: 50%;
    position: absolute; top: -5px; transform: translateX(-50%);
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
.time-texts { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem;}
.control-buttons { display: flex; justify-content: center; align-items: center; gap: 1.5rem; margin-top: 1.5rem;}
.play-btn { width: 60px; height: 60px; font-size: 1.5rem; background: var(--primary); color: #000; }
.play-btn:hover { background: var(--primary-glow); color: #fff;}

/* QUIZ */
.quiz-container { padding: 1.5rem; }
.quiz-question { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.5rem; }
.quiz-options { display: flex; flex-direction: column; gap: 0.8rem; }
.quiz-option {
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}
.quiz-option:hover { background: rgba(255,255,255,0.08); border-color: var(--primary); }
.quiz-option.correct { background: rgba(16, 185, 129, 0.2); border-color: var(--accent-green); }
.quiz-option.wrong { background: rgba(239, 68, 68, 0.2); border-color: var(--accent-red); }

/* FLASHCARDS */
.scene { width: 100%; max-width: 300px; height: 400px; perspective: 1000px; }
.card {
    width: 100%; height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}
.card.is-flipped { transform: rotateY(180deg); }
.card__face {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 2rem; text-align: center;
    border: 1px solid var(--glass-border);
}
.card__face--back { transform: rotateY(180deg); background: rgba(0, 240, 255, 0.05); border-color: var(--primary); }
.card__face .hint { position: absolute; top: 1rem; font-size: 0.8rem; color: var(--text-muted); }
.card h3 { font-size: 1.2rem; font-weight: 500; line-height: 1.5; }

/* NOTIFICATIONS (Gamification FX) */
#notification-area {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 0.5rem;
    z-index: 100;
    pointer-events: none;
}
.notif {
    background: rgba(16, 185, 129, 0.9);
    backdrop-filter: blur(5px);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    animation: slideUpFade 3s forwards;
    white-space: nowrap;
}
@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(20px); }
    10% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* ==============================
   VIEW: REGISTER
   ============================== */

.register-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.register-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.logo-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.register-body {
    flex: 1;
    padding: 1.8rem 2rem;
    overflow-y: auto;
    scrollbar-width: none;
}
.register-body::-webkit-scrollbar { display: none; }

.register-title {
    font-size: 1.6rem;
    margin-bottom: 0.4rem;
}

/* Campos com botão de toggle dentro */
.input-group {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    transition: color 0.2s;
    line-height: 1;
}
.toggle-password:hover { color: var(--primary); }

/* Deslocamento para não sobrepor o ícone de toggle */
.input-group:has(.toggle-password) input {
    padding-right: 3rem;
}

/* Erros inline por campo */
.field-error {
    display: block;
    font-size: 0.78rem;
    color: var(--accent-red);
    margin-top: -1rem;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    min-height: 1rem;
    transition: all 0.2s ease;
}

/* Estado de erro no input */
.input-group.has-error input {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.05);
}

/* Estado de sucesso no input */
.input-group.has-success input {
    border-color: var(--accent-green);
}

/* Banner de erro da API */
.form-error-banner {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.2rem;
    margin-bottom: 1.4rem;
    font-size: 0.9rem;
    color: #FCA5A5;
    animation: fadeIn 0.3s ease-out;
}
.form-error-banner i { font-size: 1rem; flex-shrink: 0; }

/* Indicador de força da senha */
.password-strength {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: -0.8rem 0 1.4rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.password-strength.visible { opacity: 1; }

.strength-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}
.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.4s ease, background 0.4s ease;
}
.strength-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
    transition: color 0.3s;
}

/* Botão com estado de loading */
.btn-loading { display: none; }
#register-btn.loading .btn-text  { display: none; }
#register-btn.loading .btn-loading { display: inline-flex; align-items: center; gap: 0.5rem; }
#register-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

