:root {
    --bg-color: #050510;
    --accent-color: #bb86fc;
    --phase-full: #ffcc33;
    --phase-new: #6366f1;
    --phase-first: #00d2ff;
    --phase-last: #f43f5e;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(45, 25, 80, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(20, 40, 90, 0.4) 0%, transparent 40%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Star background effect */
.stars {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: url('https://www.transparenttextures.com/patterns/stardust.png');
    opacity: 0.3;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 4rem;
}

.moon-display {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
}

.moon-engine {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background-color: #111;
    box-shadow: inset -10px -10px 50px rgba(0,0,0,1), 0 0 50px rgba(187, 134, 252, 0.2);
    overflow: hidden;
    transition: all 0.5s ease;
}

/* Texture lunaire */
.moon-engine::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('https://www.transparenttextures.com/patterns/p6.png');
    opacity: 0.4;
    mix-blend-mode: overlay;
}

.moon-light {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #f0f0f5;
    border-radius: 50%;
    transition: all 0.5s ease;
}

.moon-shadow {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #050510;
    border-radius: 50%;
    transition: all 0.5s ease;
}

.moon-image-container {
    width: 350px;
    height: 350px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: pulse 4s infinite ease-in-out;
}

.moon-info-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
}

.date-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(187, 134, 252, 0.15);
    border-radius: 100px;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

.phase-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.stat-item {
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 600;
}

.calendar-section {
    margin-top: 4rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.controls {
    display: flex;
    gap: 1rem;
}

select, button {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    outline: none;
    font-size: 1rem;
}

select option {
    background-color: #1a1a2e;
    color: white;
}

button:hover {
    background: rgba(255,255,255,0.1);
}

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

.day-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.2rem;
    border-radius: 18px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.day-card:hover {
    transform: translateY(-5px);
    background: rgba(255,255,255,0.08);
    border-color: var(--accent-color);
}

.day-card.is-phase {
    border-color: var(--accent-color);
    background: rgba(187, 134, 252, 0.05);
}

.day-card.phase-full { border-color: var(--phase-full); background: rgba(255, 204, 51, 0.08); box-shadow: 0 0 15px rgba(255, 204, 51, 0.15); }
.day-card.phase-new { border-color: var(--phase-new); background: rgba(99, 102, 241, 0.08); }
.day-card.phase-first { border-color: var(--phase-first); background: rgba(0, 210, 255, 0.08); }
.day-card.phase-last { border-color: var(--phase-last); background: rgba(244, 63, 94, 0.08); }

.day-card.is-phase .day-phase-tag { font-weight: 800; text-shadow: 0 0 10px currentColor; }
.day-card.phase-full .day-phase-tag { color: var(--phase-full); }
.day-card.phase-new .day-phase-tag { color: var(--phase-new); }
.day-card.phase-first .day-phase-tag { color: var(--phase-first); }
.day-card.phase-last .day-phase-tag { color: var(--phase-last); }

/* Onglets de Navigation */
.tab-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s;
    border-radius: 12px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: var(--accent-color);
    color: #000;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

.full-chart {
    height: 450px !important;
}

.day-num {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.day-moon-img {
    width: 50px;
    height: 50px;
    margin: 0.5rem auto;
}

.day-phase-tag {
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
}

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

footer {
    margin-top: 6rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--glass-border);
}

@media (max-width: 768px) {
    .container { padding: 1rem; }
    
    header { 
        flex-direction: column; 
        gap: 1.5rem; 
        text-align: center;
        margin-bottom: 2rem;
    }

    .controls {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    .controls select, .controls button {
        flex: 1;
        min-width: 120px;
    }

    .hero-section { 
        grid-template-columns: 1fr; 
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .moon-display { height: 300px; }
    .moon-engine { width: 220px; height: 220px; }
    .moon-image-container { width: 260px; height: 260px; }

    .phase-title { 
        font-size: 1.6rem; 
        text-align: center;
        word-wrap: break-word;
        overflow-wrap: break-word;
        line-height: 1.2;
    }

    .moon-info-card {
        padding: 1.5rem;
        text-align: center;
    }

    .stat-grid { gap: 1rem; }
    .stat-value { font-size: 1.1rem; }

    .days-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 0.8rem;
    }

    .day-card { padding: 0.8rem; }
    .day-num { font-size: 1.2rem; }
}

/* Vue Annuelle */
.view-switch {
    display: flex;
    background: rgba(255,255,255,0.05);
    padding: 4px;
    border-radius: 12px;
    margin-right: 15px;
}

.view-switch button {
    background: transparent;
    border: none;
    color: #888;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.view-switch button.active {
    background: var(--accent-color);
    color: #000;
    border-radius: 8px;
    font-weight: 600;
}

.year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    display: none; /* Caché par défaut */
}

.mini-month {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px;
}

.mini-month-title {
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 8px;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mini-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.mini-day {
    aspect-ratio: 1;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    color: #666;
    background: rgba(255,255,255,0.02);
    position: relative;
}

.mini-day .moon-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    margin-top: 2px;
}

@media (max-width: 1200px) {
    .year-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .container { padding: 1rem; padding-bottom: 80px; } /* Space for bottom nav */
    
    header { 
        flex-direction: row; 
        justify-content: space-between;
        gap: 0.5rem; 
        margin-bottom: 1.5rem;
    }

    .logo { font-size: 1.2rem; }

    .controls {
        gap: 0.5rem;
    }

    .controls select, .controls button {
        padding: 0.5rem;
        font-size: 0.8rem;
        min-width: auto;
    }

    .tab-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        margin-bottom: 0;
        border-radius: 20px 20px 0 0;
        background: rgba(10, 10, 30, 0.95);
        backdrop-filter: blur(20px);
        z-index: 1000;
        padding: 0.8rem;
        justify-content: space-around;
        border-top: 1px solid var(--glass-border);
    }

    .tab-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
        flex: 1;
        text-align: center;
    }

    .hero-section { 
        grid-template-columns: 1fr; 
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .moon-display { height: 250px; }
    .moon-engine { width: 180px; height: 180px; }
    .moon-image-container { width: 200px; height: 200px; }

    .phase-title { 
        font-size: 1.8rem; 
        text-align: center;
    }

    .moon-info-card {
        padding: 1.2rem;
    }

    .stat-grid { gap: 0.8rem; }
    .stat-value { font-size: 1rem; }

    .days-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .day-card { padding: 0.5rem; border-radius: 12px; }
    .day-num { font-size: 1rem; }
    .day-moon-img { width: 35px; height: 35px; }

    .year-grid { grid-template-columns: 1fr; }
    .view-switch { margin-right: 0; margin-bottom: 10px; }
    
    .full-chart { height: 300px !important; }
}

@media (max-width: 480px) {
    .days-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

.nav-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 8px 12px !important;
    min-width: 40px !important;
    font-weight: bold;
    color: var(--accent-color) !important;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}
.nav-btn:hover {
    background: rgba(187, 134, 252, 0.2) !important;
    transform: translateY(-1px);
}
#syncBtn {
    background: rgba(187, 134, 252, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
#syncBtn:hover {
    background: var(--accent-color);
    color: #000;
}

/* Nouveaux styles pour la visualisation */
.nav-group {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.btn-primary {
    background: var(--accent-color) !important;
    color: #000 !important;
    font-weight: 700 !important;
}

.tab-icon {
    font-size: 1.4rem;
    line-height: 1;
}

/* Optimisation pour les petits écrans */
@media (max-width: 400px) {
    .logo { display: none; } /* On cache le logo pour gagner de la place */
}
