/* LRF Resilience Toolkit Demo - Styles */

:root {
    --primary: #1a5f2a;
    --primary-dark: #0f3d19;
    --secondary: #2d8a4e;
    --accent: #f59e0b;
    --accent-secondary: #fbbf24;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding-bottom: 80px;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
    min-height: 100vh;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

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

.app-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
}

.user-stats {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
}

.level-badge {
    background: var(--accent);
    color: var(--primary-dark);
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
}

.xp-display {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 20px;
}

.readiness-indicator {
    background: rgba(255,255,255,0.15);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.readiness-indicator .label {
    opacity: 0.9;
}

.readiness-indicator .status {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.readiness-indicator .status.ready {
    background: #10b981;
    color: white;
}

.readiness-indicator .status.training {
    background: var(--warning);
    color: var(--primary-dark);
}

.readiness-indicator .status.not-ready {
    background: var(--danger);
    color: white;
}

/* Progress Section */
.progress-section {
    background: var(--card-bg);
    margin: 16px;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 8px;
}

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

.progress-fill {
    background: linear-gradient(90deg, var(--secondary) 0%, var(--primary) 100%);
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.modules-completed {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Badges Section */
.badges-section {
    background: var(--card-bg);
    margin: 0 16px 16px;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.badges-section h2 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text);
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.badge {
    text-align: center;
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    transition: transform 0.2s;
}

.badge.earned {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid var(--accent);
}

.badge.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.badge-icon {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 4px;
}

.badge-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Modules Section */
.modules-section {
    background: var(--card-bg);
    margin: 0 16px 16px;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.modules-section h2 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.modules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.module-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.module-card:hover {
    transform: translateX(4px);
    border-color: var(--secondary);
}

.module-card.completed {
    background: linear-gradient(90deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: var(--success);
}

.module-card.active {
    background: linear-gradient(90deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
    animation: pulse 2s infinite;
}

.module-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0); }
}

.module-status {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.module-card.completed .module-status {
    background: var(--success);
    color: white;
}

.module-card.active .module-status {
    background: #3b82f6;
    color: white;
}

.module-card.locked .module-status {
    background: var(--text-muted);
    color: white;
}

.module-info {
    flex: 1;
}

.module-info h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.module-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.module-xp {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(245, 158, 11, 0.15);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Challenge Section */
.challenge-section {
    margin: 0 16px 16px;
}

.challenge-card {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.challenge-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.challenge-icon {
    font-size: 1.4rem;
}

.challenge-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.challenge-text {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 12px;
}

.challenge-btn {
    background: white;
    color: #7c3aed;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
}

.challenge-btn:hover {
    transform: scale(1.02);
}

/* Leaderboard Section */
.leaderboard-section {
    background: var(--card-bg);
    margin: 0 16px 16px;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.leaderboard-section h2 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.leaderboard-row.highlight {
    background: linear-gradient(90deg, #dbeafe 0%, #bfdbfe 100%);
    border: 2px solid #3b82f6;
}

.leaderboard-row .rank {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    margin-right: 12px;
}

.leaderboard-row:nth-child(1) .rank {
    background: #fbbf24;
    color: var(--primary-dark);
}

.leaderboard-row:nth-child(2) .rank {
    background: #9ca3af;
    color: white;
}

.leaderboard-row:nth-child(3) .rank {
    background: #d97706;
    color: white;
}

.leaderboard-row .team {
    flex: 1;
    font-weight: 500;
}

.leaderboard-row .score {
    font-weight: 700;
    color: var(--primary);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Quiz Styles */
.quiz-container {
    margin-top: 16px;
}

.quiz-question {
    font-weight: 600;
    margin-bottom: 12px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-option {
    padding: 12px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-option:hover {
    border-color: var(--secondary);
    background: #d1fae5;
}

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

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

.quiz-option.wrong {
    border-color: var(--danger);
    background: #fee2e2;
}

.quiz-feedback {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.quiz-feedback.correct {
    background: #d1fae5;
    color: #065f46;
}

.quiz-feedback.wrong {
    background: #fee2e2;
    color: #991b1b;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1rem;
    }
    
    .badges-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .badge {
        padding: 8px 4px;
    }
    
    .badge-icon {
        font-size: 1.4rem;
    }
}
