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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #475569;
}

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

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Login */
.login-card {
    max-width: 400px;
    margin: 80px auto;
    text-align: center;
}

.logo {
    font-size: 4em;
    margin-bottom: 10px;
}

.login-card h1 {
    color: var(--primary);
    margin-bottom: 5px;
}

.login-card h2 {
    color: var(--text-muted);
    font-weight: normal;
    font-size: 1.1em;
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9em;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1em;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

input#usuario {
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
    font-size: 1.3em;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
}

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

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-input);
}

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

.btn-success:hover {
    filter: brightness(1.1);
}

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

.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* Error message */
.error-msg {
    color: var(--danger);
    margin-top: 15px;
    font-size: 0.9em;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    font-size: 1.5em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-name {
    color: var(--text-muted);
}

/* Exam List */
.exam-list {
    display: grid;
    gap: 15px;
}

.exam-item {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.exam-item:hover {
    transform: translateX(5px);
}

.exam-item.blocked {
    opacity: 0.6;
}

.exam-item.blocked:hover {
    transform: none;
}

.exam-info h3 {
    margin-bottom: 5px;
}

.exam-meta {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Exam Screen */
.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timer {
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3em;
    font-weight: bold;
}

.timer.warning {
    background: var(--warning);
    color: #000;
}

.timer.danger {
    background: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 30px;
}

/* Question */
.question-container {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 20px;
    min-height: 300px;
}

.question-text {
    font-size: 1.2em;
    margin-bottom: 30px;
    line-height: 1.5;
}

.options {
    display: grid;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.option:hover {
    border-color: var(--primary);
}

.option.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.2);
}

.option-letter {
    width: 36px;
    height: 36px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.option.selected .option-letter {
    background: var(--primary);
}

.option-text {
    flex: 1;
}

/* Navigation */
.exam-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

/* Question Dots */
.question-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.q-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s;
}

.q-dot.answered {
    background: var(--primary);
}

.q-dot.current {
    border: 2px solid var(--text);
    transform: scale(1.1);
}

/* Results */
.results-card {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
}

.results-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.score-display {
    margin: 30px 0;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--success) var(--score, 0%), var(--bg-input) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: var(--bg-card);
    border-radius: 50%;
}

.score-circle span {
    position: relative;
    font-size: 2em;
    font-weight: bold;
}

.score-circle.fail {
    background: conic-gradient(var(--danger) var(--score, 0%), var(--bg-input) 0%);
}

.score-details {
    margin-bottom: 30px;
}

.pass {
    color: var(--success);
    font-size: 1.3em;
    font-weight: bold;
    margin-top: 10px;
}

.fail {
    color: var(--danger);
    font-size: 1.3em;
    font-weight: bold;
    margin-top: 10px;
}

.results-details {
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 30px;
}

.result-item {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: var(--bg-input);
}

.result-item.correct {
    border-left: 4px solid var(--success);
}

.result-item.incorrect {
    border-left: 4px solid var(--danger);
}

.result-item .q-text {
    font-weight: 500;
    margin-bottom: 8px;
}

.result-item .answers {
    font-size: 0.9em;
    color: var(--text-muted);
}

.result-item .answers span {
    display: block;
}

/* Admin */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    background: var(--bg-input);
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

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

.admin-content {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
}

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

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    color: var(--text-muted);
    font-weight: 500;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
}

.badge-success {
    background: rgba(22, 163, 74, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(220, 38, 38, 0.2);
    color: var(--danger);
}

/* Form in admin */
.admin-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-form input {
    flex: 1;
    min-width: 150px;
}

/* Quiz Mode Styles */
.quiz-header {
    text-align: center;
    margin-bottom: 20px;
}

.texel-logo {
    max-width: 250px;
    margin-bottom: 15px;
}

.score-tracker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 12px;
}

.score-box {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: var(--text-muted);
}

.score-box.correct {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.score-box.incorrect {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.score-box.current {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

/* Quiz Options */
.option.quiz-style {
    background: #87CEFA;
    color: #000;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.option.quiz-style:hover {
    background: #5cacee;
}

.option.quiz-style.selected {
    background: #1E90FF;
    border-color: #000;
    transform: scale(1.02);
}

.option.quiz-style.correct {
    background: var(--success) !important;
    color: white;
    border-color: var(--success);
}

.option.quiz-style.incorrect {
    background: var(--danger) !important;
    color: white;
    border-color: var(--danger);
}

.option.quiz-style.disabled {
    pointer-events: none;
    opacity: 0.9;
}

/* Reference Display */
.reference-display {
    margin-top: 20px;
    padding: 15px;
    background: rgba(37, 99, 235, 0.1);
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    font-size: 0.9em;
    color: var(--text-muted);
    display: none;
}

.reference-display.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.reference-display strong {
    color: var(--primary);
}

/* Check Answer Button */
.btn-check {
    background: #ffc107;
    color: #000;
    font-weight: bold;
}

.btn-check:hover {
    background: #e0a800;
}

/* Quiz Result Banner */
.quiz-result-banner {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    display: none;
}

.quiz-result-banner.correct {
    background: rgba(22, 163, 74, 0.2);
    color: var(--success);
    display: block;
}

.quiz-result-banner.incorrect {
    background: rgba(220, 38, 38, 0.2);
    color: var(--danger);
    display: block;
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-input);
    border-radius: 20px;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    .card {
        padding: 20px;
    }
    
    .exam-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .exam-nav {
        flex-direction: column;
        gap: 10px;
    }
    
    .exam-nav .btn {
        width: 100%;
        justify-content: center;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .admin-table {
        font-size: 0.85em;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 8px 5px;
    }
}
