@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --bg-color: #f7f7f9;
    --text-main: #1d1d1f;
    --text-muted: #8e8e93;
    
    /* Kuvan inspiroimat pastellivärit */
    --accent-yellow: #ffb822; /* Active date & Plus button */
    --card-yellow: #ffcf70;
    --card-pink: #ffe5e5;
    --card-purple: #e5e5ff;
    --card-green: #e5ffe5;
    
    --surface: #ffffff;
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-pill: 50px;
}

[data-theme="dark"] {
    --bg-color: #121217;
    --text-main: #f5f5f7;
    --text-muted: #8e8e93;
    
    /* Yölliset "pastellit" */
    --accent-yellow: #f59e0b; 
    --card-yellow: #2c2415; /* Himmennetty keltainen */
    --card-pink: #2a1616;   /* Himmennetty pinkki */
    --card-purple: #1e1e2d; /* Himmennetty violetti */
    --card-green: #152219;  /* Himmennetty vihreä */
    
    --surface: #1c1c1e;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    padding-bottom: 100px;
}

h1, h2, h3, p { margin: 0; }

.container {
    padding: 0 24px;
    max-width: 500px;
    margin: 0 auto;
}

/* --- Ylätunniste --- */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    max-width: 500px;
    margin: 0 auto;
}

.top-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #ffe0b2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
}

/* --- Päivämääräkaruselli --- */
.date-strip {
    display: flex;
    justify-content: space-between;
    padding: 10px 24px 24px;
    max-width: 500px;
    margin: 0 auto;
}

.date-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.date-item span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.date-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.date-item.active .date-circle {
    background-color: var(--accent-yellow);
    color: white;
}

.date-item.active span {
    color: var(--text-main);
}

/* --- Osioiden otsikot --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    margin-top: 24px;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.section-header a {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
}

/* --- Vaakasuuntaiset kortit (Horizontal Scroll) --- */
.horizontal-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none; /* Firefox */
}

.horizontal-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.card {
    min-width: 140px;
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.card-hero {
    min-width: 250px;
    background-color: var(--card-yellow);
    color: #5c4300;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 800;
}

.card p {
    font-size: 0.8rem;
    line-height: 1.4;
    opacity: 0.8;
}

.tag-container {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.tag {
    background: rgba(255, 255, 255, 0.6);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
}

/* --- Alavalikko kuvan tyyliin --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: var(--surface);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 24px; /* Ota huomioon iPhonen alareuna */
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.03);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    gap: 4px;
}

.nav-item.active {
    color: var(--text-main);
}

.nav-icon {
    font-size: 1.4rem;
}

.fab {
    width: 56px;
    height: 56px;
    background-color: var(--accent-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 4px 15px rgba(255, 184, 34, 0.4);
    transform: translateY(-10px);
    cursor: pointer;
}
/* --- Action Sheet (Bottom Sheet) --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.bottom-sheet {
    position: fixed;
    bottom: -100%; /* Piilossa alhaalla oletuksena */
    left: 0;
    width: 100%;
    background: var(--surface);
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    z-index: 1002;
    padding: 24px;
    box-sizing: border-box;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1); /* Joustava "bounce" -efekti */
}

/* Kun valikko on auki */
.overlay.active {
    opacity: 1;
    visibility: visible;
}
.bottom-sheet.active {
    bottom: 0;
}

/* Pieni vetokahva (visuaalinen vihje) */
.sheet-handle {
    width: 40px;
    height: 5px;
    background: var(--border);
    border-radius: 10px;
    margin: 0 auto 20px;
}

.sheet-title {
    font-size: 1.2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 24px;
}

.sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px; /* Jätetään tilaa alareunaan */
}

.sheet-btn {
    background: var(--bg-color);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.sheet-btn:active {
    transform: scale(0.95);
    border-color: var(--accent-yellow);
}

/* --- Animoitu käynnissä olevan tapahtuman kortti --- */
.active-event-wrapper {
    position: relative;
    margin: 20px 24px 0; /* Asettaa sen kauniisti ylös */
    border-radius: var(--radius-lg);
    padding: 2px; /* Tämä määrittää animoidun reunan paksuuden */
    overflow: hidden;
    z-index: 1;
    box-shadow: var(--shadow-md);
}

/* Pyörivä gradientti taustalla */
.active-event-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg, 
        transparent 0%, 
        var(--primary) 25%, 
        var(--accent-yellow) 50%, 
        transparent 75%
    );
    animation: rotateGradient 4s linear infinite;
    z-index: -2;
}

/* --- Pomminvarma animoitu gradientti --- */
.active-event-wrapper {
    position: relative;
    margin: 20px 24px 0;
    border-radius: var(--radius-lg);
    padding: 3px; /* Reunan paksuus */
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

/* Tämä on pyörivä tausta */
.active-event-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg, 
        transparent 0%, 
        var(--primary) 25%, 
        var(--accent-yellow) 50%, 
        transparent 75%
    );
    animation: rotateGradient 3s linear infinite;
    z-index: 0;
}

@keyframes rotateGradient {
    100% { transform: rotate(360deg); }
}

/* Tämä on kortin sisäosa, joka piilottaa keskiosan gradientista */
.active-event-content {
    position: relative;
    background: var(--bg-color); /* Sama väri kuin taustalla */
    border-radius: calc(var(--radius-lg) - 2px);
    padding: 12px 16px;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stop-btn {
    background: var(--accent-yellow);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 184, 34, 0.3);
}

/* --- Historia / Aikajana --- */
.timeline {
    position: relative;
    padding-left: 24px;
    margin-top: 16px;
}

/* Pystysuora viiva */
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 43px; /* Keskitetty ikonien alle */
    height: 100%;
    width: 2px;
    background: var(--border);
    z-index: 0;
}

.timeline-group-header {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 24px 0 16px -8px;
    background: var(--bg-color); /* Katkaisee viivan otsikon kohdalla */
    display: inline-block;
    padding-right: 16px;
    position: relative;
    z-index: 1;
}

.timeline-item {
    position: relative;
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    z-index: 1;
}

.timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.timeline-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    flex-grow: 1;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-info h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 700;
}

.timeline-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.timeline-time {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-muted);
    text-align: right;
}

.timeline-duration {
    display: inline-block;
    background: rgba(0,0,0,0.05);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-top: 8px;
    color: var(--text-main);
}
[data-theme="dark"] .timeline-duration { background: rgba(255,255,255,0.1); }