/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --error-color: #dc2626;
    --warning-color: #f59e0b;
    --background: #f1f5f9;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Screen management */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

.btn-secondary {
    background: var(--card-background);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-back:hover {
    color: var(--text-primary);
}

/* Login Screen */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 60px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 3rem;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -1px;
}

.logo .tagline {
    display: block;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: -5px;
}

.login-container h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

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

#login-form .btn {
    width: 100%;
    margin-top: 16px;
}

/* Header */
.header {
    background: var(--card-background);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

#user-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.welcome-section {
    margin-bottom: 32px;
}

.welcome-section h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.welcome-section p {
    color: var(--text-secondary);
}

/* Progress Overview */
.progress-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.progress-card {
    background: var(--card-background);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-icon {
    font-size: 2.5rem;
}

.progress-info {
    flex: 1;
}

.progress-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.progress-bar-container {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Modules Section */
.modules-section {
    margin-bottom: 40px;
}

.modules-section h3 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.module-card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

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

.module-card.completed {
    border-color: var(--success-color);
}

.module-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.module-icon {
    font-size: 2rem;
}

.module-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.module-status.not-started {
    background: var(--border-color);
    color: var(--text-secondary);
}

.module-status.in-progress {
    background: #fef3c7;
    color: #92400e;
}

.module-status.completed {
    background: #dcfce7;
    color: #166534;
}

.module-card h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.module-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.module-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Certifications Section */
.certifications-section h3 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.certifications-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.certification-item {
    background: var(--card-background);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.certification-item.earned {
    border-left: 4px solid var(--success-color);
}

.certification-item.not-earned {
    opacity: 0.5;
}

.cert-icon {
    font-size: 2rem;
}

.cert-info h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.cert-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Module Screen */
#module-screen .header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
}

#module-screen .header h1 {
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.module-progress {
    color: var(--text-secondary);
    font-weight: 500;
}

.module-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Theory Section */
.theory-card {
    background: var(--card-background);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.theory-card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.theory-text {
    line-height: 1.8;
    margin-bottom: 24px;
}

.theory-text h3 {
    font-size: 1.1rem;
    margin: 24px 0 12px;
    color: var(--text-primary);
}

.theory-text ul {
    margin: 12px 0;
    padding-left: 24px;
}

.theory-text li {
    margin-bottom: 8px;
}

.theory-text .highlight {
    background: #fef3c7;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--warning-color);
    margin: 16px 0;
}

.theory-text .important {
    background: #fee2e2;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--error-color);
    margin: 16px 0;
}

/* Quiz Section */
.quiz-card {
    background: var(--card-background);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.scenario-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.scenario-text {
    font-size: 1rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-style: italic;
}

.question-text {
    font-size: 1.25rem;
    margin-bottom: 24px;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    padding: 16px 20px;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    text-align: left;
}

.answer-option:hover:not(.disabled) {
    border-color: var(--primary-color);
    background: white;
}

.answer-option.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.answer-option.correct {
    border-color: var(--success-color);
    background: #dcfce7;
}

.answer-option.incorrect {
    border-color: var(--error-color);
    background: #fee2e2;
}

.answer-option.disabled {
    cursor: default;
    opacity: 0.7;
}

.answer-option.show-correct {
    border-color: var(--success-color);
    background: #dcfce7;
}

/* Feedback */
.feedback-container {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

#feedback-content {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

#feedback-content.correct {
    background: #dcfce7;
    border-left: 4px solid var(--success-color);
}

#feedback-content.incorrect {
    background: #fee2e2;
    border-left: 4px solid var(--error-color);
}

#feedback-content h4 {
    margin-bottom: 8px;
}

/* Results Section */
.results-card {
    background: var(--card-background);
    padding: 48px 32px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.results-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.results-card h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.results-card > p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 32px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.certification-badge {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 20px 32px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    border: 2px solid #f59e0b;
}

.badge-icon {
    font-size: 2rem;
}

.certification-badge span {
    font-weight: 700;
    color: #92400e;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .dashboard-content {
        padding: 20px 16px;
    }

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

    .progress-overview {
        grid-template-columns: 1fr;
    }

    .results-stats {
        gap: 24px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    #module-screen .header {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 8px;
    }

    .btn-back {
        justify-self: start;
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}
