/* RAIsonance Pocket Screener Styles
   Palette, type, cards, forms, buttons and results are Field Screener's. */

/* Color Palette */
:root {
    --background: #ffffff;
    --primary-blue: #006BA6;
    --text-dark: #333333;
    --text-medium: #4D4D4D;
    --text-light: #666666;
    --card-bg: #f8f9fa;
    --bright-blue: #29ABE2;
    --mid-blue: #006BA6;
    --border-color: #ddd;
    --error-color: #dc3545;
    --success-color: #28a745;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Author display rules would otherwise win over the hidden attribute, and the content
   security policy rules out inline style attributes. */
[hidden] {
    display: none !important;
}

body {
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    color: var(--text-medium);
    background-color: var(--background);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

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

/* Page frame */
.screening-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

.screening-header {
    background: linear-gradient(135deg, var(--bright-blue) 0%, var(--primary-blue) 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.screening-header h1 {
    color: white;
    margin: 0;
    font-size: 1.125rem;
    text-align: center;
}

.header-logo {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 6px;
    padding: 0.125rem;
    flex-shrink: 0;
}

.screening-step {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

.step-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
}

.loading-card {
    text-align: center;
    padding: 4rem 2.5rem;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #f8d7da;
    color: var(--error-color);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid var(--error-color);
}

.success-message {
    background: #d4edda;
    color: var(--success-color);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid var(--success-color);
}

.info-message {
    background: #fff8e1;
    color: var(--text-dark);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border: 1px solid #ffc107;
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label,
.form-group legend {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 400;
    color: var(--text-dark);
}

fieldset.form-group {
    border: none;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    /* 16px or more, or iOS Safari zooms the page when a field takes focus. */
    font-size: 1rem;
    background: white;
    color: var(--text-dark);
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.form-group input.invalid {
    border-color: var(--error-color);
}

.field-hint {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.field-hint.invalid {
    color: var(--error-color);
}

.phone-row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.phone-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-dark);
    font-weight: 400;
    white-space: nowrap;
}

.modality-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.form-group .modality-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

.modality-option input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-blue);
}

.form-group .modality-option.selected {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.form-group .modality-option.unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Aligned to the top so the box sits on the first line when the label wraps. */
.form-group .checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.9375rem;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    margin-right: 0.75rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--mid-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 107, 166, 0.3);
}

.btn-primary:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-sign-in {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 0.5rem;
    border-radius: 25px;
}

.action-container {
    text-align: center;
}

/* Send status */
.status-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.status-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    color: var(--text-light);
    font-weight: 400;
}

.status-list li.active,
.status-list li.done {
    color: var(--text-dark);
}

.status-list li.failed {
    color: var(--error-color);
}

.status-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
}

.status-list li.active .status-icon {
    border-color: var(--card-bg);
    border-top-color: var(--primary-blue);
    animation: spin 1s linear infinite;
}

.status-list li.done .status-icon {
    border-color: var(--success-color);
    background: var(--success-color);
}

.status-list li.done .status-icon::after {
    content: '\2713';
}

.status-list li.failed .status-icon {
    border-color: var(--error-color);
    background: var(--error-color);
}

.status-list li.failed .status-icon::after {
    content: '\2715';
}

.qr-panel {
    text-align: center;
    margin-bottom: 1rem;
}

.qr-panel img {
    width: 220px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 0.5rem;
}

.short-url {
    font-size: 0.875rem;
    word-break: break-all;
}

/* Screener iFrame: the web component and nothing else */
.iframe-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 1000;
}

.iframe-container iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

/* Footer */
.footer {
    background: #ffffff;
    color: var(--text-medium);
    padding: 0.5rem 1rem;
    text-align: center;
    margin-top: auto;
}

.footer p {
    margin: 0.125rem 0;
    font-size: 0.75rem;
}

/* Results Page */
.main-content {
    flex: 1;
    padding: 2rem 1rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.results-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.loading-message {
    text-align: center;
    padding: 3rem 1rem;
}

.results-info {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.results-info strong {
    color: var(--text-dark);
    font-weight: 500;
}

.results-disclaimer {
    background: #fff8e1;
    border: 1px solid #ffc107;
    color: var(--text-dark);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.result-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.result-type {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-dark);
    flex: 1;
    margin-right: 1rem;
}

.result-box {
    padding: 1rem 2.5rem;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 500;
    color: white;
    text-align: center;
    min-width: 180px;
    white-space: nowrap;
}

.result-box-low-risk {
    background: var(--success-color);
}

.result-box-high-risk {
    background: var(--error-color);
}

.result-box-unknown {
    background: #c7c7c7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .step-card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .result-card {
        padding: 1rem;
    }

    .result-type {
        font-size: 1.125rem;
    }

    .result-box {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .screening-step {
        padding: 1rem 0.5rem;
    }

    .main-content {
        padding: 1rem 0.5rem;
    }

    .results-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .result-card {
        padding: 0.875rem 1rem;
    }

    .result-type {
        font-size: 1rem;
        margin-right: 0.5rem;
    }

    .result-box {
        padding: 0.75rem 1.25rem;
        font-size: 0.9375rem;
        min-width: 120px;
    }
}
