@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Oxygen:wght@400;700&display=swap');

:root {
    --red:         #d32f2f;
    --red-dark:    #b71c1c;
    --red-mid:     #e53935;
    --red-light:   #ffebee;
    --green:       #2e7d32;
    --green-light: #e8f5e9;
    --gray-bg:     #f5f5f5;
    --gray-border: #e0e0e0;
    --gray-mid:    #9e9e9e;
    --text:        #333333;
    --text-muted:  #757575;
    --white:       #ffffff;
    --shadow:      0 1px 4px rgba(0,0,0,0.10);
    --shadow-md:   0 2px 8px rgba(0,0,0,0.12);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Oxygen', sans-serif;
    background: var(--gray-bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--red); }
a:hover { color: var(--red-dark); }

/* ─── HEADER ─────────────────────────────────────── */

.sivunotsikko {
    background: var(--red);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 1.25rem;
    height: 58px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.otsikko-logo {
    height: 36px;
    width: auto;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.otsikko-teksti {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.04em;
    flex: 1;
}

.ulos-nappi {
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.40);
    color: var(--white);
    padding: 0.35rem 0.85rem;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s;
}
.ulos-nappi:hover { background: rgba(255,255,255,0.30); color: var(--white); }

/* ─── LAYOUT ──────────────────────────────────────── */

.sisalto {
    max-width: 860px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* ─── CARDS ───────────────────────────────────────── */

.kortti {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.25rem;
}

.kortti-otsikko {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--red);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--red);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.kortti-otsikko-rivi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--red);
}
.kortti-otsikko-rivi .kortti-otsikko {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
}

.kortti-ikoni { font-size: 1.1em; }

/* ─── BIKE INFO ───────────────────────────────────── */

.pyoran-tiedot {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem 1.5rem;
}

.tieto-rivi { display: flex; flex-direction: column; gap: 2px; }

.tieto-otsikko {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
}

.tieto-arvo { font-weight: 600; font-size: 0.95rem; }

.qr-tunnus {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    font-weight: 700;
    background: var(--red-light);
    color: var(--red-dark);
    padding: 0.2rem 0.55rem;
    border-radius: 5px;
    display: inline-block;
    letter-spacing: 0.08em;
}

/* ─── SERVICE LIST ────────────────────────────────── */

.huolto-lista {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.huolto-rivi {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--gray-bg);
    border-radius: 8px;
    border-left: 4px solid var(--gray-border);
    transition: box-shadow 0.15s;
}
.huolto-rivi:hover { box-shadow: var(--shadow-md); }

.huolto-numero {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: 2px;
    word-break: break-all;
}

.huolto-tiedot { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.huolto-pyora { font-weight: 600; font-size: 0.9rem; }

.huolto-paivamaara { font-size: 0.82rem; color: var(--text-muted); }

.huolto-kommentit {
    font-size: 0.88rem;
    color: var(--text);
    margin-top: 4px;
    white-space: pre-line;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ─── STATUS BADGES ───────────────────────────────── */

.tila-merkki {
    display: inline-block;
    padding: 0.22rem 0.65rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
    flex-shrink: 0;
}

.tila-uusi     { background: #e3f2fd; color: #1565c0; }
.tila-tulossa  { background: #fff3e0; color: #e65100; }
.tila-tuotu    { background: #fce4ec; color: #c62828; }
.tila-tyonalla { background: #ede7f6; color: #4527a0; }
.tila-laskuta  { background: #e0f2f1; color: #00695c; }
.tila-valmis   { background: #e8f5e9; color: #2e7d32; }
.tila-peruttu  { background: #f5f5f5; color: #616161; }
.tila-odottaa  { background: #fff8e1; color: #f57f17; }

.huolto-rivi.tila-uusi     { border-left-color: #1565c0; }
.huolto-rivi.tila-tulossa  { border-left-color: #e65100; }
.huolto-rivi.tila-tuotu    { border-left-color: #c62828; }
.huolto-rivi.tila-tyonalla { border-left-color: #4527a0; }
.huolto-rivi.tila-laskuta  { border-left-color: #00695c; }
.huolto-rivi.tila-valmis   { border-left-color: #2e7d32; }
.huolto-rivi.tila-peruttu  { border-left-color: #9e9e9e; }
.huolto-rivi.tila-odottaa  { border-left-color: #f57f17; }

a.huolto-rivi {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
a.huolto-rivi:hover { box-shadow: var(--shadow-md); }

/* ─── BACK LINK ───────────────────────────────────── */

.takaisin-rivi {
    margin-bottom: 1rem;
}

/* ─── ACTION LIST ─────────────────────────────────── */

.toimenpide-lista {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.toimenpide-rivi {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    background: var(--green-light);
    border-radius: 7px;
    border-left: 3px solid var(--green);
}

.toimenpide-ikoni {
    color: var(--green);
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.toimenpide-sisalto {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.toimenpide-nimi {
    font-weight: 600;
    font-size: 0.9rem;
}

.toimenpide-kommentti {
    font-size: 0.83rem;
    color: var(--text-muted);
}

.kommentti-teksti {
    font-size: 0.92rem;
    line-height: 1.65;
    white-space: pre-line;
}

/* ─── EMPTY STATE ─────────────────────────────────── */

.tyhja-tila {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    text-align: center;
}
.tyhja-ikoni { font-size: 2.5rem; margin-bottom: 0.5rem; }
.tyhja-tila p { font-size: 0.9rem; }

/* ─── BUTTONS ─────────────────────────────────────── */

.nappi-paa,
.nappi-toissijainen {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.3rem;
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.nappi-paa {
    background: var(--red);
    color: var(--white);
}
.nappi-paa:hover { background: var(--red-dark); color: var(--white); box-shadow: 0 2px 6px rgba(183,28,28,0.35); }

.nappi-toissijainen {
    background: var(--white);
    color: var(--red);
    border: 2px solid var(--red);
}
.nappi-toissijainen:hover { background: var(--red-light); color: var(--red-dark); }

.nappi-taysleveys { width: 100%; justify-content: center; }

.nappi-alue {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

/* ─── MESSAGES ────────────────────────────────────── */

.virhe, .onnistui {
    padding: 0.85rem 1.1rem;
    border-radius: 7px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
}
.virhe    { background: var(--red-light);   border-left: 4px solid var(--red);   color: var(--red-dark); }
.onnistui { background: var(--green-light); border-left: 4px solid var(--green); color: var(--green); }

/* ─── FORM ELEMENTS ───────────────────────────────── */

.kentta { margin-bottom: 1.1rem; }

.kentta label {
    display: block;
    font-weight: 700;
    font-size: 0.83rem;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.kentta input,
.kentta select,
.kentta textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 2px solid var(--gray-border);
    border-radius: 6px;
    font-family: 'Oxygen', sans-serif;
    font-size: 0.92rem;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
    outline: none;
    appearance: auto;
}
.kentta input:focus,
.kentta select:focus,
.kentta textarea:focus { border-color: var(--red); }

.kentta textarea { resize: vertical; min-height: 110px; }

.kentta-rivi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.kentta-vihje {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.pakollinen { color: var(--red); font-weight: 700; }

/* ─── LOGIN PAGE ──────────────────────────────────── */

body.kirjautuminen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(145deg, var(--red-dark) 0%, var(--red) 55%, var(--red-mid) 100%);
}

.kirjautumis-kortti {
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.35);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}

.logo-alue { text-align: center; margin-bottom: 1.5rem; }

.logo { max-height: 70px; max-width: 240px; width: 100%; object-fit: contain; }

.kirjautumis-kortti h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.45rem;
    text-align: center;
    color: var(--red);
    margin-bottom: 0.4rem;
}

.ohje {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
    line-height: 1.55;
}

/* ─── FOOTER ──────────────────────────────────────── */

.alatunniste {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.alatunniste a { color: var(--text-muted); }
.alatunniste a:hover { color: var(--red); }

/* ─── RESPONSIVE ──────────────────────────────────── */

@media (max-width: 600px) {
    .sivunotsikko { padding: 0 0.9rem; height: 52px; }
    .otsikko-teksti { font-size: 0.88rem; }
    .otsikko-logo { height: 30px; }

    .kortti { padding: 1.1rem; }

    .kentta-rivi { grid-template-columns: 1fr; gap: 0; }

    .huolto-rivi {
        grid-template-columns: 1fr auto;
        gap: 0.5rem;
    }
    .huolto-numero { display: none; }

    .pyoran-tiedot { grid-template-columns: 1fr 1fr; gap: 0.8rem 1rem; }

    .kortti-otsikko-rivi { gap: 0.6rem; }

    .nappi-alue { flex-direction: column-reverse; align-items: stretch; }
    .nappi-alue .nappi-paa,
    .nappi-alue .nappi-toissijainen { justify-content: center; }
}

@media (max-width: 380px) {
    .pyoran-tiedot { grid-template-columns: 1fr; }
    .kirjautumis-kortti { padding: 2rem 1.25rem; }
}
