* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f5f7;
    color: #222;
    line-height: 1.6;
}

/* Auth Pages Styling */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.auth-box h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: #2563eb;
    text-align: center;
}

.auth-box h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.switch-form {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.switch-form a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.switch-form a:hover {
    text-decoration: underline;
}

/* Survey Page Styling */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
}

.survey-header {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.survey-header h1 {
    font-size: 1.8rem;
    color: #2563eb;
}

.header-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 240px;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.header-actions .btn,
.header-actions .logout-btn {
    width: auto;
}

@media (max-width: 640px) {
    .survey-header {
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.user-info {
    font-size: 0.95rem;
    color: #666;
}

.logout-btn {
    background: #ef4444;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 15px;
    text-decoration: none;
}

.logout-btn:hover {
    background: #dc2626;
}

.question {
    background: #fff;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0 1.1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.3s;
}

.question.unanswered {
    background: #fef3c7;
    border: 2px solid #f59e0b;
}

.question.error {
    background: #fee2e2;
    border: 2px solid #ef4444;
}

.question label.question-text {
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.question-code {
    color: #6b7280;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.option-label {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    width: 100%;
}

.option-label:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Selected state styling using :has selector */
.option-label:has(input:checked) {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 1px #2563eb;
}

.option-label input[type="radio"] {
    margin-right: 12px;
    margin-top: 3px;
    /* Align with first line of text */
    width: 20px;
    height: 20px;
    accent-color: #2563eb;
    flex-shrink: 0;
}

.option-text {
    font-size: 1rem;
    color: #334155;
    line-height: 1.5;
    font-weight: 500;
}

/* Mobile responsiveness improvements */
@media (max-width: 640px) {
    .option-label {
        padding: 14px;
    }

    .option-text {
        font-size: 0.95rem;
    }
}

.text-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
    color: #334155;
    background: #fff;
}

.text-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    width: 100%;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
}

textarea:focus {
    outline: none;
    border-color: #2563eb;
}

h2,
h3,
h4,
h5,
h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    color: #1e40af;
}

h3 {
    font-size: 1.25rem;
    color: #1e3a8a;
}

h4 {
    font-size: 1.1rem;
    color: #1e293b;
}

h5,
h6 {
    font-size: 1rem;
    font-weight: 600;
}

.heading-with-info {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.info-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    border: 1px solid #4f46e5;
    font-size: 0.7rem;
    cursor: pointer;
    color: #4f46e5;
    user-select: none;
}

.info-icon:hover {
    background: #eef2ff;
}

.info-text {
    margin-top: 0.35rem;
    margin-bottom: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    background: #eef2ff;
    font-size: 0.9rem;
    display: none;
}

.submit-section {
    text-align: center;
    margin: 30px 0;
}

.status {
    font-size: 0.95rem;
    margin: 0.5rem 0 1rem;
    color: #555;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
}

.status.success {
    background: #d1fae5;
    color: #065f46;
}

.status.error {
    background: #fee2e2;
    color: #991b1b;
}

.validation-message {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

/* Progress Indicator */
.progress-container {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.progress-bar {
    background: #e5e7eb;
    height: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
    height: 100%;
    transition: width 0.4s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.autosave-status {
    margin: -5px 0 14px;
    font-size: 0.95rem;
    color: #475569;
    font-weight: 600;
}

.autosave-status.saving {
    color: #2563eb;
}

.autosave-status.saved {
    color: #15803d;
}

.autosave-status.error {
    color: #b91c1c;
}

/* Section Headers */
.section-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #cbd5e1 50%, transparent 100%);
    margin: 30px 0 20px;
}

.section-header {
    margin: 15px 0;
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.3s;
}

.section-header.level-1 {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid #2563eb;
    padding: 15px 20px;
    margin: 20px 0;
}

.section-header.level-1 h2 {
    margin: 0;
    color: #1e40af;
    font-size: 1.6rem;
}

.section-header.level-2 {
    background: #f1f5f9;
    border-left: 3px solid #3b82f6;
    padding: 12px 18px;
}

.section-header.level-2 h3 {
    margin: 0;
    color: #1e3a8a;
    font-size: 1.3rem;
}

.section-header.level-3 {
    background: #f8fafc;
    border-left: 3px solid #64748b;
    padding: 10px 15px;
}

.section-header.level-3 h4 {
    margin: 0;
    color: #1e293b;
    font-size: 1.15rem;
}

.section-header.level-4 {
    background: #fafafa;
    border-left: 2px solid #94a3b8;
    padding: 8px 12px;
    position: relative;
}

.section-header.level-4 h5 {
    margin: 0;
    color: #334155;
    font-size: 1.05rem;
    display: inline-block;
}

.section-header.level-5 {
    background: #fcfcfc;
    padding: 6px 10px;
    margin-left: 10px;
}

.section-header.level-5 h6 {
    margin: 0;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 600;
}

.header-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.header-title-row h2,
.header-title-row h3,
.header-title-row h4,
.header-title-row h5,
.header-title-row h6 {
    margin: 0;
    padding: 0;
    color: #2c3e50;
    line-height: 1.2;
}

.info-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    color: #3498db;
    cursor: pointer;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.info-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.info-icon:hover {
    color: #2563eb;
    background: #eff6ff;
    transform: scale(1.1);
}

.info-text {
    display: none;
    margin-top: 10px;
    padding: 12px 16px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #3730a3;
    line-height: 1.5;
    width: 100%;
}