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

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --primary: #1B72E8;
    --primary-dark: #155FC4;
    --primary-light: #EAF2FD;
    --green: #22C97A;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #16a34a;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f4f7fb;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 2px 12px rgba(0,0,0,0.07);
    --radius: 12px;
}

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

/* ===== Header ===== */
header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* ===== Logo ===== */
.logo {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    text-decoration: none;
}

.logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-lines {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 2px;
}

.logo-lines span {
    display: block;
    height: 5px;
    border-radius: 3px;
    background: var(--green);
}

.logo-lines span:nth-child(1) { width: 34px; }
.logo-lines span:nth-child(2) { width: 27px; }
.logo-lines span:nth-child(3) { width: 20px; }

.logo-wordmark {
    font-family: 'Nunito', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
    line-height: 1;
}

.logo-underline {
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    margin-top: 5px;
}

/* ===== Container ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* ===== Disclaimer Banner ===== */
.disclaimer-banner {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.disclaimer-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.disclaimer-banner p {
    font-size: 0.9rem;
    color: #78350f;
}

/* ===== Alert ===== */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: var(--danger);
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: var(--success);
}

/* ===== Card ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.card-description {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
}

/* ===== Upload Area ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: all 0.2s;
    background: var(--bg);
    margin-bottom: 1.25rem;
    position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
}

.upload-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.preview-container {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

#image-preview {
    max-height: 300px;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    object-fit: contain;
}

.remove-btn {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.375rem 0.875rem;
    cursor: pointer;
    font-size: 0.85rem;
    z-index: 3;
    position: relative;
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0.25rem 0 1.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 0.86rem;
    line-height: 1.45;
    cursor: pointer;
}

.consent-check input {
    width: 1rem;
    height: 1rem;
    margin-top: 0.12rem;
    flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--primary-light);
}

.btn-small {
    padding: 0.375rem 0.875rem;
    font-size: 0.85rem;
}

.btn-icon {
    font-size: 1.1rem;
}

/* ===== How It Works ===== */
.how-it-works {
    margin-bottom: 1.5rem;
}

.how-it-works h2 {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 1rem;
    text-align: center;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.step {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--green);
}

.step-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.step h3 {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 0.375rem;
    font-weight: 700;
}

.step p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ===== Supported Exams ===== */
.exam-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tag {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 0.3rem 0.875rem;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ===== Result Page ===== */
.result-meta {
    margin-bottom: 1.5rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.status-ok {
    color: var(--success);
}

.user-description {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.user-description p {
    color: var(--text);
    font-style: italic;
    margin-top: 0.25rem;
}

/* ===== Report Card ===== */
.report-card {
    border-left: 4px solid var(--primary);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.report-header h2 {
    margin-bottom: 0;
}

.report-actions {
    display: flex;
    gap: 0.5rem;
}

.report-content {
    line-height: 1.75;
    color: var(--text);
    white-space: pre-wrap;
}

.report-content h2,
.report-content h3,
.report-content h4 {
    color: var(--primary);
    margin: 1.25rem 0 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.25rem;
}

.report-content ul,
.report-content ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.report-content li {
    margin-bottom: 0.25rem;
}

.report-content p {
    margin: 0.5rem 0;
}

.report-content strong {
    color: var(--text);
}

/* ===== Result Layout (side by side) ===== */
.result-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.exam-image-card h2 {
    margin-bottom: 1rem;
}

.exam-image-wrapper {
    background: #0a0a0a;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.exam-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

@media (max-width: 860px) {
    .result-layout {
        grid-template-columns: 1fr;
    }
    .exam-image-wrapper {
        max-height: 340px;
    }
    .exam-image {
        max-height: 340px;
        width: auto;
        margin: 0 auto;
    }
}

/* ===== Result Actions ===== */
.result-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.loading-content {
    background: white;
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.25rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-weight: 700;
}

.loading-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Footer ===== */
footer {
    background: #ffffff;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    text-align: center;
    padding: 1.25rem;
    font-size: 0.85rem;
}

.footer-warning {
    color: #94a3b8;
    font-size: 0.78rem;
    margin-top: 0.25rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

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

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

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