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

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #f44336;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-light: #f5f7fa;
    --card-bg: rgba(255, 255, 255, 0.95);
    --border-radius: 20px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

#app {
    position: relative;
    min-height: 100vh;
}

/* === AUTHENTIFICATION === */
#auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.auth-container {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.game-logo {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.game-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.version-badge {
    font-size: 0.8rem;
    color: var(--warning);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.auth-form form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input, .auth-form select {
    padding: 0.8rem;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.toggle-auth {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.toggle-auth a {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    text-align: center;
}

#auth-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === ÉCRANS === */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    background: linear-gradient(180deg, #f5f7fa 0%, #e8eef5 100%);
    overflow-y: auto;
}

.screen.active {
    display: flex;
    transform: translateX(0);
}

/* === HEADER === */
.screen-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.screen-header h2 {
    flex: 1;
    font-size: 1.5rem;
    color: var(--primary);
}

.back-button, .add-button, .close-button {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.back-button:hover, .add-button:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

/* === HUD TOP === */
.hud-top {
    background: linear-gradient(180deg, white 0%, #f5f7fa 100%);
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.player-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.avatar-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 3px solid rgba(255,255,255,0.4);
}

.player-info {
    flex: 1;
}

.player-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.level-badge {
    display: flex;
    gap: 0.8rem;
    font-size: 0.9rem;
}

.rank-badge {
    background: rgba(255,255,255,0.3);
    padding: 0.2rem 0.8rem;
    border-radius: 15px;
    font-weight: 600;
}

.currency-quick {
    display: flex;
    gap: 1rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.currency-item {
    background: rgba(255,255,255,0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
}

/* === BARRES DE PROGRESSION === */
.energy-section, .progress-section {
    margin-bottom: 1rem;
}

.energy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.energy-bar-container {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.energy-progress {
    flex: 1;
    height: 28px;
    background: rgba(0,0,0,0.1);
    border-radius: 15px;
    overflow: hidden;
}

.energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    border-radius: 15px;
    width: 100%;
    transition: width 0.4s ease;
}

.progress-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-bar {
    background: white;
    padding: 0.8rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-bar label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-bg {
    height: 20px;
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.xp-bar {
    background: linear-gradient(90deg, #2196F3 0%, #1976D2 100%);
}

.streak-bar {
    background: linear-gradient(90deg, #FF9800 0%, #F57C00 100%);
}

.loyalty-bar {
    background: linear-gradient(90deg, #e74c3c 0%, #e91e63 100%);
}

.hunger-bar {
    background: linear-gradient(90deg, #ff9800 0%, #f57c00 100%);
}

/* === SECTIONS === */
.daily-quests-section, .active-quests-section {
    padding: 0 1rem 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    padding-bottom: 0.5rem;
}

.section-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.badge-small {
    font-size: 0.75rem;
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quests-daily-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.daily-quest-card {
    background: white;
    padding: 1rem;
    border-radius: 15px;
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.daily-quest-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.daily-quest-card.completed {
    opacity: 0.7;
    background: rgba(76, 175, 80, 0.05);
}

.quest-title-small {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.quest-xp-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.quests-preview {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.quest-preview {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* === QUÊTES === */
.quests-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.quest-item {
    background: white;
    padding: 1.2rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    border-left: 4px solid var(--primary);
}

.quest-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.quest-item.completed {
    opacity: 0.6;
    background: rgba(76, 175, 80, 0.08);
}

.quest-info h4 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.quest-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.quest-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.quest-category {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.quest-xp {
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.quest-actions {
    display: flex;
    gap: 0.8rem;
}

.complete-button, .delete-button {
    flex: 1;
    padding: 0.7rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.complete-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.complete-button:hover {
    transform: scale(1.02);
}

.delete-button {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger);
    border: 2px solid var(--danger);
}

.delete-button:hover {
    background: var(--danger);
    color: white;
}

/* === ONGLETS === */
.quest-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.tab-btn {
    background: transparent;
    border: 2px solid transparent;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

/* === COMPAGNON === */
.companion-container {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.companion-display {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.companion-large {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

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

.companion-stats h3 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.companion-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.companion-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.action-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

/* === MAGASIN === */
.shop-currency {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.currency-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}

/* === STATISTIQUES === */
.stats-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-card h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.big-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.achievements-section {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
}

.achievement-item {
    background: rgba(0,0,0,0.05);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    opacity: 0.6;
}

.achievement-item.unlocked {
    opacity: 1;
    background: rgba(255, 215, 0, 0.1);
}

.stats-by-category {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.category-stats {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.category-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.category-label {
    font-weight: 600;
}

.category-value {
    color: var(--primary);
    font-weight: 600;
}

.logout-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    opacity: 0.9;
}

/* === NAVIGATION INFÉRIEURE === */
.bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    padding: 0.8rem;
    background: white;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: auto;
}

.nav-button {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.8rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.nav-button:hover, .nav-button.active {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
    transform: scale(1.1);
}

/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

#add-quest-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

#add-quest-form input, #add-quest-form textarea, #add-quest-form select {
    padding: 0.8rem;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
}

#add-quest-form input:focus, #add-quest-form textarea:focus, #add-quest-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* === BOTONES === */
.primary-button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.primary-button:hover {
    transform: translateY(-2px);
}

/* === NOTIFICACIONES === */
.notification-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
}

.notification-toast.show {
    animation: toastSlide 3s ease-out forwards;
}

.notification-toast.error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.notification-toast.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
}

@keyframes toastSlide {
    0% { transform: translateX(-50%) translateY(100px); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(100px); opacity: 0; }
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
    .progress-section {
        grid-template-columns: 1fr;
    }

    .quests-daily-grid {
        grid-template-columns: 1fr;
    }

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

    .companion-actions {
        grid-template-columns: 1fr;
    }

    .game-logo {
        font-size: 2rem;
    }
}
