/* ==========================================================================
   PORTAL TEKLA ALUNOS - LIGHT THEME DESIGN SYSTEM (TEMA CLARO PREMIUM)
   Autor: Fernando De Cesaro (Tekla Specialist)
   ========================================================================== */

:root {
    /* Paleta Principal - Engenharia & Tekla Steel Theme (Light SaaS) */
    --primary: #0284c7;            /* Tekla Blue */
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;      /* Sky 100 */
    --primary-border: #bae6fd;
    --secondary: #0f172a;          /* Slate Dark */
    --accent: #f59e0b;             /* Amber Gold */
    --accent-hover: #d97706;
    
    /* Status Colors */
    --success: #059669;            /* Emerald 600 */
    --success-bg: #ecfdf5;         /* Emerald 50 */
    --success-border: #a7f3d0;
    --danger: #dc2626;             /* Red 600 */
    --danger-bg: #fef2f2;          /* Red 50 */
    --danger-border: #fecaca;
    --warning: #d97706;            /* Amber 600 */
    --warning-bg: #fffbeb;         /* Amber 50 */
    --warning-border: #fde68a;
    --info: #2563eb;               /* Blue 600 */
    --info-bg: #eff6ff;            /* Blue 50 */
    --info-border: #bfdbfe;

    /* Backgrounds & Neutrals (Clean Crisp Light Theme) */
    --bg-main: #f8fafc;            /* Slate 50 */
    --bg-surface: #ffffff;         /* Pure White */
    --bg-surface-hover: #f1f5f9;   /* Slate 100 */
    --bg-subtle: #f8fafc;
    --border-color: #e2e8f0;       /* Slate 200 */
    --border-light: #f1f5f9;       /* Slate 100 */

    /* Typography */
    --text-primary: #0f172a;       /* Slate 900 */
    --text-secondary: #475569;     /* Slate 600 */
    --text-muted: #64748b;         /* Slate 500 */
    --text-inverse: #ffffff;

    /* Fonts & Radii */
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Soft Elevation & Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.15);

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--primary-hover);
}

/* Container */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */
.header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #0284c7, #0369a1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.brand-sub {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 999px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.role-admin {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.role-aluno {
    background: var(--primary-light);
    color: #0369a1;
    border: 1px solid var(--primary-border);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: #0284c7;
    color: #fff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.btn-primary:hover {
    background: #0369a1;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-secondary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.btn-success {
    background: #059669;
    color: #fff;
}

.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 13px 26px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

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

/* ==========================================================================
   CARDS & SURFACES
   ========================================================================== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-hover:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   GRID & STATS
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.amber {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.purple {
    background: #f3e8ff;
    color: #9333ea;
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ==========================================================================
   TABS SYSTEM
   ========================================================================== */
.tabs-nav {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 0;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 700;
}

.tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}

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

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

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: #ffffff;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.custom-table th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.custom-table tr:last-child td {
    border-bottom: none;
}

.custom-table tr:hover td {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info-border);
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.92rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    background: #ffffff;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96);
    transition: var(--transition);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideInRight 0.25s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

/* ==========================================================================
   LOGIN / HERO SCREEN (LIGHT THEME)
   ========================================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 40px 20px;
    background: radial-gradient(circle at top center, #e0f2fe, #f8fafc 70%);
}

.login-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

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

.login-icon-box {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #0284c7, #0369a1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin: 0 auto 16px auto;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.login-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ==========================================================================
   PROVA / EXAM ROOM (LIGHT THEME)
   ========================================================================== */
.exam-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.exam-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.timer-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1.1rem;
    color: #d97706;
}

.timer-box.urgent {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
    animation: pulse 1s infinite;
}

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

.exam-body {
    padding: 36px 0 80px 0;
}

.question-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.question-num {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

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

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

.option-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

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

.option-item.selected {
    background: #e0f2fe;
    border-color: #0284c7;
}

.option-item input[type="radio"] {
    margin-right: 14px;
    accent-color: var(--primary);
    transform: scale(1.2);
}

.option-label {
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    width: 100%;
    font-weight: 500;
}

/* ==========================================================================
   RESULTADO / SCORE REPORT (LIGHT THEME)
   ========================================================================== */
.result-hero {
    text-align: center;
    padding: 40px 24px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    margin: 40px auto 30px auto;
    max-width: 800px;
    box-shadow: var(--shadow-md);
}

.score-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    border: 5px solid var(--primary);
    background: var(--primary-light);
}

.score-circle.pass {
    border-color: #10b981;
    background: #ecfdf5;
}

.score-circle.fail {
    border-color: #ef4444;
    background: #fef2f2;
}

.score-val {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.score-max {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.review-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

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

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

.explanation-box {
    background: #f8fafc;
    border-left: 3px solid var(--primary);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 18px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: 14px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .exam-header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    .modal-container {
        padding: 10px;
    }
}
