/* --- YLEISET TYYLIT --- */
body {
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    margin: 0;
    background: #f0f2f5; 
    color: #222;
    -webkit-user-select: none; user-select: none;
    padding-top: 60px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- HEADER & NAV --- */
.main-header {
    position: fixed; top: 0; left: 0; width: 100%; height: 60px;
    background: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 1000;
}
.hamburger-btn {
    position: absolute; left: 15px; font-size: 24px; cursor: pointer;
    background: none; border: none; color: #333; padding: 10px;
}
.header-logo-img { max-height: 40px; width: auto; }

.sidenav {
    height: 100%; width: 0; position: fixed; z-index: 2000; top: 0; left: 0;
    background-color: #222; overflow-x: hidden; transition: 0.3s; padding-top: 60px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
}
.sidenav a {
    padding: 15px 25px; text-decoration: none; font-size: 18px; color: #bdc3c7;
    display: block; transition: 0.3s; border-bottom: 1px solid #333;
}
.sidenav a:hover, .sidenav a.active-link { color: #fff; background-color: #005bea; }
.sidenav .closebtn { position: absolute; top: 0; right: 10px; font-size: 36px; margin-left: 50px; border-bottom: none; }

/* --- NÄKYMÄT --- */
.app-view { display: none; animation: fadeIn 0.3s; padding-bottom: 20px; flex: 1; }
#view-calculator { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- FOOTER --- */
.main-footer {
    text-align: center;
    padding: 20px;
    background: #e9ecef;
    color: #666;
    font-size: 11px;
    border-top: 1px solid #ddd;
    margin-top: auto;
}
.copyright-text {
    display: block;
    margin-top: 5px;
    font-weight: 600;
    color: #444;
}

/* --- LASKURI (MOBILE FIRST) --- */
.taxi-calculator-wrapper { 
    max-width: 500px; margin: 0 auto; background: #fff; padding-bottom: 20px; 
    box-shadow: 0 0 20px rgba(0,0,0,0.05); border-radius: 0 0 12px 12px; 
}
.content-padding { padding: 15px; }

/* --- PÄIVITETTY ALUE/YHTIÖ -NAPPI --- */
.settings-summary-btn {
    background: #fff; 
    color: #222; 
    border: none; 
    padding: 12px 16px; /* Hieman enemmän tilaa pystysuunnassa */
    border-radius: 12px; /* Pyöristetympi */
    cursor: pointer; 
    width: 90%; 
    margin: 10px auto;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    min-height: 60px; /* Varmistetaan että tekstit mahtuvat */
}

.btn-left-text {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px; /* Väli rivien välissä */
    font-size: 13px;
    flex: 1; /* Vie kaiken tilan vasemmalla */
}

/* Yksittäiset rivit vasemmalla */
.btn-left-text div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- PÄIVITETTY OIKEA LAITA (RATAS + TEKSTI) --- */
.btn-right-action {
    display: flex;             /* Asetetaan elementit vierekkäin (flexbox) */
    align-items: center;       /* Keskistetään pystysuunnassa */
    gap: 8px;                  /* Väli rattaan ja tekstin väliin */
    margin-left: 10px;
    flex-shrink: 0;            /* Estää kutistumisen */
    color: #666;
}

/* UUSI: Rattaan tyyli */
.settings-gear-icon {
    font-size: 26px;           /* Reilusti isompi koko (n. 2 rivin korkeus) */
    line-height: 1;            /* Tiivistetään riviväli, jotta ikoni ei vie turhaa tilaa */
}

/* UUSI: Tekstin tyyli (siirretty aiemmasta yleistyylistä tänne) */
.settings-action-text {
    text-align: right;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
}
.settings-panel {
    display: none; background: #fff; padding: 15px; border-radius: 16px; width: 90%; max-width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); margin: 10px auto; position: relative; z-index: 10;
}
.company-select { width: 100%; padding: 10px; margin-bottom: 8px; border-radius: 8px; border: 2px solid #eee; background: #f9f9f9; }
.close-settings-btn { width: 100%; padding: 10px; background: #333; color: #fff; border: none; border-radius: 8px; margin-top: 10px; cursor: pointer; }

.input-group { margin-bottom: 10px; }
.input-group label { display: block; font-weight: 700; margin-bottom: 4px; font-size: 11px; text-transform: uppercase; color: #444; }
.highlight-label { border-left: 3px solid #ccc; padding-left: 6px; }
input[type=text], input[type=number] { width: 100%; padding: 10px; border: 2px solid #eee; border-radius: 8px; box-sizing: border-box; height: 42px; }
.location-btn { float: right; font-size: 11px; background: #f0f0f0; padding: 2px 8px; border-radius: 12px; cursor: pointer; }

.toggle-container { display: flex; background: #eee; padding: 3px; border-radius: 8px; gap: 3px; }
.toggle-btn { flex: 1; padding: 8px; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-weight: 600; color: #666; }
.toggle-btn.active { background: #333; color: #fff; }

.btn-calc { 
    width: 100%; 
    padding: 14px; 
    background: #333; 
    color: #fff; 
    border: none; 
    border-radius: 8px; 
    font-weight: 800; 
    text-transform: uppercase; 
    margin-top: 10px; 
    cursor: pointer; 
    box-sizing: border-box; 
}
.secondary-btn { background: #fff; border: 2px solid #eee; padding: 10px; width: 100%; border-radius: 8px; font-weight: 700; font-size: 12px; cursor: pointer; margin-bottom: 8px; color: #333; box-sizing: border-box; }

/* Results */
.results-container { display: none; margin-top: 15px; border-top: 2px solid #eee; padding-top: 15px; }
#map { height: 200px; width: 100%; border-radius: 12px; margin-bottom: 12px; background: #eee; }
.route-btn { background: #fff; border: 2px solid #eee; border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.route-btn.active { border-color: #333; background-color: #fafafa; }
.comp-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.comp-table td, .comp-table th { padding: 8px; border-bottom: 1px solid #eee; }
.cheapest-row { background-color: #f0fdf4; color: #166534; font-weight: bold; }

#surchargeContainer { display: none; background: #fff; padding: 10px; border: 2px solid #eee; border-radius: 8px; margin-bottom: 10px; }
.checkbox-row { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid #f9f9f9; }
.price-tag { margin-left: auto; font-size: 11px; background: #eee; padding: 2px 5px; border-radius: 4px; }

/* --- HINNASTO --- */
.price-list-wrapper { max-width: 800px; margin: 0 auto; padding: 15px; }
.region-header { margin-top: 25px; margin-bottom: 15px; padding-left: 10px; border-left: 4px solid #005bea; }
.region-header h2 { margin: 0; font-size: 18px; text-transform: uppercase; }
.city-block { margin-bottom: 30px; }
.city-title { font-size: 15px; font-weight: 800; color: #555; border-bottom: 1px solid #ddd; padding-bottom: 5px; margin-bottom: 15px; }
.company-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 20px; border: 1px solid #eee; overflow: hidden; }
.company-header { padding: 15px; background: #fcfcfc; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; font-weight: 900; }
.price-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.price-table th { background: #f8f9fa; text-align: right; padding: 8px; color: #666; font-size: 10px; text-transform: uppercase; }
.price-table th:first-child { text-align: left; }
.price-table td { padding: 10px; text-align: right; border-bottom: 1px solid #f0f0f0; }
.price-table td:first-child { text-align: left; font-weight: 600; }
.example-section { background: #f0f8ff; padding: 10px 15px; font-size: 13px; border-top: 1px solid #cce0ff; }

/* --- YHTEYSTIEDOT --- */
.contact-card { background: #fff; max-width: 500px; margin: 20px auto; padding: 30px; border-radius: 16px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.contact-row { margin-bottom: 15px; font-size: 16px; color: #444; }
.contact-label { font-size: 12px; text-transform: uppercase; color: #888; font-weight: 700; margin-bottom: 4px; display: block; }
.contact-value { font-weight: 600; color: #222; font-size: 18px; }
.contact-link { color: #005bea; text-decoration: none; font-weight: 700; }

/* Modal */
.modal { display: none; position: fixed; z-index: 3000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.modal-content { background: #fff; margin: 20% auto; width: 85%; max-width: 400px; border-radius: 16px; padding: 20px; position: relative; }
.close { position: absolute; right: 15px; top: 10px; font-size: 26px; cursor: pointer; }
.loader { text-align:center; padding:20px; color:#666; font-style:italic; }

/* --- DESKTOP LAAJENNUS (Min-width 900px) --- */
@media (min-width: 900px) {
    .main-header { width: 100%; max-width: 1100px; left: 50%; transform: translateX(-50%); border-radius: 0 0 12px 12px; }
    .taxi-calculator-wrapper { max-width: 1100px; margin-top: 30px; border-radius: 16px; }
    .content-padding { display: grid; grid-template-columns: 400px 1fr; gap: 40px; align-items: start; }
    .calc-left-col { background: #fff; }
    .results-container { margin-top: 0; border-top: none; padding-top: 0; border-left: 1px solid #eee; padding-left: 30px; }
    #map { height: 550px; }
    .city-block { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
    .city-title { grid-column: 1 / -1; }
    .price-list-wrapper { max-width: 1100px; }
}

/* --- LISÄYS: DESKTOP NAV --- */
.desktop-nav {
    display: none;
}
.desktop-nav a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    margin-left: 25px;
    font-size: 15px;
    position: relative;
    transition: color 0.3s;
}
.desktop-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: #005bea;
    transition: width 0.3s;
}
.desktop-nav a:hover::after,
.desktop-nav a.active-link::after {
    width: 100%;
}
.desktop-nav a:hover,
.desktop-nav a.active-link {
    color: #005bea;
}

@media (min-width: 900px) {
    .hamburger-btn {
        display: none;
    }
    .main-header {
        justify-content: space-between;
        padding: 0 40px;
    }
    .desktop-nav {
        display: flex;
        align-items: center;
    }
}

/* --- INSTALL MODAL (PWA) --- */
.install-modal-content {
    text-align: center;
}
.install-icon {
    width: 60px; height: 60px; margin-bottom: 10px;
}
.btn-install {
    background: #005bea; color: #fff; padding: 12px 20px;
    border: none; border-radius: 8px; font-weight: bold; cursor: pointer;
    width: 100%; margin-top: 15px;
}
.btn-install-close {
    background: transparent; border: none; color: #666;
    margin-top: 10px; cursor: pointer; font-size: 13px; text-decoration: underline;
}

/* --- PÄIVITETTY VÄLIPYSÄHDYS OTSIKOILLA --- */
.waypoint-item {
    display: flex;
    align-items: flex-end;   /* TÄRKEÄ: Kohdistaa inputit ja napin alareunaan */
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
}

/* Kääreet muutetaan pystysuuntaisiksi (otsikko ylös, input alas) */
.waypoint-input-wrapper, 
.waypoint-time-wrapper {
    display: flex;
    flex-direction: column; 
    flex-grow: 1;
}

/* Aikarajaukselle kiinteä leveys */
.waypoint-time-wrapper {
    flex-grow: 0;
    width: 70px;
    flex-shrink: 0;
}

/* Uusi tyyli otsikoille */
.waypoint-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 4px;
    margin-left: 2px;
}

.waypoint-item input {
    width: 100%;
    margin-bottom: 0 !important;
    height: 42px;
}

.btn-remove-wp {
    width: 40px;
    height: 40px;
    background: #ffebee;
    color: #c62828;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Pieni hienosäätö, jotta nappi on tismalleen inputin tasolla */
    margin-bottom: 1px; 
}

    /* SEO-osion tyylit */
    .seo-content-section {
        max-width: 800px;
        margin: 40px auto 20px auto;
        padding: 20px;
        background-color: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
        color: #333;
    }
    .seo-content-section h2 {
        color: #2c3e50;
        font-size: 1.5rem;
        margin-top: 30px;
        margin-bottom: 15px;
        border-bottom: 2px solid #ffc107; /* Taksikeltainen viiva */
        display: inline-block;
    }
    .seo-content-section h3 {
        font-size: 1.2rem;
        margin-top: 20px;
        color: #444;
    }
    .seo-content-section p {
        line-height: 1.6;
        margin-bottom: 15px;
        color: #555;
    }
    .seo-content-section ul {
        margin-bottom: 20px;
        padding-left: 20px;
    }
    .seo-content-section li {
        margin-bottom: 8px;
        line-height: 1.5;
    }
