
/* Modern Split-Screen Questionnaire Design */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --radius-lg: 16px;
}

[id^="questionnaire-app-"] {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-secondary);
    min-height: 100vh;
}

.questionnaire-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    min-height: 700px;
    position: relative;
}

/* Sidebar */
.questionnaire-sidebar {
    width: 400px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 32px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.sidebar-header {
    margin-bottom: 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.brand-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.questionnaire-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 0 0 12px 0;
}

.questionnaire-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.progress-section {
    flex: 1;
}

.overall-progress {
    margin-bottom: 32px;
}

.progress-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-percentage {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.topic-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.topic-item.active {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #fefbff 0%, #f0f4ff 100%);
}

.topic-item.completed {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-color: var(--success);
}

.topic-indicator {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 4px;
}

.topic-item .topic-indicator {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.topic-item.active .topic-indicator {
    background: var(--primary);
    color: white;
}

.topic-item.completed .topic-indicator {
    background: var(--success);
    color: white;
}

.topic-content {
    flex: 1;
    min-width: 0;
}

.topic-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.topic-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0 0 12px 0;
}

.topic-progress {
    margin-top: 8px;
}

.topic-progress-bar {
    height: 4px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.topic-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* Main Content */
.questionnaire-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.question-container {
    flex: 1;
    padding: 48px;
    display: flex;
    flex-direction: column;
}

.question-header {
    margin-bottom: 40px;
}

.question-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: block;
}

.question-text {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
}

.question-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.text-input-container {
    max-width: 600px;
}

.text-input {
    width: 100%;
    padding: 20px 24px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
    background: var(--bg-primary);
}

.text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 600px;
}

.answer-card {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.answer-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.answer-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #fefbff 0%, #f0f4ff 100%);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.answer-content {
    flex: 1;
}

.answer-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.answer-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.answer-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.answer-card.selected .answer-indicator {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Navigation Footer */
.navigation-footer {
    padding: 32px 48px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-button {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-button:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.nav-button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.nav-button.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Results Screen */
.results-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: linear-gradient(135deg, #fefbff 0%, #f0f4ff 100%);
}

.results-content {
    text-align: center;
    max-width: 500px;
}

.results-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 32px;
    animation: scaleIn 0.6s ease-out;
}

@keyframes scaleIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.results-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 24px 0;
}

.score-display {
    font-size: 64px;
    font-weight: 800;
    margin: 24px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.score-number {
    color: var(--primary);
}

.score-divider {
    color: var(--text-muted);
}

.score-total {
    color: var(--text-secondary);
}

.results-message {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 32px 0;
}

.restart-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.restart-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Loading and Error States */
.questionnaire-container.loading,
.questionnaire-container.error {
    justify-content: center;
    align-items: center;
}

.loading-content,
.error-content {
    text-align: center;
    padding: 48px;
}

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

.loading-spinner.small {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

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

.error-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.error-content p {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0 0 24px 0;
}

.retry-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-button:hover {
    background: var(--primary-dark);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .questionnaire-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .questionnaire-sidebar {
        width: 100%;
        padding: 24px;
    }
    
    .topics-list {
        flex-direction: row;
        overflow-x: auto;
        gap: 12px;
        padding-bottom: 8px;
    }
    
    .topic-item {
        min-width: 250px;
        padding: 16px;
    }
    
    .question-container {
        padding: 32px 24px;
    }
    
    .question-text {
        font-size: 24px;
    }
    
    .navigation-footer {
        padding: 24px;
        flex-direction: column;
        gap: 16px;
    }
    
    .nav-button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    [id^="questionnaire-app-"] {
        padding: 12px;
    }
    
    .questionnaire-sidebar {
        padding: 20px;
    }
    
    .question-container {
        padding: 24px 20px;
    }
    
    .question-text {
        font-size: 20px;
    }
    
    .answer-card {
        padding: 20px;
    }
    
    .answer-text {
        font-size: 16px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border: #000;
        --text-secondary: #000;
    }
}
