/* Peloton – eeter. Vana kujunduse värvid, skaleeruv paigutus (arvuti / mobiil). */
:root {
    --blue: #003366;
    --blue-hover: #367889;
    --text: #333;
    --muted: #666;
    --alt: #f2f4f7;
    --line: #d6d9de;
    --quote-bg: #e8e8e8;
    --tool-bg: #e8e8e8;
    --red: #c00;
    --radius: 4px;
}

* { box-sizing: border-box; }

/* Teksti suurus: --zoom muudetakse nuppudega A− / A+ (vt layout). Kõik suurused on rem/em,
   nii et suurendamisel tekst murdub ekraani laiusele (horisontaalset kerimist ei teki). */
html { -webkit-text-size-adjust: 100%; font-size: calc(100% * var(--zoom, 1)); }

body {
    margin: 0;
    background: var(--blue);
    color: var(--text);
    font: 1rem/1.45 "Trebuchet MS", Verdana, Arial, sans-serif;
}

a { color: var(--blue); }
a:hover { color: var(--blue-hover); }

#container { max-width: 900px; margin: 0 auto; }

/* Päis */
#header {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 16px; color: #fff;
}
#header .logo img { display: block; width: 264px; max-width: 70vw; height: auto; }
.main-nav { flex: 1 1 auto; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: flex-end; }
.main-nav a, .main-nav .linklike { color: #fff; text-decoration: none; font-size: .9375rem; }
.main-nav a.active { text-decoration: underline; }
.main-nav form.inline { display: inline; }
.nav-toggle, .nav-toggle-label { display: none; }

/* Sisu */
#content { background: #fff; padding: 16px 20px 24px; }
#footer { color: #cfd8e3; font-size: .8125rem; padding: 10px 16px; text-align: right; }

h2 { margin: 0 0 12px; font-size: 1.5em; color: #000; }

.flash { background: #e3f4e1; border: 1px solid #9ccc95; padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius); }
.error { color: var(--red); margin: 8px 0; }
.vihje { font-size: .8125rem; color: var(--muted); }

/* Tööriistad: sortimine, otsing, mine kuupäevale */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.toolbar .sort { background: var(--tool-bg); padding: 6px 10px; border-radius: var(--radius); flex: 1 1 100%; }
.tool { background: var(--tool-bg); border-radius: var(--radius); padding: 6px 10px; }
.tool summary { cursor: pointer; color: var(--blue); }
.tool[open] { flex: 1 1 100%; }
.tool-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; padding-top: 8px; }
.tool-form label { display: flex; flex-direction: column; font-size: .875rem; }
.tool-form label.check { flex-direction: row; align-items: center; gap: 4px; }

input[type=text], input[type=password], input[type=date], select, textarea {
    font: inherit; padding: 6px 8px; border: 1px solid #aab; border-radius: var(--radius); max-width: 100%;
}
button, .button {
    font: inherit; font-size: .9375rem; padding: .4em .9em; border: 1px solid var(--blue); background: var(--blue);
    color: #fff; border-radius: var(--radius); cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { background: var(--blue-hover); color: #fff; }
button.danger { background: #fff; color: var(--red); border-color: var(--red); }
.button.secondary { background: #fff; color: var(--blue); }
.button.secondary:hover { background: var(--alt); color: var(--blue-hover); }
.linklike {
    background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font: inherit; font-size: inherit;
}
.linklike:hover { background: none; color: var(--blue-hover); text-decoration: underline; }

.count { font-weight: bolder; color: #f00; white-space: nowrap; }

/* Lehekülgede lingid */
.paging { font-size: 90%; margin: 10px 0; line-height: 2; }
.paging a { text-decoration: none; white-space: nowrap; }
.paging .current { font-weight: bold; white-space: nowrap; }
.paging .disabled { color: #aaa; }
.paging .sep { color: #999; margin: 0 2px; }

/* Kommentaar */
.komm { padding: 10px 4px 8px; background: #fff; border-bottom: 1px solid #b9c3cf; scroll-margin-top: 10px; }
.komm:first-of-type { border-top: 1px solid #b9c3cf; }
.komm:target { background: #fff6cc; box-shadow: inset 3px 0 0 #e0b000; }
.komm-head { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.komm-head .nimi { font-weight: bold; color: var(--text); text-decoration: none; }
.komm-head .email { font-size: 90%; color: #00f; text-decoration: underline; overflow-wrap: anywhere; }
.komm-head .aeg { font-size: 90%; color: #050505; text-decoration: none; }
.sisu { margin-top: 4px; overflow-wrap: anywhere; }
.sisu a { text-decoration: none; }
.sisu a:hover { text-decoration: underline; }
.sisu .small { font-size: 75%; }
.sisu .big { font-size: 140%; }
.tsitaat {
    margin: 4px 0; padding: 4px 8px; font-size: 90%;
    border: 1px solid #000; background: var(--quote-bg);
}
.tsitaat .tsitaat { background: #f4f4f4; }
/* kokkusurutud tsitaat: näha ainult esimene rida ("Algselt postitas ...") */
.tsitaat.kokku { box-sizing: content-box; max-height: 1.45em; overflow: hidden; position: relative; }
.tsitaat.kokku.lahti { max-height: none; }
.tsitaat-nupp {
    float: right; margin: 0 0 4px 8px; padding: 0 .5em; font-size: .8125rem; line-height: 1.4;
    background: #fff; color: var(--blue); border: 1px solid #99a;
}
.tsitaat-nupp:hover { background: var(--alt); color: var(--blue-hover); }
.stack label.check { flex-direction: row; align-items: center; gap: 6px; }
.komm-ft { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: .8125rem; color: var(--muted); }
.komm-ft .hinda { margin-left: auto; }

/* Vorm */
.lisa { margin-top: 20px; }
.lisa .row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.lisa .row label { display: flex; flex-direction: column; flex: 1 1 12rem; font-size: .875rem; }
#formTekst { width: 100%; min-height: 200px; resize: vertical; }

.stack { display: flex; flex-direction: column; gap: 10px; max-width: 22rem; }
.stack label { display: flex; flex-direction: column; font-size: .875rem; }

/* Admin */
.table-wrap { overflow-x: auto; }
table.users { border-collapse: collapse; width: 100%; }
table.users th, table.users td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users tr.inactive td { color: #999; }
table.users td.actions { display: flex; flex-wrap: wrap; gap: 6px; }
table.users td.actions form { display: flex; gap: 4px; }

/* Mobiil */
@media (max-width: 640px) {
    /* mobiilis põhikiri 18px (arvutis 16px) */
    html { font-size: calc(112.5% * var(--zoom, 1)); }
    #header { padding: 8px 12px; }
    .nav-toggle-label { display: block; margin-left: auto; font-size: 26px; cursor: pointer; color: #fff; }
    .main-nav { display: none; flex-basis: 100%; }
    .nav-toggle:checked ~ .main-nav { display: block; }
    .main-nav ul { flex-direction: column; align-items: flex-start; gap: 8px; padding: 6px 0; }
    #content { padding: 12px 12px 20px; }
    .komm { padding: 8px 4px; }
    .komm-ft { font-size: .875rem; }
    .komm-ft .hinda { margin-left: 0; }
    .paging { font-size: 90%; }
    .tool-form { flex-direction: column; align-items: stretch; }
    .tool-form button { width: 100%; }
    #lisaNupp { width: 100%; padding: 10px; }
}

/* Viide (vastus kommentaarile) */
.komm-head .vastus { font-size: 90%; color: var(--muted); text-decoration: none; }
.komm-head .vastus:hover { text-decoration: underline; }
.viide-info { background: var(--alt); border-left: 3px solid var(--blue); padding: 4px 8px; margin-bottom: 6px; font-size: .875rem; }
.viide-info[hidden] { display: none; }
.viide-info .linklike { margin-left: 8px; color: var(--red); }
.viide-info.tsitaat-puudub::after { content: " – tsitaati tekstis enam pole"; color: var(--red); }

/* Vestlus (puu) */
.vestlus .haru { margin-left: calc(var(--nihe, 0) * 1.1rem); border-left: 2px solid transparent; }
.vestlus .haru .haru { border-left-color: var(--line); padding-left: .5rem; }
.vestlus .haru.algus > .komm { background: #fff6cc; box-shadow: inset 3px 0 0 #e0b000; }
@media (max-width: 640px) { .vestlus .haru { margin-left: calc(var(--nihe, 0) * .5rem); } .vestlus .haru .haru { padding-left: .35rem; } }

/* Teade (banner) Eetri pealkirja all */
.banner { font-size: 1.15em; margin: 0 0 12px; overflow-wrap: anywhere; }
.admin-nav { margin-bottom: 8px; }
.admin-nav a.active { font-weight: bold; text-decoration: none; }
.stack.laiem { max-width: 40rem; }
.stack textarea { width: 100%; }

/* Statistika */
.edetabelid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 16px 24px; margin-top: 12px; }
.edetabel h3 { margin: 0 0 6px; font-size: 1.1em; }
.edetabel table, table.kokkuvote { border-collapse: collapse; width: 100%; }
.edetabel td, table.kokkuvote td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.edetabel td.koht { width: 2.2em; color: var(--muted); text-align: right; }
.edetabel td.nimi { overflow-wrap: anywhere; }
.edetabel td.arv, table.kokkuvote td.arv { text-align: right; white-space: nowrap; }
.edetabel tfoot td { font-size: .875rem; color: var(--muted); border-bottom: 0; }
.edetabel tfoot tr:first-child td { border-top: 2px solid var(--line); }
table.kokkuvote { max-width: 32rem; margin-bottom: 8px; }

/* Seakava */
.seakava h3 { margin: 0 0 6px; }
.seakava-kava { border-top: 1px solid #b9c3cf; }
.seakava-kustuta { margin-top: 24px; }
.seakava .toolbar .tool-form { padding-top: 0; }
td.nowrap { white-space: nowrap; }

/* Teksti suuruse nupud */
.textsize { display: inline-flex; gap: 4px; order: 3; }
.main-nav { order: 2; }
@media (max-width: 640px) {
    .textsize { order: 0; margin-left: auto; }
    .nav-toggle-label { margin-left: 10px !important; }
}
/* nuppude suurus ei sõltu valitud teksti suurusest (px), et päis ei kasvaks */
.textsize button { background: transparent; border: 1px solid #7f9cc0; color: #fff; padding: 0 7px; font-size: 15px; line-height: 26px; }
.textsize button:hover { background: var(--blue-hover); }
/* pikad sõnad/lingid ei aja lehte laiemaks */
#content, .komm, .sisu, .tsitaat { min-width: 0; overflow-wrap: anywhere; }
input, textarea, select { max-width: 100%; }
