:root {
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;

    --color-primary: #2c5aa0;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-text: #374151;
    --color-text-light: #6b7280;
    --color-bg: #ffffff;
    --color-border: #e5e7eb;
}

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

html {
    overscroll-behavior: contain;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: clamp(16px, 2.8vw, 18px);
    line-height: 1.5;
    color: var(--color-text);
    background: linear-gradient(135deg, #e8f4f8 0%, #d1e7dd 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: var(--space-lg);
    gap: var(--space-xl);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.hero-container {
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 100%;
    max-width: 75rem;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xl);
    gap: var(--space-xl);
}

.hero-text {
    width: 100%;
}

.hero-illustration {
    width: 100%;
    max-width: 50rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
}

.doctor-patient-illustration {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    border: none;
    border-radius: 0;
    position: relative;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    width: 100%;
    max-width: 75rem;
}

/* Results Section */
.results-section {
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.1);
    padding: var(--space-xl);
}

.section-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-xl);
    line-height: 1.2;
}

.result-card {
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    color: white;
    min-height: 6rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.safe-card {
    background: var(--color-success);
}

.warning-card {
    background: var(--color-warning);
}

.result-card h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    margin-bottom: var(--space-sm);
    line-height: 1.2;
}

.result-card p {
    font-size: clamp(0.875rem, 2vw, 1rem);
    line-height: 1.4;
    opacity: 0.9;
    max-width: 50ch;
}

.doctor-signature {
    text-align: right;
    margin-top: var(--space-lg);
    font-style: italic;
    color: var(--color-text-light);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
}

/* Review Section */
.review-section {
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.1);
    padding: var(--space-xl);
}

.review-logo {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--space-lg);
}

.review-header h3 {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    color: var(--color-text);
    margin-bottom: var(--space-xl);
    font-weight: 500;
    line-height: 1.4;
    max-width: 50ch;
}

.review-form {
    margin-bottom: var(--space-xl);
}

.comment-section {
    margin-bottom: var(--space-xl);
}

.comment-input {
    width: 100%;
    min-height: 5rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    font-family: inherit;
    font-size: clamp(0.875rem, 2vw, 1rem);
    resize: vertical;
    transition: border-color 0.2s ease;
    line-height: 1.4;
}

.comment-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.opinion-selection {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.radio-option {
    cursor: pointer;
}

.radio-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Unified Radio Button Base Style */
.radio-button {
    width: 100%;
    min-height: 2.75rem;
    /* 44px touch target */
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    border: 2px solid;
    font-weight: 600;
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    position: relative;
    background: white;
}

.radio-icon {
    font-weight: bold;
    font-size: 1.1em;
}

/* Agree Option - Green Theme */
.btn-agree {
    color: #10b981;
    border-color: #10b981;
}

.radio-input:checked+.btn-agree {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(16, 185, 129, 0.3);
}

.radio-input:focus-visible+.btn-agree {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* Disagree Option - Red Theme */
.btn-disagree {
    color: #ef4444;
    border-color: #ef4444;
}

.radio-input:checked+.btn-disagree {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(239, 68, 68, 0.3);
}

.radio-input:focus-visible+.btn-disagree {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

/* Submit Button - Blue Theme */
.btn-submit {
    width: 100%;
    min-height: 2.75rem;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    border: 2px solid var(--color-primary);
    font-weight: 600;
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, var(--color-primary) 0%, #4a90c2 100%);
    color: white;
}

.btn-submit:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-submit:active,
.btn-submit.is-active {
    transform: translateY(1px);
    box-shadow: 0 0.125rem 0.5rem rgba(44, 90, 160, 0.4);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #9ca3af;
    border-color: #9ca3af;
}

@media (hover: hover) {
    .radio-button:hover {
        transform: translateY(-1px);
        box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.15);
    }

    .radio-input:checked+.btn-agree:hover {
        transform: translateY(-3px);
        box-shadow: 0 0.75rem 2rem rgba(16, 185, 129, 0.4);
    }

    .radio-input:checked+.btn-disagree:hover {
        transform: translateY(-3px);
        box-shadow: 0 0.75rem 2rem rgba(239, 68, 68, 0.4);
    }

    .btn-submit:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 0.5rem 1.5rem rgba(44, 90, 160, 0.3);
    }
}

.submit-section {
    margin-top: var(--space-xl);
    text-align: center;
}

.submit-icon {
    font-size: 1.2em;
    transition: transform 0.2s ease;
}

@media (hover: hover) {
    .btn-submit:hover .submit-icon {
        transform: translateX(3px);
    }
}

.review-footer h4 {
    font-size: clamp(1.125rem, 2.5vw, 1.25rem);
    color: var(--color-primary);
    margin-bottom: var(--space-lg);
}

.doctors-illustration {
    width: 100%;
    height: 7.5rem;
    background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%);
    border-radius: var(--radius-md);
    aspect-ratio: 2/1;
}

.logo {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--space-lg);
}

.main-title {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
    margin-bottom: var(--space-lg);
    max-width: 45ch;
}

.subtitle {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    color: var(--color-text-light);
    margin-bottom: var(--space-xl);
    font-weight: 400;
    line-height: 1.4;
    max-width: 60ch;
}

.upload-btn {
    background: #4a90c2;
    color: white;
    border: none;
    padding: var(--space-lg) var(--space-2xl);
    min-height: 2.75rem;
    /* 44px minimum touch target */
    min-width: 2.75rem;
    border-radius: var(--radius-md);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0.25rem 1.25rem rgba(74, 144, 194, 0.3);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.upload-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.upload-btn:active,
.upload-btn.is-active {
    background: #3a7ca8;
    transform: translateY(1px);
    box-shadow: 0 0.125rem 0.5rem rgba(74, 144, 194, 0.4);
}

@media (hover: hover) {
    .upload-btn:hover {
        background: #3a7ca8;
        transform: translateY(-2px);
        box-shadow: 0 0.375rem 1.5rem rgba(74, 144, 194, 0.4);
    }
}

.illustration {
    flex: 1;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 300"><rect fill="%23e8f4f8" width="500" height="300"/><circle fill="%234a90c2" cx="150" cy="150" r="60"/><circle fill="%236b7280" cx="350" cy="120" r="40"/><rect fill="%23ffffff" x="250" y="100" width="80" height="100" rx="10"/></svg>') center/cover;
    min-height: 200px;
    position: relative;
}

.illustration::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(74, 144, 194, 0.1), rgba(209, 231, 221, 0.1));
}

.top-nav {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: 100;
}

.nav-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.8;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.nav-link:hover {
    opacity: 1;
    color: var(--color-primary);
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.about-link {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.2);
}

.about-link:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.admin-link {
    background: rgba(44, 90, 160, 0.1);
    color: var(--color-primary);
    border-color: rgba(44, 90, 160, 0.2);
}

.admin-link:hover {
    background: rgba(44, 90, 160, 0.15);
    color: var(--color-primary);
}

/* Mobile responsiveness for top navigation */
@media (max-width: 768px) {
    .top-nav {
        top: 10px;
        right: 10px;
        gap: 8px;
    }

    .nav-link {
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

.modal.show {
    display: block !important;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    width: 95%;
    max-width: 31.25rem;
    /* 500px */
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.3);

    /* Safe area support for notched devices */
    padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom));
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c5aa0;
    margin-bottom: 10px;
}

.modal-subtitle {
    color: #6b7280;
    font-size: 14px;
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    margin: 20px 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #4a90c2;
    background: #f8fafc;
}

.upload-area.dragover {
    border-color: #4a90c2;
    background: #eff6ff;
}

.upload-icon {
    font-size: 48px;
    color: #6b7280;
    margin-bottom: 16px;
}

.upload-text {
    color: #6b7280;
    margin-bottom: 8px;
}

.upload-hint {
    color: #9ca3af;
    font-size: 12px;
}

.file-input {
    display: none;
}

.file-list {
    margin: 20px 0;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.file-name {
    color: #374151;
    font-weight: 500;
}

.file-remove {
    color: #ef4444;
    cursor: pointer;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.btn {
    flex: 1;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #4a90c2;
    color: white;
}

.btn-primary:hover {
    background: #3a7ba8;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
}

.form-input {
    width: 100%;
    min-height: 2.75rem;
    /* 44px touch target */
    padding: var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    /* Prevent zoom on iOS */
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

/* Note: Input attributes like inputmode, accept, and capture should be set in HTML, not CSS */

/* Desktop breakpoint - two column layout */
@media (min-width: 56.25rem) {

    /* 900px */
    body {
        padding: var(--space-2xl) var(--space-3xl);
    }

    .hero-content {
        flex-direction: row;
        text-align: left;
        align-items: center;
    }

    .hero-text {
        flex: 1;
        padding-right: var(--space-xl);
    }

    .hero-illustration {
        flex: 1;
        max-width: 50rem;
    }

    .main-content {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-3xl);
    }

    .action-buttons {
        flex-direction: row;
    }
}

/* Large screens */
@media (min-width: 75rem) {

    /* 1200px */
    body {
        padding: var(--space-3xl) var(--space-3xl);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .result-card {
        border: 2px solid white;
    }

    .upload-btn,
    .btn-agree,
    .btn-disagree {
        border-width: 3px;
    }
}

/* Success Modal Styles */
.success-message {
    text-align: center;
    padding: 30px 20px;
}

.success-icon {
    color: #10b981;
    margin-bottom: 20px;
}

.success-message h3 {
    color: #10b981;
    font-size: 24px;
    margin-bottom: 15px;
}

.success-message p {
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.5;
}

.redirect-countdown {
    margin-top: 25px;
    padding: 15px;
    background: #f3f4f6;
    border-radius: 8px;
}

.redirect-countdown p {
    margin: 0;
    font-weight: 500;
    color: #374151;
}

#countdown {
    color: #10b981;
    font-weight: bold;
}

/* Review Success Modal */
.review-actions {
    margin-top: var(--space-xl);
    text-align: center;
}

.btn-close-review {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-2xl);
    min-height: 2.75rem;
    border-radius: var(--radius-md);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 8rem;
}

.btn-close-review:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-close-review:active {
    transform: translateY(1px);
}

@media (hover: hover) {
    .btn-close-review:hover {
        background: #1e4a7a;
    }
}