/* --- ROAMIE 2026 CORE STYLES --- */
:root {
    --primary: #6366f1;
    --primary-soft: rgba(99, 102, 241, 0.1);
    --bg: #f8fafc;
    --bg-soft: #f1f5f9; /* Lisätty uusi muuttuja vaalean teeman pehmennyksiin */
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.05);
    --radius-lg: 32px;
    --radius-md: 20px;
    --top-nav-height: 70px;
}

body.dark {
    --bg: #020617;
    --bg-soft: rgba(255,255,255,0.05); /* Tumman teeman pehmennys */
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    margin: 0;
    padding-bottom: 120px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- YLEISET NAPIT JA MUOTOILUT --- */
.btn-primary { background: var(--primary); color: white; border: none; padding: 20px; border-radius: 20px; font-weight: 800; font-size: 1rem; width: 100%; text-align: center; text-decoration: none; display: block; cursor: pointer; transition: 0.2s; }
.btn-primary:active { transform: scale(0.98); opacity: 0.9; }
.badge-mini { background: var(--primary); color: white; font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; font-weight: 800; }


/* --- TOP BAR (HEADER) --- */
.top-bar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--top-nav-height);
    background: var(--card-bg); opacity: 0.98; backdrop-filter: blur(10px);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 24px; z-index: 1000; border-bottom: 1px solid var(--border);
}

.badge-header {
    position: absolute; top: -5px; right: -5px;
    background: #ef4444; color: white;
    font-size: 0.6rem; font-weight: 800;
    padding: 2px 6px; border-radius: 10px;
    border: 2px solid var(--card-bg);
}

/* Header Dropdown (Reissun valinta) */
.trip-select-wrapper { 
    position: relative; 
    display: inline-flex; 
    align-items: center; 
    max-width: 100%;
}
.trip-select { 
    background: transparent; 
    border: none; 
    font-weight: 800; 
    font-size: 1.15rem; 
    color: var(--text-main); 
    cursor: pointer; 
    padding: 4px 16px 4px 0;
    outline: none; 
    appearance: none; 
    -webkit-appearance: none; 
    max-width: 100%;
    text-overflow: ellipsis; 
    white-space: nowrap;
    overflow: hidden;
}
.trip-select option {
    background: var(--bg); 
    color: var(--text-main);
}
.trip-select-wrapper::after { 
    content: '▼'; 
    font-size: 0.6rem; 
    color: var(--text-muted); 
    position: absolute; 
    right: 2px; 
    pointer-events: none; 
}

/* Header Oikean reunan työkalut */
.nav-right-tools { 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    flex-shrink: 0; 
}

.header-icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    text-decoration: none;
}
.header-icon-btn:active {
    transform: scale(0.9);
    background: var(--border);
}
.header-icon-btn.active-icon {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}
.dark .header-icon-btn.active-icon {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.2);
}
.header-icon-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Teema-ikonin CSS-vaihto */
.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
.dark .theme-icon-sun { display: block; }
.dark .theme-icon-moon { display: none; }


/* --- FLOATING NAV (FOOTER) --- */
.nav-scrim {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 140px; 
    background: linear-gradient(to top, var(--bg) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    z-index: 9998;
}
.dark .nav-scrim {
    background: linear-gradient(to top, var(--bg) 0%, rgba(15, 23, 42, 0) 100%);
}

.floating-nav {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 96%; 
    max-width: 500px;
    background: var(--card-bg);
    display: flex;
    justify-content: space-between; 
    align-items: center;
    padding: 10px; 
    border-radius: 35px; 
    border: 1px solid rgba(0, 0, 0, 0.08); 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 
                0 4px 6px -4px rgba(0, 0, 0, 0.1),
                0 20px 25px -5px rgba(0, 0, 0, 0.05);
    z-index: 9999;
}
.dark .floating-nav {
    background: #111827; 
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

.floating-nav a {
    text-decoration: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: row; 
    align-items: center;
    justify-content: center;
    gap: 0; 
    padding: 12px;
    border-radius: 30px;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative; 
    -webkit-tap-highlight-color: transparent;
}
.floating-nav a svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0; 
    transition: all 0.3s ease;
}
.floating-nav a span {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Aktiivinen napa (Footer) */
.floating-nav a.active {
    background: rgba(99, 102, 241, 0.15); 
    color: var(--primary);
    padding: 12px 20px; 
    gap: 8px; 
}
.dark .floating-nav a.active {
    background: rgba(99, 102, 241, 0.2); 
    color: #818cf8; 
}
.floating-nav a.active span {
    max-width: 90px; 
    opacity: 1;
}

/* Footer ilmoituspiste */
.icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-notif-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    display: none; 
}
.dark .chat-notif-dot {
    border-color: #111827;
}

/* --- HERO (SIVUN YLÄOSA) --- */
.hero {
    width: 100%; height: 380px; position: relative; display: flex; align-items: flex-end;
    overflow: hidden; border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg);
}
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; opacity: 0.9; background: #000; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 70%); z-index: 2; }
.hero-content { position: relative; z-index: 10; padding: 30px 24px; width: 100%; color: white; }
.hero-date { display: inline-block; background: rgba(255,255,255,0.2); backdrop-filter: blur(10px); padding: 6px 14px; border-radius: 12px; font-size: 0.8rem; font-weight: 700; margin-bottom: 8px; border: 1px solid rgba(255,255,255,0.2); }
.hero-content h1 { margin: 0; font-size: 2.2rem; font-weight: 800; line-height: 1.1; }


/* --- DASHBOARD GRID (2 rinnakkain) --- */
.content { padding: 24px 16px; max-width: 850px; margin: 0 auto; width: 100%; }
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 20px 0;
    align-items: stretch;
}

.summary-card {
    position: relative;
    background: var(--card-bg); border-radius: var(--radius-md); 
    box-shadow: var(--shadow); border: 1px solid var(--border); 
    padding: 16px; cursor: pointer; display: flex; flex-direction: column;
    justify-content: space-between; transition: transform 0.2s;
    height: 100%;
}
.summary-card:active { transform: scale(0.96); }

.card-rating-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 800;
    color: #f59e0b;
    box-shadow: var(--shadow);
    z-index: 2;
}

.card-title { margin: 0; font-size: 0.95rem; font-weight: 700; line-height: 1.2; height: 2.4em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.card-header-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.meta-item { font-size: 0.6rem; font-weight: 800; padding: 2px 6px; border-radius: 6px; text-transform: uppercase; }
.vote-score.pos { background: #dcfce7; color: #15803d; }
.vote-score.neg { background: #fee2e2; color: #b91c1c; }
.distance-mini { background: var(--primary-soft); color: var(--primary); }

/* --- MODAL SYSTEM (KESKITETTY) --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); 
    backdrop-filter: blur(8px); z-index: 2000; 
    display: none; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; transition: opacity 0.3s ease;
}
.modal-overlay.active { display: flex; opacity: 1; }

.modal-content {
    background: var(--card-bg); width: 100%; max-width: 500px;
    border-radius: var(--radius-lg); 
    padding: 32px; max-height: 90vh; overflow-y: auto;
    transform: scale(0.9); opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.active .modal-content { transform: scale(1); opacity: 1; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { margin: 0; font-size: 1.4rem; font-weight: 800; }

.close-modal {
    background: var(--bg); border: none; 
    width: 44px; height: 44px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform 0.2s;
    flex-shrink: 0;
}
.close-modal:active { transform: scale(0.9); }
.close-modal span { font-size: 1.4rem; color: var(--text-main); line-height: 1; display: block; margin-top: -2px; }

.modal-section { padding: 20px 0; }
.modal-divider { border-top: 1px solid var(--border); }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin: 15px 0; }
.info-box small { font-weight: 800; text-transform: uppercase; font-size: 0.65rem; color: var(--text-muted); display: block; margin-bottom: 4px; }
.info-box p { margin: 0; font-size: 1rem; font-weight: 600; }

.nav-btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; }
.btn-nav { text-decoration: none; background: var(--text-main); color: #fff; padding: 14px; border-radius: 14px; text-align: center; font-size: 0.85rem; font-weight: 700; border: none; cursor: pointer; }

.link-btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; background: var(--bg); border: 1px solid var(--border); padding: 10px 16px; border-radius: 12px; font-size: 0.85rem; font-weight: 700; color: var(--text-main); margin: 0 8px 8px 0; }

/* --- VOTING & COMMENTS --- */
.vote-btns { display: flex; gap: 12px; margin-top: 10px; }
.vote-btn { background: transparent; border: 1px solid var(--border); padding: 12px 20px; border-radius: 14px; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; gap: 10px; font-weight: 600; transition: 0.2s; }
.vote-btn.active-up { background: #dcfce7; color: #15803d; border-color: #16a34a; }
.vote-btn.active-down { background: #fee2e2; color: #b91c1c; border-color: #dc2626; }

.comment-item { display: flex; gap: 12px; margin-bottom: 16px; align-items: flex-start; }
.avatar-small { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.comment-bubble { background: var(--bg); padding: 12px 16px; border-radius: 18px; flex: 1; font-size: 0.9rem; }


/* --- PROFILE SPECIFIC --- */
.profile-header { text-align: center; padding: 40px 24px; background: var(--card-bg); border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); margin-bottom: 24px; box-shadow: var(--shadow); }
.profile-avatar-wrap { position: relative; width: 120px; height: 120px; margin: 0 auto 16px; cursor: pointer; }
.profile-avatar-wrap img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 4px solid var(--primary-soft); }
.edit-avatar-btn { position: absolute; bottom: 0; right: 0; background: var(--primary); color: white; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 3px solid var(--card-bg); font-size: 1rem; }

.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); padding: 20px; border-radius: var(--radius-md); text-align: center; border: 1px solid var(--border); }
.stat-card strong { display: block; font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.stat-card span { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }

.settings-group { background: var(--card-bg); border-radius: var(--radius-md); border: 1px solid var(--border); overflow: hidden; margin-bottom: 24px; }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text-main); font-weight: 600; transition: background 0.2s; }
.settings-item:last-child { border-bottom: none; }
.settings-item:active { background: var(--bg); }
#avatarInput { display: none; }


/* --- FORMS --- */
.form-group { margin-bottom: 24px; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; margin-left: 4px; }
.form-input { width: 100%; background: var(--bg); border: 2px solid var(--border); border-radius: 16px; padding: 16px; font-size: 1rem; color: var(--text-main); outline: none; transition: 0.2s; }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
textarea.form-input { min-height: 120px; resize: none; }


/* --- NOTIFICATION STATES --- */
.notification-item {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}
.notification-item.read { opacity: 0.6; background: var(--bg); }
.unread-dot { width: 10px; height: 10px; background: var(--primary); border-radius: 50%; flex-shrink: 0; }
.notification-item.read .unread-dot { visibility: hidden; }
.notification-content { flex: 1; }
.notification-content strong { display: block; font-size: 0.85rem; line-height: 1.3; }
.notification-content small { color: var(--text-muted); font-size: 0.7rem; }

/* --- LISÄTTÄVÄT TYYLIT STYLE.CSS LOPPUUN --- */

/* Käyttäjäpillerit (Header / Etusivu) */
.participant-pill { display: flex; align-items: center; gap: 6px; background: var(--bg-soft, #f1f5f9); padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; color: var(--text-main); font-weight: 700; border: 1px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.dark .participant-pill { background: rgba(255,255,255,0.05); }

/* Etusivun tyhjän tilan ilmoitus */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); animation: fadeIn 0.5s ease-in; }
.empty-arrow { font-size: 2.5rem; margin-bottom: 15px; animation: bounce 1.5s infinite; color: var(--primary); }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-15px); } 60% { transform: translateY(-7px); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Korttien lisätyylit (Kategoriapallot, etäisyydet, käyty-merkintä) */
.card-bottom-right { position: absolute; bottom: 8px; right: 8px; display: flex; align-items: center; gap: 6px; z-index: 5; }
.cat-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.visited-badge { color: #22c55e; font-size: 0.9rem; font-weight: 900; }
.summary-card.visited { opacity: 0.7; border-color: #22c55e !important; }
.summary-card.main-acc { border: 2px solid var(--cat-color); }
.dist-row { display: flex; flex-direction: column; font-size: 0.6rem; color: var(--text-muted); margin-top: 3px; font-weight: 700; }

/* Osiot (Kategoriat etusivulla) */
.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.0rem; text-transform: uppercase; color: var(--text-muted); margin: 20px 0 10px; white-space: nowrap; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.section-title-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

/* Modaalin lomake-elementit ja kategoriapillerit */
.cat-pill { cursor: pointer; }
.cat-check { display: none; }
.pill-label { display: inline-block; padding: 4px 10px; border-radius: 15px; background: var(--bg); border: 1px solid var(--border); font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.cat-check:checked + .pill-label { background: var(--primary); color: white; border-color: var(--primary); }
.modal-cat-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 12px; font-size: 0.7rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.v-info-line { margin: 12px 0; font-size: 0.85rem; line-height: 1.4; }
.v-info-line strong { display: block; font-size: 0.6rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; letter-spacing: 0.5px; }

/* Google Places Autocomplete (hakuvalikko lomakkeessa) */
.pac-container { z-index: 10005 !important; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); border: 1px solid var(--border); font-family: 'Inter', sans-serif; }

/* --- KALENTERIN TYYLIT --- */
.ideas-tray { display: flex; gap: 10px; overflow-x: auto; padding: 10px 5px; scrollbar-width: none; min-height: 70px; }
.ideas-tray::-webkit-scrollbar { display: none; }
.small-card { min-width: 130px; padding: 10px; background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border); font-size: 0.8rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05); cursor: pointer; }

/* --- KALENTERIN AIKAJANA (PÄIVITYS) --- */
.timeline-day { 
    display: flex; 
    gap: 15px; 
    margin-bottom: 25px; 
    padding-bottom: 25px; /* Lisätty tilaa viivan yläpuolelle */
    border-bottom: 1px solid var(--border); /* Tämä luo sen viivan */
}

/* Poistetaan viiva viimeisen päivän alta, jotta se ei näytä orvolta */
.timeline-day:last-child { 
    border-bottom: none; 
    margin-bottom: 0;
}
.day-sidebar { width: 45px; flex-shrink: 0; text-align: center; padding-top: 5px; }
.day-label { display: block; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; color: var(--text-muted); }
.day-number { font-size: 1rem; font-weight: 900; }
.is-today .day-number { color: var(--primary); }

.day-zone { flex: 1; min-height: 50px; display: flex; flex-direction: column; gap: 10px; }
.scheduled-card { background: var(--card-bg); border-radius: 15px; padding: 12px; border: 1px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,0.05); cursor: pointer; }

.card-cat-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.cat-pill-mini { font-size: 0.55rem; font-weight: 800; padding: 1px 6px; border-radius: 5px; text-transform: uppercase; }
.time-badge { background: var(--primary-soft); color: var(--text-main); font-size: 0.7rem; font-weight: 800; width: 45px; text-align: center; padding: 2px 0; border-radius: 6px; }

.cal-note { font-size: 0.8rem; color: var(--text-main); font-style: italic; background: var(--bg-soft); padding: 8px; border-radius: 8px; margin: 8px 0; border-left: 3px solid var(--primary); }

.sortable-ghost { opacity: 0.3; transform: scale(0.95); }

/* --- YLEISET PILLERIT (Linkit ja Äänestys) --- */
.v-link-pill { 
    display: inline-block; 
    padding: 6px 14px; 
    background: var(--bg-soft); 
    border: 1px solid var(--border); 
    border-radius: 20px; 
    text-decoration: none; 
    color: var(--text-main) !important; 
    font-size: 0.75rem; 
    font-weight: 700; 
    margin-top: 5px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.v-link-pill:active {
    transform: scale(0.95);
    background: var(--border);
}

.v-vote-pill { 
    background: var(--bg-soft); 
    border: 1px solid var(--border); 
    padding: 6px 16px; 
    border-radius: 20px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    font-weight: 700; 
    font-size: 0.85rem; 
    color: var(--text-main) !important; 
    transition: all 0.2s ease;
}

.v-vote-pill:active {
    transform: scale(0.95);
}