/* ================================================
   DESIGN SYSTEM - DARK MODE PREMIUM (MOBILE-FIRST)
   ================================================ */
:root {
    --bg-main: #0d1117;
    --bg-card: #161b22;
    --bg-card-hover: #1c2128;
    --bg-input: #21262d;
    --border: #30363d;
    --border-active: #58a6ff;
    
    --primary: #58a6ff;
    --primary-gradient: linear-gradient(135deg, #1f6feb 0%, #388bfd 100%);
    
    --success: #3fb950;
    --success-bg: rgba(63, 185, 80, 0.12);
    --success-border: #238636;
    
    --danger: #f85149;
    --danger-bg: rgba(248, 81, 73, 0.12);
    --danger-border: #da3633;
    
    --warning: #d29922;
    --warning-bg: rgba(210, 153, 34, 0.15);
    
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main) !important;
    color: var(--text-primary) !important;
    min-height: 100vh;
    padding-bottom: 2rem;
}

.container {
    max-width: 720px;
    padding-left: 14px;
    padding-right: 14px;
}

/* ================================================
   BOTOES MODERNOS
   ================================================ */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
    min-height: 48px;
}

.btn-modern:active {
    transform: scale(0.98);
}

.btn-modern-primary {
    background: var(--primary-gradient);
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(31, 111, 235, 0.4);
}

.btn-modern-secondary {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-primary) !important;
}

.btn-modern-success {
    background: var(--success);
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(63, 185, 80, 0.3);
}

.btn-modern-danger {
    background: var(--danger);
    color: #ffffff !important;
}

.btn-sm-custom {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    min-height: 38px;
    border-radius: var(--radius-sm);
}

/* ================================================
   TELA BOAS-VINDAS
   ================================================ */
.welcome-container {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    width: 100%;
}

.welcome-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.welcome-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.welcome-subtitle {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.welcome-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.welcome-feature {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-align: left;
}

.welcome-feature i {
    font-size: 1.6rem;
    color: var(--warning);
    flex-shrink: 0;
}

.welcome-feature span {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* ================================================
   HEADER DAS MATERIAS
   ================================================ */
.header-modern {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-modern i {
    font-size: 2rem;
    color: var(--primary);
}

.header-modern h2 {
    font-size: 1.25rem;
    margin: 0;
}

.header-modern p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ================================================
   CARDS DE AREAS E MATERIAS
   ================================================ */
.area-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.area-card .card-header {
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.25rem;
}

.area-card .card-header h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.materia-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.materia-item:last-child {
    border-bottom: none;
}

.materia-item:active, .materia-item:hover {
    background: var(--bg-card-hover);
}

.materia-item h6 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
}

.materia-item p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.badge-tag {
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-gray { background: var(--bg-input); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-green { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-red { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }

/* ================================================
   TELA DE QUESTOES (MOBILE-FIRST)
   ================================================ */
.question-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.top-bar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.materia-title-box h5 {
    font-size: 1rem;
    margin: 0 0 0.2rem 0;
}

.materia-title-box small {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    line-height: 1.3;
}

.progress-track {
    background: var(--bg-input);
    border-radius: 50px;
    height: 10px;
    overflow: hidden;
    position: relative;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 50px;
    transition: width 0.3s ease;
}

.question-counter-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: right;
    margin: 0;
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

/* ================================================
   OPCOES DE RESPOSTA FORMATO CARD
   ================================================ */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.option-card {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    transition: all 0.15s ease;
}

.option-card:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.option-card.selected {
    border-color: var(--primary);
    background: rgba(88, 166, 255, 0.1);
}

.option-card input[type="radio"] {
    display: none;
}

.letter-pill {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-top: 1px;
}

.option-card.selected .letter-pill {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.option-label-text {
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text-primary);
    flex: 1;
}

/* ================================================
   BOTOES LADO A LADO FIXOS NO MOBILE
   ================================================ */
.question-actions-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    width: 100% !important;
}

.question-actions-row .btn-modern {
    flex: 1 1 50% !important;
    width: 50% !important;
    padding: 0.85rem 0.5rem !important;
}

/* ================================================
   NOVA TELA DE RESULTADO / DESEMPENHO (SCORECARD)
   ================================================ */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.score-circle-wrapper {
    margin: 1rem auto 1.5rem auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.25);
}

.score-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 4px;
}

.result-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.stat-box.success-box { border-color: var(--success-border); background: var(--success-bg); }
.stat-box.danger-box { border-color: var(--danger-border); background: var(--danger-bg); }

.stat-box-val {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-box-lbl {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ================================================
   TELA DE REVISAO COMPLETA
   ================================================ */
.review-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.review-item.is-correct { border-left: 4px solid var(--success); }
.review-item.is-incorrect { border-left: 4px solid var(--danger); }

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.review-question-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.review-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.review-opt {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.review-opt.opt-correct {
    background: var(--success-bg) !important;
    border-color: var(--success-border) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.review-opt.opt-wrong-user {
    background: var(--danger-bg) !important;
    border-color: var(--danger-border) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.fade-in {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.d-none {
    display: none !important;
}