/* Styles PWA Sciences Autour de Nous - Style Duolingo */

:root {
    --primary: #58cc02;
    --primary-dark: #42a303;
    --secondary: #1cb0f6;
    --secondary-dark: #1899d6;
    --accent: #ff9600;
    --danger: #ff4b4b;
    --success: #58cc02;
    --background: #ffffff;
    --text: #3c3c3c;
    --text-light: #777777;
    --border: #e5e5e5;
    --card-bg: #f7f7f7;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.top-bar {
    background: var(--background);
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--primary);
}

.streak, .gems, .hearts {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    font-size: 14px;
}

.fire-icon { color: #ff9600; }
.gem-icon { color: #1cb0f6; }
.heart-icon { color: #ff4b4b; }

/* Main Content */
.main-content {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* Welcome Card */
.welcome-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.welcome-card h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.welcome-card p {
    font-size: 16px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.btn-primary {
    background: white;
    color: var(--primary-dark);
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 0 #e5e5e5;
    transition: all 0.2s;
}

.btn-primary:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* Skill Tree - Arbre de compétences */
.skill-tree {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.unit {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    border: 2px solid var(--border);
}

.unit.locked {
    opacity: 0.6;
}

.unit-header {
    margin-bottom: 16px;
}

.unit-number {
    color: var(--text-light);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.unit-header h3 {
    font-size: 18px;
    margin-top: 4px;
}

.lessons-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.lesson-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.node-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
    box-shadow: 0 6px 0 var(--primary-dark);
    transition: all 0.2s;
}

.lesson-node:active .node-circle {
    transform: translateY(6px);
    box-shadow: none;
}

.lesson-node.completed .node-circle {
    background: #ffd900;
    box-shadow: 0 6px 0 #e6c400;
}

.lesson-node.current .node-circle {
    background: var(--primary);
    animation: pulse 2s infinite;
}

.lesson-node.locked .node-circle {
    background: #ccc;
    box-shadow: 0 6px 0 #999;
}

.node-label {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Lesson Section */
.lesson-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    margin: -16px -16px 16px -16px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.progress-bar {
    flex: 1;
    height: 16px;
    background: var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 8px;
    transition: width 0.3s;
    width: 0%;
}

.question-container {
    padding: 20px 0;
}

/* Question styles */
.question-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.question-text {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

.answers-grid {
    display: grid;
    gap: 12px;
}

.answer-btn {
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.answer-btn:hover {
    background: var(--card-bg);
}

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

.answer-btn.wrong {
    background: #ffdede;
    border-color: var(--danger);
}

/* Feedback */
.feedback {
    position: fixed;
    bottom: 100px;
    left: 16px;
    right: 16px;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    font-weight: 700;
    z-index: 200;
    animation: slideUp 0.3s;
}

.feedback.correct {
    background: #d7ffb8;
    color: var(--primary-dark);
}

.feedback.wrong {
    background: #ffdede;
    color: var(--danger);
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Ranking */
.ranking-header {
    text-align: center;
    padding: 20px;
}

.league-badge {
    display: inline-block;
    background: linear-gradient(135deg, #cd7f32 0%, #e6a65c 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    margin-top: 12px;
}

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

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 12px;
}

.ranking-item.you {
    background: #d7ffb8;
    border: 2px solid var(--primary);
}

.rank {
    font-weight: 700;
    width: 40px;
    text-align: center;
}

.rank-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.rank-name {
    flex: 1;
    font-weight: 600;
}

.rank-xp {
    color: var(--text-light);
    font-size: 14px;
}

/* Profile */
.profile-header {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: white;
    border-radius: 16px;
    margin-bottom: 24px;
}

.profile-avatar {
    position: relative;
    display: inline-block;
    margin-bottom: 16px;
}

.profile-avatar img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
}

.btn-edit-avatar {
    position: absolute;
    bottom: 0;
    right: 0;
    background: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
}

.achievements {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
}

.achievements h3 {
    margin-bottom: 16px;
}

.achievement {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.achievement.locked {
    opacity: 0.5;
}

.achievement-icon {
    font-size: 24px;
}

/* Shop */
.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.shop-currency {
    background: var(--secondary);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-item:hover {
    background: var(--border);
}

.item-icon {
    font-size: 32px;
}

.item-name {
    flex: 1;
    font-weight: 600;
}

.item-price {
    color: var(--primary);
    font-weight: 700;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 12px;
    font-weight: 600;
}

.nav-main {
    position: relative;
    top: -20px;
}

.nav-lesson-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(88, 204, 2, 0.4);
    border: 4px solid white;
}

/* Responsive */
@media (min-width: 768px) {
    .main-content {
        padding: 24px;
    }
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.4s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.bounce {
    animation: bounce 0.4s;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}