/**
 * More Reasons to Celebrate - Styles
 *
 * Table of Contents:
 * 1. Variables & Reset
 * 2. Animations
 * 3. Base Layout
 * 4. Background Decoration
 * 5. Before Input (Landing Page)
 * 6. After Input (Main Display)
 * 7. Main Section Card
 * 8. Unit Switcher
 * 9. Life Expectancy
 * 10. Dots Visualization
 * 11. Milestones
 * 12. Share Section
 * 13. Responsive
 */


/* ==========================================================================
   1. Variables & Reset
   ========================================================================== */

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

:root {
    --bg: #1a1025;
    --card: rgba(255,255,255,0.05);
    --text: #ffffff;
    --text-muted: #a78bba;

    /* Accent colors */
    --pink: #ec4899;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
}


/* ==========================================================================
   2. Animations
   ========================================================================== */

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes number-glow {
    0%, 100% { text-shadow: 0 0 20px var(--pink), 0 0 40px rgba(236, 72, 153, 0.5); }
    33% { text-shadow: 0 0 20px var(--purple), 0 0 40px rgba(139, 92, 246, 0.5); }
    66% { text-shadow: 0 0 20px var(--cyan), 0 0 40px rgba(6, 182, 212, 0.5); }
}

@keyframes pulse-border {
    0%, 100% {
        border-color: rgba(236, 72, 153, 0.5);
        box-shadow: 0 0 20px rgba(236, 72, 153, 0.2);
    }
    50% {
        border-color: rgba(139, 92, 246, 0.5);
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
    }
}

@keyframes celebrate {
    0% { transform: scale(1); }
    25% { transform: scale(1.08); }
    50% { transform: scale(1); }
    75% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

@keyframes glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 15px var(--pink)) drop-shadow(0 0 30px var(--pink)); }
    50% { filter: drop-shadow(0 0 25px var(--purple)) drop-shadow(0 0 50px var(--purple)); }
}

.celebrate {
    animation: celebrate 0.5s ease-out, glow-pulse 0.5s ease-out;
}


/* ==========================================================================
   3. Base Layout
   ========================================================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #1a1025 0%, #2d1f3d 50%, #1a1025 100%);
    background-size: 200% 200%;
    animation: gradient-shift 15s ease infinite;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.logo {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 32px;
}

footer {
    margin-top: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--pink);
    text-decoration: none;
}


/* ==========================================================================
   3b. Language Switcher
   ========================================================================== */

.lang-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    letter-spacing: 0.05em;
}

.lang-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
    color: white;
}


/* ==========================================================================
   4. Background Decoration
   ========================================================================== */

.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
}

.bg-blob-1 {
    width: 400px;
    height: 400px;
    background: var(--pink);
    top: -100px;
    right: -100px;
}

.bg-blob-2 {
    width: 300px;
    height: 300px;
    background: var(--purple);
    bottom: 10%;
    left: -50px;
}

.bg-blob-3 {
    width: 250px;
    height: 250px;
    background: var(--cyan);
    top: 40%;
    right: 5%;
}


/* ==========================================================================
   5. Before Input (Landing Page)
   ========================================================================== */

.before-input {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.before-input.hidden {
    display: none;
}

.hero-text {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.wild-number {
    font-size: 4rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 50%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: number-glow 3s ease-in-out infinite;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-unit {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 48px;
}

/* Input Form */
.input-section {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    animation: pulse-border 4s ease-in-out infinite;
}

.input-label {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: block;
}

.input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-field {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 1.25rem;
    color: var(--text);
    text-align: center;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.input-field::placeholder {
    color: rgba(255,255,255,0.3);
}

.input-field:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.2);
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
    border: none;
    border-radius: 12px;
    padding: 18px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(236, 72, 153, 0.4);
}


/* ==========================================================================
   6. After Input (Main Display)
   ========================================================================== */

.after-input {
    display: none;
}

.after-input.visible {
    display: block;
}

/* Header with live counter */
header {
    text-align: center;
    margin-bottom: 32px;
}

.header-intro {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.6;
}

.header-date-link {
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.header-date-link:hover {
    color: var(--pink);
}

.header-date-link .date-text {
    text-decoration: underline;
    text-decoration-style: dashed;
    text-decoration-color: rgba(255,255,255,0.4);
    text-underline-offset: 4px;
    transition: text-decoration-color 0.2s;
}

.header-date-link:hover .date-text {
    text-decoration-color: var(--pink);
}

.header-date-link .pencil {
    opacity: 0.6;
    margin-left: 4px;
    transition: opacity 0.2s;
    text-decoration: none;
}

.header-date-link:hover .pencil {
    opacity: 1;
}

.header-date-link .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 8px;
}

.header-date-link:hover .tooltip {
    opacity: 1;
}

.header-number {
    font-size: 6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 50%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin-bottom: 8px;
    transition: transform 0.1s;
}

.header-unit {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}


/* ==========================================================================
   7. Main Section Card
   ========================================================================== */

.main-section {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 24px;
}


/* ==========================================================================
   8. Unit Switcher
   ========================================================================== */

.unit-switcher {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.unit-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 100px;
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.unit-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text);
}

.unit-btn.active {
    background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
    border-color: transparent;
    color: white;
}


/* ==========================================================================
   9. Life Expectancy
   ========================================================================== */

.life-expectancy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.life-expectancy-input {
    width: 70px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.85rem;
    color: var(--text);
    text-align: center;
    font-family: inherit;
    font-weight: 600;
}

.life-expectancy-input:focus {
    outline: none;
    border-color: var(--pink);
}

.life-equivalent {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 8px;
}


/* ==========================================================================
   10. Dots Visualization
   ========================================================================== */

.dots-wrapper {
    width: 100%;
    margin-bottom: 16px;
    position: relative;
}

.dots-canvas {
    width: 100%;
    display: block;
    border-radius: 8px;
}

.dots-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot--lived {
    background: linear-gradient(135deg, var(--pink), var(--purple));
}

.legend-dot--future {
    background: rgba(255,255,255,0.08);
}

.legend-dot--current {
    background: var(--cyan);
    box-shadow: 0 0 6px var(--cyan);
}


/* ==========================================================================
   11. Milestones
   ========================================================================== */

.milestones-section {
    margin-top: 56px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

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

.section-title {
    font-size: 2rem;
    font-weight: 700;
}

.milestones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.milestone-card {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.milestone-card:hover {
    transform: translateY(-2px);
    border-color: rgba(236, 72, 153, 0.3);
}

.milestone-card.upcoming {
    border-color: rgba(236, 72, 153, 0.2);
}

.milestone-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.milestone-emoji {
    font-size: 1.8rem;
}

.milestone-countdown {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 100px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    color: var(--pink);
}

.milestone-card.past .milestone-countdown {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
}

.milestone-number {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.milestone-unit {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.milestone-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}


/* ==========================================================================
   12. Share Section
   ========================================================================== */

.share-section {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    margin-top: 56px;
}

.share-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.share-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.share-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn:hover {
    background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
    transform: scale(1.1);
}


/* ==========================================================================
   13. Responsive
   ========================================================================== */

@media (max-width: 640px) {
    .container {
        padding: 24px 16px;
    }

    .wild-number {
        font-size: 2.5rem;
    }

    .hero-unit {
        font-size: 1.5rem;
    }

    .input-section {
        padding: 24px;
    }

    .input-row {
        flex-direction: column;
    }

    .header-number {
        font-size: 3rem;
    }

    .header-unit {
        font-size: 1.5rem;
    }

    .header-intro {
        font-size: 1.1rem;
    }

    .main-section {
        padding: 24px 16px;
    }

    .unit-switcher {
        gap: 4px;
    }

    .unit-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .life-expectancy {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .life-equivalent {
        margin-left: 0;
        display: block;
    }

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

    .section-title {
        font-size: 1.25rem;
    }

    .share-section {
        padding: 20px 16px;
    }

    .share-buttons {
        gap: 8px;
    }

    .share-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}
