@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1e3a8a;
    --primary-light: #60a5fa;
    --primary-dark: #1e40af;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --glass: rgba(255, 255, 255, 0.85);
    --border: #e2e8f0;
    --text-main: #1a1a1a;
    --text-muted: #64748b;
    --orange: #f59e0b;
    --red: #ef4444;
    --bg-input: #f8fafc;
    --green: #22c55e;
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    user-select: none;
    -webkit-user-select: none;
    background: radial-gradient(at top left, #eff6ff 0%, #ffffff 50%, #f1f5f9 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
    overflow-x: hidden;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Login Page */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 3rem;
    border-radius: 2rem;
    box-shadow: var(--shadow-premium);
    width: 100%;
    max-width: 500px;
    border: 1.5px solid var(--border);
    animation: fadeIn 0.8s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.login-title span {
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 1.1rem 1.4rem;
    border-radius: 1rem;
    border: 1.5px solid #e2e8f0;
    background: var(--bg-input);
    font-weight: 600;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
    color: var(--text-main);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.login-helper {
    margin-top: -0.25rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.5;
}

.login-helper strong {
    color: var(--primary);
}

.btn-login {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 1.2rem;
    border-radius: 1rem;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px rgba(37, 99, 235, 0.2);
    margin-top: 1rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 15px 25px rgba(37, 99, 235, 0.3);
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Exam Layout */
.exam-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: #ffffff;
}

.exam-header {
    background: #000000;
    height: 70px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    z-index: 1000;
    position: relative;
}

.header-brand {
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    color: #fff;
}

.header-brand span {
    color: var(--primary-light);
}

.timer-display {
    font-family: monospace;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 1rem;
    border-radius: 0.5rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.btn-finish-exam {
    background: var(--red);
    color: rgb(248, 246, 246);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    border: none;
    padding: 0.6rem 1.5rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: 0.3s;
}

.btn-finish-exam:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

.progress-wrapper {
    height: 4px;
    background: #f1f5f9;
    width: 100%;
}

.progress-bar-fill {
    height: 100%;
    background: #fa0202;
    transition: width 0.6s ease;
}

.exam-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.exam-form-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.form-embed {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-toolbar {
    background: #f1f5f9;
    border-bottom: 1.5px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.pdf-nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 0.6rem 1rem;
    border-radius: 0.6rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-btn:hover {
    background: #e2e8f0;
    border-color: var(--primary);
    color: var(--primary);
}

.pdf-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdf-info {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
}

.nav-sidebar {
    width: 300px;
    background: #f8fafc;
    border-right: 1.5px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.nav-sidebar.minimized {
    width: 80px;
    padding: 2rem 1rem;
}

.nav-sidebar.minimized .section-title,
.nav-sidebar.minimized .status-summary {
    display: none;
}

.nav-sidebar.minimized .nav-grid {
    grid-template-columns: 1fr;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-title span {
    width: 3px;
    height: 14px;
    background: #000;
}

.status-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.status-card {
    background: white;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.status-label {
    display: block;
    font-size: 0.55rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.status-value {
    font-size: 1rem;
    font-weight: 800;
    color: #000;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.nav-grid button {
    aspect-ratio: 1;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: white;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}

.nav-grid button.answered {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.nav-grid button.doubtful {
    background: #facc15;
    color: #000;
    border-color: #facc15;
}

.nav-grid button.current {
    border: 2px solid #000;
    transform: scale(1.1);
    z-index: 1;
}

.question-container {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    background: #fff;
}

.question-card {
    background: white;
    width: 100%;
    max-width: 800px;
    padding: 1rem;
    height: fit-content;
}

.question-badge {
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 2px solid #000;
    padding-bottom: 0.5rem;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.7;
    margin: 2.5rem 0;
    color: #1e293b;
    white-space: pre-line;
}

.option-item {
    width: 100%;
    background: #f8fafc;
    border: 1.5px solid #eef2f6;
    padding: 1.25rem 1.5rem;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: 0.2s;
    text-align: left;
}

.option-item:hover {
    border-color: var(--primary-light);
    transform: translateX(5px);
}

.option-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.option-key {
    min-width: 42px;
    height: 42px;
    background: white;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--primary);
    border: 1.5px solid #eef2f6;
}

.option-item.active .option-key {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: transparent;
}

.question-nav-buttons {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 1.5px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    padding: 0.8rem 1.5rem;
    border-radius: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.btn-next {
    background: var(--primary);
    color: white;
    padding: 0.8rem 2.5rem;
    border-radius: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.ragu-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--orange);
    font-weight: 700;
    font-size: 0.9rem;
}

.ragu-checkbox-wrapper input {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--orange);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 2rem;
    animation: fadeIn 0.3s ease-out;
}

.modal-card {
    background: white;
    padding: 3rem;
    border-radius: 2rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.confirm-card {
    background: white;
    border-radius: 1.25rem;
    max-width: 420px;
    width: min(90vw, 420px);
    padding: 1.5rem 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.confirm-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.75rem;
}

.confirm-text {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.confirm-btn {
    border: none;
    border-radius: 0.8rem;
    padding: 0.8rem 1.2rem;
    font-weight: 800;
    cursor: pointer;
    min-width: 110px;
}

.confirm-btn.yes {
    background: var(--primary);
    color: white;
}

.confirm-btn.no {
    background: #e2e8f0;
    color: #0f172a;
}

@media (max-width: 768px) {
    body {
        min-height: 100dvh;
    }

    .login-wrapper {
        padding: 1rem;
        align-items: flex-start;
    }

    .login-card {
        width: min(100%, 440px);
        padding: 1.5rem 1rem 1.2rem;
        border-radius: 1.2rem;
        margin: 0 auto;
    }

    .login-header {
        margin-bottom: 1.5rem;
    }

    .login-title {
        font-size: clamp(2rem, 9vw, 2.7rem);
    }

    .login-subtitle {
        font-size: 0.8rem;
    }

    .login-form {
        gap: 0.9rem;
    }

    .input-wrapper input,
    .input-wrapper select {
        padding: 0.95rem 1rem;
        border-radius: 0.9rem;
        font-size: 0.96rem;
    }

    .btn-login {
        padding: 1rem;
        margin-top: 0.5rem;
    }

    .login-footer {
        margin-top: 1.2rem;
        font-size: 0.62rem;
        letter-spacing: 0.08em;
    }

    .exam-header {
        height: 62px;
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    .header-brand {
        font-size: 0.9rem;
        letter-spacing: 0.06em;
    }

    .timer-display {
        font-size: 0.92rem;
        padding: 0.35rem 0.7rem;
        letter-spacing: 0.08em;
        position: static;
        transform: none;
    }

    .btn-finish-exam {
        padding: 0.45rem 0.7rem;
        font-size: 0.68rem;
        letter-spacing: 0.08em;
    }

    .exam-form-container {
        height: calc(100dvh - 66px - 4px);
    }

    .form-embed {
        min-height: 100%;
    }
}

@media (max-width: 1024px) {
    .nav-sidebar {
        position: fixed;
        left: 0;
        top: 70px;
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
        background: white;
    }

    .nav-sidebar.active {
        transform: translateX(0);
    }

    .question-container {
        padding: 1.5rem;
    }
}

@keyframes slideInQuestion {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.question-slide-active {
    animation: slideInQuestion 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
