/* Reset basico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
header {
    background: rgba(0, 0, 0, 0.6);
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid rgba(147, 51, 234, 0.4);
}

header h1 {
    font-size: 2rem;
    color: #fff;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.7);
}

.header-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

#user-score-display {
    font-size: 1.2rem;
    color: #ffd700;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.breadcrumb {
    font-size: 1.3rem;
    color: #d1d5db;
}

.breadcrumb span {
    color: #fff;
    font-weight: bold;
}

/* Main container (2 colunas) */
main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar de navegacao (25%) - SEMPRE VISIVEL */
#sidebar {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    overflow: hidden;
    border-right: 3px solid rgba(147, 51, 234, 0.4);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#sidebar h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #9333ea;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.subject-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 10px;
    margin-bottom: 8px;
    font-size: 1.7rem;
    background: rgba(59, 130, 246, 0.2);
    color: #fff;
    border: 3px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.subject-btn:hover,
.subject-btn:focus {
    background: rgba(59, 130, 246, 0.5);
    border-color: #3b82f6;
    transform: scale(1.05);
    outline: none;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

.subject-btn.active {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    border-color: #c084fc;
    box-shadow: 0 0 30px rgba(147, 51, 234, 0.8);
}

.subject-icon {
    font-size: 2rem;
}

/* Area principal (restanto da tela) */
#content-area {
    flex: 1;
    padding: 30px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* HUB DE ATIVIDADES (4 cards grandes) */
.activity-hub {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
    place-items: center;
}

.activity-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(147, 51, 234, 0.3) 100%);
    padding: 20px;
    border-radius: 15px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    width: 100%;
    max-width: 300px;
}

.activity-card:hover,
.activity-card:focus {
    border-color: #9333ea;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(147, 51, 234, 0.7);
    outline: none;
}

.activity-card .icon {
    font-size: 3rem;
    margin-bottom: 10px;
    display: block;
}

.activity-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #fff;
}

.activity-card p {
    font-size: 1rem;
    color: #d1d5db;
    line-height: 1.4;
}

/* Tela de conteudo */
.content-screen {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 50px;
    border-radius: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Tela de conteudo sem rolagem para topicos */
.content-screen.topics-container {
    overflow-y: visible;
    max-height: none;
}

.content-screen h2 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: #3b82f6;
}

/* Titulo menor para topicos */
.content-screen.topics-container h2 {
    font-size: 1.98rem;
    margin-bottom: 20px;
}

.content-screen p {
    font-size: 1.6rem;
    line-height: 1.3;
    margin-bottom: 4px;
}

/* Lista de topicos (estilo dos botoes das materias) */
.topics-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 30px;
    max-width: 600px;
}

.topic-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 8px;
    font-size: 1.1rem;
    background: rgba(59, 130, 246, 0.2);
    color: #333;
    border: 3px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.topic-item:hover,
.topic-item:focus {
    background: rgba(59, 130, 246, 0.5);
    border-color: #3b82f6;
    transform: scale(1.02);
    outline: none;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.topic-number {
    background: #3b82f6;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.32rem;
    font-weight: bold;
    flex-shrink: 0;
}

/* Input de conversa (chat com IA) */
.chat-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 20px;
    background: #f3f4f6;
    border-radius: 15px;
}

.message {
    margin-bottom: 8px;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.5rem;
    line-height: 1.4;
    animation: messageSlideIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    animation-fill-mode: forwards;
}

.message.user {
    background: #3b82f6;
    color: white;
    margin-left: 20%;
}

.message.ai {
    background: white;
    color: #333;
    margin-right: 20%;
    border: 2px solid #e5e7eb;
}

.chat-input-box {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 40px;
}

.chat-input-box input {
    flex: 1;
    height: 46px;
    padding: 0 15px;
    font-size: 1.2rem;
    border: 3px solid #3b82f6;
    border-radius: 15px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.chat-input-box input:focus {
    border-color: #9333ea;
    outline: none;
    box-shadow: 0 0 0 4px rgba(147, 51, 234, 0.2);
}

.chat-input-box .btn {
    height: 46px;
    box-sizing: border-box;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Quiz */
.quiz-question {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 20px;
    color: #333;
    max-width: 100%;
    max-height: 65vh;
    overflow: hidden;
}

.quiz-question h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: #3b82f6;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.quiz-option {
    padding: 12px;
    font-size: 1.21rem;
    background: rgba(59, 130, 246, 0.1);
    border: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.quiz-option:hover,
.quiz-option:focus {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
    transform: translateX(5px);
    outline: none;
}

/* Challenge Results */
.challenge-result {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    border-left: 5px solid #3b82f6;
}

.challenge-result.correct {
    border-left-color: #10b981;
}

.challenge-result.wrong {
    border-left-color: #ef4444;
}

/* Botoes de acao (sempre no rodape do conteudo) */
.action-bar {
    display: flex;
    gap: 20px;
    margin-top: 40px;
    flex-wrap: wrap;
}

/* Botao voltar menor para topicos */
.content-screen.topics-container .action-bar {
    margin-top: 20px;
    justify-content: flex-end;
}

.content-screen.topics-container .action-bar .btn {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* Botao voltar menor no chat */
.chat-container .action-bar .btn {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* Botao menor no quiz */
.quiz-question .action-bar .btn {
    padding: 12px 20px;
    font-size: 1.1rem;
}

/* Botoes menores e lado a lado nos topicos */
.content-screen .action-bar {
    flex-direction: row;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.content-screen .action-bar .btn {
    padding: 14px 28px;
    font-size: 1.3rem;
    min-width: auto;
}

.btn {
    padding: 25px 45px;
    font-size: 1.5rem;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn:hover,
.btn:focus {
    transform: scale(1.05);
    outline: none;
    box-shadow: 0 0 20px currentColor;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* Loading */
.loading-screen {
    text-align: center;
    padding: 150px 40px;
}

.loading {
    display: inline-block;
    width: 60px;
    height: 60px;
    border: 6px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen p {
    margin-top: 30px;
    font-size: 1.8rem;
    color: #d1d5db;
}

/* Scrollbar customizada */
::-webkit-scrollbar {
    width: 14px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: #9333ea;
    border-radius: 7px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7c3aed;
}

/* Esconder scrollbar do chat (estilo LLM) */
.chat-messages::-webkit-scrollbar {
    display: none;
}

/* Footer */
footer {
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    text-align: center;
    font-size: 1rem;
    border-top: 3px solid rgba(147, 51, 234, 0.4);
}

/* Dica de navegacao */
.nav-hint {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1rem;
    color: #9ca3af;
    border: 2px solid rgba(147, 51, 234, 0.5);
    text-align: center;
}

.nav-hint strong {
    color: #9333ea;
}

/* Gamification animations */
@keyframes levelUpPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes badgeSlide {
    0% { transform: translateX(100%); opacity: 0; }
    10% { transform: translateX(-10px); opacity: 1; }
    90% { transform: translateX(-10px); opacity: 1; }
    100% { transform: translateX(-100%); opacity: 0; }
}

@keyframes pointsFloat {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-50px); opacity: 0; }
}

/* Easter egg animation */
@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Chat message animation */
@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
