/* style.css */
:root {
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --bg-color: #f4f7f6;
    --text-main: #333333;
    --text-muted: #666666;
    --white: #ffffff;
    --red: #e74c3c;
    --green: #2ecc71;
    --orange: #f39c12;
    --border-color: #dddddd;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.screen {
    background: var(--white);
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 30px 20px;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* BRANDING */
.branding {
    text-align: center;
    margin-bottom: 25px;
    margin-top: 25px;
}

.profile-img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid var(--border-color);
}

.branding h1 {
    font-size: 1.2rem;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.verified-icon {
    color: #1da1f2;
    font-size: 1rem;
}

.branding .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* TYPOGRAPHY & FORMS */
.app-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

input[type="text"], input[type="number"] {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.3s;
}

input[type="text"]:focus, input[type="number"]:focus {
    border-color: var(--primary-color);
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--text-muted);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #555555;
}

.error-msg {
    color: var(--red);
    text-align: center;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* QUIZ SCREEN */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.timer {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--red);
}

.counter {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.quiz-body {
    text-align: center;
}

.question {
    font-size: 6rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 20px 0 40px 0;
    line-height: 1;
}

.input-group {
    max-width: 300px;
    margin: 0 auto;
}

/* RESULT SCREEN & PDF WRAPPER */
.pdf-wrapper {
    position: relative;
    padding: 20px;
    background: var(--white);
}

.pdf-only-header {
    display: none;
    text-align: center;
    font-size: 1.02rem;
    color: var(--text-main);
    margin: 0 0 20px;
}

.pdf-only-footer-btn {
    display: none;
    text-align: center;
    text-decoration: none;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 15px 16px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-style: normal;
    font-weight: 600;
    margin-top: 10px;
}

.watermark {
    position: absolute !important;
    top: 300px;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 500px;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.pdf-wrapper > * {
    position: relative;
    z-index: 1;
}

.report-title {
    text-align: center;
    font-size: 1.4rem;
    text-transform: uppercase;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.data-table {
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.95rem;
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    font-weight: 600;
    color: var(--text-muted);
}

.data-value {
    font-weight: 700;
}

/* PROGRESS BARS */
.progress-section {
    margin-bottom: 25px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.mt-2 {
    margin-top: 15px;
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background-color: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

.red-bar { background-color: var(--red); }
.green-bar { background-color: var(--green); }

.classification-box {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    background: rgb(228, 228, 228);
    border: 3px solid rgb(135, 135, 135);
}

.color-red { color: var(--red); }
.color-orange { color: var(--orange); }
.color-green { color: var(--green); }

.reference-scale {
    font-size: 0.85rem;
    margin-bottom: 25px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.1);
    padding: 15px;
    border-radius: 8px;
}

.reference-scale h3 {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.reference-scale ul {
    list-style: none;
}

.reference-scale li {
    margin-bottom: 4px;
}

.quote-box {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    text-align: left;
    font-style: normal;
    font-size: 0.95rem;
    padding: 20px;
    background: #eef2f5;
    border-left: 4px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    margin: 0 auto 25px;
    max-width: 540px;
}

.quote-side-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    flex-shrink: 0;
}

.quote-content {
    flex: 1;
}

.quote-box p {
    font-size: 1.08rem;
    line-height: 1.5;
    font-style: italic;
    margin: 0;
}

.quote-author {
    margin-top: 10px;
    font-style: normal;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cta-box {
    background-color: var(--red);
    color: var(--white);
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    font-style: normal;
    padding: 12px 18px 16px;
    font-weight: 700;
    border-radius: 8px;
    font-size: 0.95rem;
    margin-top: 6px;
    width: 100%;
    flex-basis: 100%;
    cursor: pointer;
    animation: pulse 2s infinite;
}

@media (max-width: 520px) {
    .quote-box {
        flex-direction: column;
        text-align: center;
    }

    .quote-content {
        width: 100%;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.action-buttons .btn-primary,
.action-buttons .btn-secondary {
    width: auto;
    min-width: 132px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* Result page padding fix */
#result-screen {
    padding-top: 5px; /* Tighter top padding for general card */
}

#pdf-content {
    padding-top: 0;
}

/* Prevent vertical centering from introducing large top whitespace in PDF capture. */
body.pdf-exporting {
    display: block;
    min-height: auto;
    padding: 0;
}

body.pdf-exporting #result-screen {
    display: block;
    max-width: none;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    background: var(--white);
}

body.pdf-exporting #pdf-content {
    margin: 0;
    padding-top: 0;
}

body.pdf-exporting .pdf-only-header {
    display: block;
    margin-bottom: 18px;
}

body.pdf-exporting .quote-box {
    display: none !important;
}

body.pdf-exporting .pdf-only-footer-btn {
    display: block;
}

#pdf-content.pdf-exporting .pdf-only-header {
    display: block;
    margin-bottom: 18px;
}

#pdf-content.pdf-exporting .quote-box {
    display: none !important;
}

#pdf-content.pdf-exporting .pdf-only-footer-btn {
    display: block;
}

/* MEDIA QUERIES */
@media (min-width: 480px) {
    .action-buttons {
        flex-direction: row;
        justify-content: center;
    }
    .question {
        font-size: 8rem;
    }
}