/* Reset e Variáveis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px 0;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-card {
    max-width: 450px;
    margin: 80px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.5s ease;
}

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

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Form */
.form-group {
    margin-bottom: 24px;
}

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: var(--transition);
    background: var(--card-bg);
}

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

.form-group input[readonly] {
    background-color: var(--bg-color);
    cursor: not-allowed;
}

.form-group input.success {
    border-color: var(--secondary-color);
    background-color: rgba(16, 185, 129, 0.05);
}

.form-group input.error {
    border-color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.05);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-secondary:hover {
    background: #475569;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-back {
    background: transparent;
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-back:hover {
    opacity: 0.8;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header h1 {
    font-size: 28px;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

.header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.menu-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.menu-card h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.menu-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

.menu-footer {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Professionals Grid */
.professionals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.professional-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
    text-align: center;
}

.professional-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.professional-card h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.professional-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Levels Grid */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.level-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
    position: relative;
}

.level-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.level-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.level-card h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.level-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.level-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--secondary-color);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.level-badge-advanced {
    background: var(--warning-color);
}

/* Test Screen */
.test-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.test-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.test-level-badge {
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.test-progress {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Timer */
.timer-container {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.timer-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-progress.warning {
    stroke: var(--warning-color);
}

.timer-progress.danger {
    stroke: var(--danger-color);
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Question Container */
.question-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.question-text {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 32px;
    line-height: 1.5;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-item {
    padding: 16px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    background: var(--card-bg);
    font-size: 16px;
    text-align: left;
}

.option-item:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

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

.option-item.correct {
    border-color: var(--secondary-color);
    background: rgba(16, 185, 129, 0.1);
}

.option-item.incorrect {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.test-actions {
    display: flex;
    justify-content: center;
}

/* Answer Feedback */
.answer-feedback {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.answer-feedback.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.feedback-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.feedback-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.feedback-content h3 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.feedback-content .btn {
    margin: 8px;
}

/* Módulo de Estudo */
.study-content {
    margin-top: 30px;
}

.study-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.study-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

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

.study-card-header h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.study-specialty {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.study-card-body {
    margin-top: 16px;
}

.study-script {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
    max-width: 900px;
    margin: 0 auto;
}

.study-script h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
}

.script-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.script-section:last-child {
    border-bottom: none;
}

.script-section h3 {
    font-size: 20px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.script-section p {
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.7;
}

.script-section ul {
    list-style: none;
    padding-left: 0;
}

.script-section ul li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-primary);
    line-height: 1.6;
}

.script-section ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 20px;
}

/* Módulo de Estudo Aprimorado */
.script-summary {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 40px;
    border: 2px solid var(--primary-color);
}

.script-summary h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 24px;
    text-align: center;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.summary-item {
    background: white;
    padding: 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.study-sections {
    margin-top: 40px;
}

.study-sections > h3 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary-color);
}

.study-section {
    margin-bottom: 40px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
    border-left: 5px solid var(--primary-color);
}

.study-section h3 {
    color: var(--primary-color);
    font-size: 22px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.study-content-box {
    background: rgba(37, 99, 235, 0.05);
    padding: 24px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
}

.study-content-box p {
    margin-bottom: 16px;
    line-height: 1.8;
}

.study-content-box ul {
    margin-top: 12px;
}

.study-content-box ul li {
    margin-bottom: 12px;
    line-height: 1.7;
}

.highlight {
    background: rgba(255, 193, 7, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: var(--text-primary);
}

.study-tip {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--secondary-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 20px;
    font-style: italic;
}

.checklist-box {
    background: rgba(37, 99, 235, 0.1);
    border: 2px solid var(--primary-color);
}

.checklist-box ul li {
    padding: 8px 0;
    font-size: 16px;
}

/* Tabs do Médico */
.medico-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border-bottom: 2px solid var(--border-color);
}

.medico-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.medico-tab:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    border-radius: var(--radius-sm);
}

.medico-tab.active {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    border-radius: var(--radius-sm);
}

.medico-tab-content {
    display: none;
}

.medico-tab-content.active {
    display: block;
}

/* Visualização de Script */
.script-view-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
    min-height: 400px;
}

.study-script-content {
    line-height: 1.8;
}

/* Editor de Texto Rico */
.script-editor-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.toolbar-separator {
    width: 1px;
    background: var(--border-color);
    margin: 0 4px;
}

.rich-text-editor {
    min-height: 500px;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 16px;
    line-height: 1.8;
    overflow-y: auto;
    word-wrap: break-word;
}

.rich-text-editor:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.rich-text-editor h2,
.rich-text-editor h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.rich-text-editor h2 {
    font-size: 24px;
}

.rich-text-editor h3 {
    font-size: 20px;
}

.rich-text-editor p {
    margin-bottom: 12px;
}

.rich-text-editor ul,
.rich-text-editor ol {
    margin: 16px 0;
    padding-left: 30px;
}

.rich-text-editor li {
    margin-bottom: 8px;
}

.rich-text-editor strong {
    font-weight: 600;
    color: var(--text-primary);
}

.rich-text-editor em {
    font-style: italic;
}

.rich-text-editor u {
    text-decoration: underline;
}

/* Admin Study Module */
.admin-study-view {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.admin-study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.admin-study-header h3 {
    color: var(--text-primary);
    font-size: 24px;
    margin: 0;
}

.admin-study-actions {
    display: flex;
    gap: 12px;
}

.admin-study-preview {
    background: white;
    border-radius: var(--radius-sm);
    padding: 30px;
    border: 2px solid var(--border-color);
    min-height: 400px;
    line-height: 1.8;
}

@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .study-section {
        padding: 20px;
    }
    
    .study-content-box {
        padding: 16px;
    }

    .medico-tabs {
        flex-wrap: wrap;
    }

    .admin-study-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .admin-study-actions {
        width: 100%;
        flex-direction: column;
    }

    .admin-study-actions .btn {
        width: 100%;
    }

    .script-editor-toolbar {
        justify-content: center;
    }

    .rich-text-editor {
        min-height: 300px;
        font-size: 14px;
    }
}

.script-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

@media (max-width: 768px) {
    .study-grid {
        grid-template-columns: 1fr;
    }
    
    .study-script {
        padding: 20px;
    }
    
    .script-section {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
}

/* Painel Administrativo */
.admin-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border-bottom: 2px solid var(--border-color);
}

.admin-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.admin-tab:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    border-radius: var(--radius-sm);
}

.admin-tab.active {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    border-radius: var(--radius-sm);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.admin-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.admin-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-filters select,
.admin-filters input {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 200px;
}

/* Lista de Perguntas (Novo Formato) */
.questions-list-view {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.question-list-item {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
}

.question-list-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.question-list-item.contested-item {
    border-left: 4px solid var(--warning-color);
}

.question-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.question-item-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.question-number {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.question-item-actions-header {
    display: flex;
    gap: 8px;
    align-items: center;
}

.theme-section {
    margin-bottom: 40px;
}

.theme-section:last-child {
    margin-bottom: 0;
}

.theme-title {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary-color);
    font-weight: 600;
}

.theme-title.warning-theme {
    color: var(--warning-color);
    border-bottom-color: var(--warning-color);
}

.question-list-item.no-theme-item {
    border-left: 4px solid var(--warning-color);
}

.question-item-tema.missing-theme {
    background: var(--warning-color) !important;
}

.required-field {
    color: var(--danger-color);
}

.form-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.medico-view {
    border-left: 3px solid var(--primary-color);
}

.medico-hint {
    margin-top: 16px;
    padding: 12px;
    background: rgba(37, 99, 235, 0.1);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
}

.question-item-tema {
    background: var(--primary-color);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.contested-badge {
    background: var(--warning-color) !important;
}

.contested-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contested-count {
    color: var(--text-secondary);
    font-size: 14px;
}

.question-item-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.question-item-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.question-item-field label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-item-text {
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.7;
    padding: 12px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: var(--radius-sm);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    transition: var(--transition);
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.option-list-item:hover {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.option-list-item.correct-option {
    background: #ffffff;
    border-color: var(--secondary-color);
    border-width: 3px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.option-number {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 24px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
}

.correct-badge {
    background: var(--secondary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.question-item-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-color);
}

.admin-header-actions,
.medico-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.admin-header-actions h2,
.medico-header-actions h2 {
    margin: 0;
}

.contested-details {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

.contested-details h4 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 16px;
}

.contestation-item {
    background: rgba(239, 68, 68, 0.05);
    border-left: 3px solid var(--danger-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.contestation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.contestation-reason {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.badge.not-applicable {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.admin-history-table {
    overflow-x: auto;
}

.admin-history-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-history-table th {
    background: var(--primary-color);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.admin-history-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.admin-history-table tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge.completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.badge.interrupted {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.admin-rankings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.ranking-card-admin {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.ranking-card-admin h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.ranking-list-admin {
    list-style: none;
    padding: 0;
}

.ranking-list-admin li {
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.rank-position {
    background: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-style: italic;
}

.modal-content.large {
    max-width: 800px;
}

.edit-option-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
}

.edit-option-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.edit-option-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

.edit-option-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    flex: 1;
}

@media (max-width: 768px) {
    .edit-option-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Painel do Médico */
.medico-content {
    margin-top: 30px;
}

.medico-info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    text-align: center;
}

.medico-info-card h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.medico-info-card p {
    color: var(--text-secondary);
    font-size: 16px;
}

.medico-actions {
    margin-bottom: 24px;
}

.medico-filters {
    margin-bottom: 24px;
}

.medico-filters select {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 200px;
}

@media (max-width: 768px) {
    .admin-filters {
        flex-direction: column;
    }
    
    .admin-filters select,
    .admin-filters input {
        width: 100%;
    }
    
    .admin-rankings-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-history-table {
        font-size: 12px;
    }
    
    .admin-history-table th,
    .admin-history-table td {
        padding: 8px;
    }

    .admin-header-actions,
    .medico-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .question-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .question-item-info {
        width: 100%;
    }

    .question-item-actions-header {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .question-item-actions-header .btn {
        width: 100%;
    }

    .theme-title {
        font-size: 18px;
    }

    .option-list-item {
        flex-direction: column;
        gap: 8px;
    }

    .contestation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.feedback-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 16px;
}

/* Result Screen */
.result-card {
    max-width: 600px;
    margin: 40px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    animation: slideUp 0.5s ease;
}

.result-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.result-card h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 32px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-item {
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.result-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Rankings Section na Home */
.rankings-section {
    margin-top: 40px;
}

.rankings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

@media (max-width: 768px) {
    .rankings-grid {
        grid-template-columns: 1fr;
    }
}

.ranking-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.ranking-title {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.ranking-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
}

.avancado-option {
    margin-top: 24px;
}

.avancado-card {
    max-width: 100%;
    margin: 0 auto;
}

/* Dashboard */
.ranking-container,
.history-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    max-height: 500px;
    overflow-y: auto;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
}

.ranking-position {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
}

.ranking-position.top-1 {
    color: #ffd700;
}

.ranking-position.top-2 {
    color: #c0c0c0;
}

.ranking-position.top-3 {
    color: #cd7f32;
}

.ranking-info {
    flex: 1;
    margin-left: 16px;
}

.ranking-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ranking-details {
    font-size: 14px;
    color: var(--text-secondary);
}

.ranking-score {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 80px;
    text-align: right;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-color);
    padding: 24px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.history-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.history-item:last-child {
    border-bottom: none;
}

.history-info {
    flex: 1;
}

.history-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-meta {
    font-size: 14px;
    color: var(--text-secondary);
}

.history-score {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.history-item {
    cursor: pointer;
}

.history-item:hover {
    background: var(--bg-color);
}

.history-item.has-errors {
    border-left: 4px solid var(--danger-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.test-details-info {
    margin-bottom: 32px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
}

.test-details-info p {
    margin: 8px 0;
    color: var(--text-primary);
}

.test-details-info strong {
    color: var(--text-secondary);
}

.wrong-questions-section {
    margin-top: 32px;
}

.wrong-questions-section h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.wrong-question-item {
    background: var(--bg-color);
    border-left: 4px solid var(--danger-color);
    padding: 20px;
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
}

.wrong-question-item h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 600;
}

.wrong-answer-option {
    margin: 8px 0;
    padding: 12px;
    border-radius: var(--radius-sm);
}

.wrong-answer-option.user-answer {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger-color);
}

.wrong-answer-option.correct-answer {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--secondary-color);
}

.wrong-answer-option strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    color: var(--text-primary);
}

.wrong-answer-option span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Instruções do Teste */
.instructions-card {
    max-width: 900px;
    margin: 40px auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.5s ease;
}

.instructions-card h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 32px;
    text-align: center;
}

.instructions-section {
    margin-bottom: 32px;
}

.instructions-section h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.instructions-list {
    list-style: none;
    padding: 0;
}

.instructions-list li {
    padding: 12px 0;
    padding-left: 32px;
    position: relative;
    color: var(--text-primary);
    line-height: 1.6;
}

.instructions-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: bold;
}

.example-question {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 24px;
    margin-top: 16px;
}

.example-timer {
    text-align: center;
    margin-bottom: 24px;
}

.example-timer-label {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.timer-circle.example {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.timer-circle.example .timer-text {
    font-size: 24px;
}

.example-question-text {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
}

.example-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.option-item.example {
    padding: 12px 16px;
    font-size: 14px;
    cursor: default;
}

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

.example-actions {
    text-align: center;
}

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

.warning-box {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.warning-box p {
    margin: 8px 0;
    color: var(--text-primary);
}

.instructions-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.test-interrupted {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger-color);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    font-size: 14px;
    color: var(--danger-color);
    font-weight: 600;
}

.history-item.interrupted {
    opacity: 0.7;
}

.history-item.interrupted .history-title::after {
    content: " (Interrompido)";
    color: var(--danger-color);
    font-size: 14px;
    font-weight: normal;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .login-card {
        margin: 40px auto;
        padding: 32px 24px;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-left {
        width: 100%;
        justify-content: center;
    }

    .header h1 {
        text-align: center;
        order: -1;
        width: 100%;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
    }

    .menu-grid,
    .levels-grid {
        grid-template-columns: 1fr;
    }

    .professionals-grid {
        grid-template-columns: 1fr;
    }

    .question-text {
        font-size: 20px;
    }

    .result-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .timer-circle {
        width: 100px;
        height: 100px;
    }

    .timer-text {
        font-size: 28px;
    }

    .ranking-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .ranking-score {
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 24px;
    }

    .result-card {
        padding: 24px;
    }

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

    .feedback-content {
        padding: 24px;
    }
}

/* Estilos para Planilha Completa de Testes */
.spreadsheet-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    margin-top: 20px;
}

.spreadsheet-wrapper {
    min-width: 100%;
    overflow-x: auto;
}

.spreadsheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 2000px;
}

.spreadsheet-table thead {
    position: sticky;
    top: 0;
    background: var(--primary-color);
    color: white;
    z-index: 10;
}

.spreadsheet-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spreadsheet-table td {
    padding: 10px 8px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    background: var(--card-bg);
}

.spreadsheet-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.spreadsheet-table tbody tr:hover {
    background: #e0e7ff;
    cursor: pointer;
}

.spreadsheet-info {
    margin-top: 16px;
    padding: 12px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
}

.spreadsheet-table .status-iniciado {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.spreadsheet-table .status-concluido {
    background: #d1fae5;
    color: #065f46;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.spreadsheet-table .status-abortado {
    background: #fee2e2;
    color: #991b1b;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

