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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #f59e0b;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --bg-dark: #1e293b;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-admin: linear-gradient(135deg, #475569 0%, #1e293b 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* ============ LOGIN PAGE ============ */
.login-body {
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.5s ease-out;
}

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

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    font-size: 64px;
    margin-bottom: 16px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-light);
    font-size: 15px;
}

.login-form {
    margin-bottom: 28px;
}

.login-footer {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-light);
    font-size: 13px;
}

.login-footer strong {
    color: var(--primary-dark);
}

/* ============ NAVBAR ============ */
.navbar {
    background: var(--gradient);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-nav {
    background: var(--gradient-admin);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.admin-badge {
    background: rgba(245, 158, 11, 0.3);
}

.user-name {
    font-weight: 500;
    font-size: 14px;
}

.btn-logout {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}

/* ============ CONTAINER ============ */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px;
}

.page-header {
    margin-bottom: 36px;
    text-align: center;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.page-desc {
    color: var(--text-light);
    font-size: 16px;
}

/* ============ FORM ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
    color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94a3b8;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    background: rgba(99, 102, 241, 0.05);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-block {
    width: 100%;
    padding: 16px;
    font-size: 16px;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-icon {
    font-size: 18px;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

/* ============ QUESTIONS CARDS ============ */
.questions-form {
    margin-bottom: 20px;
}

.question-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.2s;
    animation: fadeIn 0.4s ease-out;
}

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

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

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.question-number {
    background: var(--gradient);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}

.question-points {
    background: var(--success-light);
    color: var(--success);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
}

.question-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
    line-height: 1.5;
}

.question-input {
    font-size: 16px !important;
    padding: 16px 18px !important;
}

/* ============ ALERTS ============ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 14px;
    border-left: 4px solid;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

/* ============ RESULT SUMMARY ============ */
.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.summary-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

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

.summary-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.summary-value {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.score-card .summary-value {
    color: var(--primary);
}

.correct-card .summary-value {
    color: var(--success);
}

.rank-card .summary-value {
    color: var(--secondary);
}

.summary-label {
    color: var(--text-light);
    font-weight: 500;
    font-size: 14px;
}

/* ============ RESULTS LIST ============ */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-item {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    border-left: 5px solid;
    box-shadow: var(--shadow);
    position: relative;
}

.result-item.correct {
    border-color: var(--success);
    background: linear-gradient(90deg, var(--success-light) 0%, #fff 30%);
}

.result-item.wrong {
    border-color: var(--danger);
    background: linear-gradient(90deg, var(--danger-light) 0%, #fff 30%);
}

.result-status {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
}

.result-item.correct .result-status {
    color: var(--success);
}

.result-item.wrong .result-status {
    color: var(--danger);
}

.result-question {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 14px;
    color: var(--text);
}

.result-answers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.answer-line {
    font-size: 14px;
}

.answer-label {
    font-weight: 600;
    color: var(--text-light);
    margin-right: 8px;
}

.correct-answer {
    color: var(--success);
    font-weight: 600;
}

.result-points {
    position: absolute;
    top: 24px;
    right: 24px;
    font-weight: 700;
    font-size: 14px;
    padding: 4px 12px;
    border-radius: 16px;
}

.result-item.correct .result-points {
    background: var(--success-light);
    color: var(--success);
}

.result-item.wrong .result-points {
    background: var(--danger-light);
    color: var(--danger);
}

/* ============ RANKING TABLE ============ */
.ranking-table-wrapper {
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
    padding: 16px 20px;
    text-align: left;
}

.ranking-table thead {
    background: var(--gradient);
    color: #fff;
}

.ranking-table th {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.ranking-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

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

.ranking-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.ranking-table tbody tr.highlight-row {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.02) 50%);
    font-weight: 600;
}

.rank-pos {
    font-weight: 700;
    font-size: 16px;
    width: 90px;
}

.rank-name {
    font-weight: 600;
}

.rank-points {
    font-weight: 700;
    color: var(--primary);
}

.rank-date {
    color: var(--text-light);
    font-size: 13px;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state p {
    color: var(--text-light);
    font-size: 16px;
    font-weight: 500;
}

/* ============ ADMIN TABS ============ */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    background: var(--card);
    padding: 6px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--bg);
}

.tab-btn.active {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ============ EDITOR CARDS ============ */
.questions-editor {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 28px;
}

.editor-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    animation: fadeIn 0.3s ease-out;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.editor-number {
    font-weight: 700;
    font-size: 15px;
    color: var(--primary-dark);
}

.btn-remove {
    width: 34px;
    height: 34px;
    border: none;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: var(--danger);
    color: #fff;
    transform: scale(1.05);
}

.editor-textarea {
    resize: vertical;
    min-height: 70px;
    font-size: 15px !important;
}

.editor-input {
    font-size: 15px !important;
}

.editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.ranking-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* ============ MULTIPLA ESCOLHA - USUÁRIO ============ */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    user-select: none;
    position: relative;
}

.option-item:hover {
    border-color: var(--primary-light);
    background: linear-gradient(90deg, rgba(99,102,241,0.04) 0%, #fff 60%);
    transform: translateX(4px);
}

.option-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-input:checked + .option-letter {
    background: var(--gradient);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
    transform: scale(1.05);
}

.option-input:checked ~ .option-text {
    color: var(--primary-dark);
    font-weight: 600;
}

.option-item:has(.option-input:checked) {
    border-color: var(--primary);
    background: linear-gradient(90deg, rgba(99,102,241,0.08) 0%, #fff 60%);
}

.option-letter {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: var(--text-light);
    transition: all 0.2s;
}

.option-text {
    flex: 1;
    font-size: 15px;
    color: var(--text);
    transition: all 0.2s;
}

/* ============ REVIEW DETALHADO ============ */
.result-options-review {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.review-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: #f8fafc;
    font-size: 14px;
}

.review-option.opt-correct {
    background: var(--success-light);
    border-color: var(--success);
    color: #065f46;
    font-weight: 500;
}

.review-option.opt-wrong {
    background: var(--danger-light);
    border-color: var(--danger);
    color: #991b1b;
    text-decoration: line-through;
}

.review-option.opt-user-correct {
    background: var(--success-light);
    border-color: var(--success);
    color: #065f46;
    font-weight: 700;
}

.review-option .opt-letter {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.review-option .opt-text {
    flex: 1;
}

.opt-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--success);
    color: #fff;
}

.opt-badge.wrong-badge {
    background: var(--danger);
}

.not-answered {
    margin-top: 12px;
    padding: 8px 14px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

/* ============ ADMIN - MÚLTIPLA ESCOLHA ============ */
.mc-options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.mc-option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.mc-option-row:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.mc-letter-badge {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 15px;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.mc-letter-badge.a { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.mc-letter-badge.b { background: linear-gradient(135deg, #ec4899, #be185d); }
.mc-letter-badge.c { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.mc-letter-badge.d { background: linear-gradient(135deg, #f59e0b, #b45309); }

.mc-option-row .editor-input {
    flex: 1;
    background: #fff !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
}

.mc-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.mc-radio-label:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.mc-radio-label:has(input[type="radio"]:checked) {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    box-shadow: 0 4px 10px rgba(16,185,129,0.3);
}

.mc-radio-label input[type="radio"] {
    accent-color: var(--success);
}

.mc-card {
    border-left: 5px solid var(--primary-light);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .login-card {
        padding: 36px 24px;
    }

    .page-header h1 {
        font-size: 26px;
    }

    .container {
        padding: 28px 16px;
    }

    .question-card,
    .editor-card {
        padding: 20px;
    }

    .result-summary {
        grid-template-columns: 1fr;
    }

    .ranking-table th,
    .ranking-table td {
        padding: 12px 14px;
        font-size: 13px;
    }

    .nav-content {
        padding: 14px 16px;
    }

    .user-name {
        display: none;
    }

    .editor-actions {
        flex-direction: column;
    }

    .editor-actions .btn {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .option-item {
        padding: 12px 14px;
        gap: 10px;
    }

    .option-letter {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 13px;
    }

    .option-text {
        font-size: 14px;
    }

    .result-options-review {
        gap: 6px;
    }

    .review-option {
        flex-wrap: wrap;
        padding: 10px;
        gap: 8px;
    }

    .review-option .opt-badge {
        width: 100%;
        text-align: center;
        margin-top: 2px;
    }

    .mc-option-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }

    .mc-option-row .editor-input {
        order: 3;
        width: 100%;
    }

    .mc-letter-badge {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 14px;
    }

    .mc-radio-label {
        padding: 6px 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .ranking-table th:nth-child(4),
    .ranking-table td:nth-child(4),
    .ranking-table th:nth-child(5),
    .ranking-table td:nth-child(5) {
        display: none;
    }

    .result-points {
        position: static;
        margin-top: 12px;
        display: inline-block;
    }

    .option-item {
        padding: 10px 12px;
    }

    .option-letter {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 12px;
    }

    .option-text {
        font-size: 13px;
    }
}
