/* EVML infosüsteem */

:root {
    --bg: #f0f2f5;
    --bg-subtle: #f7f9fb;
    --fg: #1a1a2e;
    --fg-muted: #555e6d;
    --accent: #1a5f7a;
    --accent-dark: #134d63;
    --accent-light: #e8f4f8;
    --border: #d1d9e0;
    --radius: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
    --bg-subtle: #f4f6f9;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Header ─── */
.site-header {
    background: var(--accent);
    color: white;
    padding: 0 1.5rem;
    height: 52px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.site-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.site-nav {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
    height: 100%;
}

.site-nav .nav-link {
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: background 0.15s;
}

.site-nav .nav-link:hover,
.site-nav .nav-link.active {
    background: rgba(255,255,255,0.18);
    color: white;
}

/* ─── Dropdown ─── */
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 100%;
}

.nav-dropdown-trigger {
    color: rgba(255,255,255,0.92);
    cursor: pointer;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    user-select: none;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-family: inherit;
    transition: background 0.15s;
}

.nav-dropdown-trigger:hover,
.nav-dropdown.open .nav-dropdown-trigger {
    background: rgba(255,255,255,0.18);
    color: white;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    margin: 0;
    padding: 0.375rem 0;
    list-style: none;
    background: white;
    min-width: 190px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    z-index: 200;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu li {
    margin: 0;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--fg);
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background 0.12s;
}

.nav-dropdown-menu a:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-logout {
    margin-left: 0.5rem;
    border-left: 1px solid rgba(255,255,255,0.25);
    padding-left: 0.75rem;
}

/* ─── Main ─── */
.site-main {
    flex: 1;
    padding: 2rem 1.5rem;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
}

/* ─── Page title ─── */
.site-main > h2:first-child,
.page-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--fg);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-light);
}

h2 {
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

/* ─── Footer ─── */
.site-footer {
    background: #2a3240;
    color: rgba(255,255,255,0.65);
    padding: 0.875rem 1.5rem;
    font-size: 0.8125rem;
    text-align: center;
}

.site-footer p {
    margin: 0;
}

/* ─── Tabelid ─── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

th, td {
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
}

tr:last-child td { border-bottom: none; }

tbody tr:hover {
    background: var(--accent-light);
}

/* ─── Vormid ─── */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    font-size: 0.9375rem;
    font-family: inherit;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--fg);
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.15);
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--fg-muted);
    margin-bottom: 0.3rem;
}

/* ─── Nupud ─── */
button, .btn {
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
    transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
    white-space: nowrap;
    border: none;
    background: var(--accent);
    color: white;
}

button:hover, .btn:hover {
    background: var(--accent-dark);
    box-shadow: var(--shadow-sm);
}

/* Sekundaarne nupp */
.btn-secondary {
    background: white;
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

/* Hävitusnupp */
.btn-danger {
    background: #c0392b;
    color: white;
}

.btn-danger:hover {
    background: #a93226;
}

/* Väike nupp */
.btn-sm {
    font-size: 0.8125rem;
    padding: 0.3rem 0.65rem;
}

/* Ikooni nupp (pliiats, prügi jms) – läbipaistev taust, nähtav ikoon */
.btn-icon {
    background: none;
    border: 1px solid transparent;
    color: var(--fg-muted);
    padding: 0.2rem 0.4rem;
    font-size: 1rem;
    line-height: 1;
    border-radius: var(--radius);
    box-shadow: none;
}

.btn-icon:hover {
    background: var(--accent-light);
    border-color: var(--border);
    color: var(--accent);
    box-shadow: none;
}

/* ─── Teated ─── */
.error, .alert-error {
    color: #7b1a1a;
    background: #fdecea;
    border: 1px solid #f5c6c2;
    border-left: 4px solid #c0392b;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.success, .alert-success {
    color: #1a4a2a;
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    border-left: 4px solid #27ae60;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.alert-info {
    color: #1a3a5f;
    background: var(--accent-light);
    border: 1px solid #b3d4e4;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

/* ─── Kaardid ─── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

/* ─── Filter-vorm (Eesti 100, tulemused jms) ─── */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.filter-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 110px;
}

.filter-form input,
.filter-form select {
    width: auto;
    min-width: 100px;
}

.filter-form .filter-submit {
    align-self: flex-end;
}

/* ─── Avaleht (dashboard) ─── */
.dashboard-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.dashboard-section h3 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.dashboard-links {
    margin: 0;
}

.dashboard-links dt {
    margin-top: 0.9rem;
    font-weight: 600;
    font-size: 0.9375rem;
}

.dashboard-links dt:first-child {
    margin-top: 0;
}

.dashboard-links dt a {
    color: var(--accent);
    text-decoration: none;
}

.dashboard-links dt a:hover {
    text-decoration: underline;
}

.dashboard-links dd {
    margin: 0.2rem 0 0 0;
    padding-left: 0;
    color: var(--fg-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.dashboard-footer {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--fg-muted);
}

/* ─── Import – rea muutmise paneel ─── */
.edit-row-panel {
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.edit-row-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.9375rem;
    color: var(--fg);
}

.edit-row-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: flex-end;
}

.edit-row-form label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fg-muted);
    min-width: 0;
}

.input-narrow {
    width: 4.5em !important;
    min-width: 0;
}

.edit-row-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    align-self: flex-end;
}

/* ─── Import – mitteklappivad nimed ─── */
.unmatched-names-table {
    margin: 0.75rem 0 1.25rem;
    border-collapse: collapse;
    width: 100%;
}
.unmatched-names-table th,
.unmatched-names-table td {
    padding: 0.5rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.unmatched-names-table th {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.inline-details {
    display: inline-block;
    margin-right: 0.75rem;
}
.inline-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.875rem;
    user-select: none;
}
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: flex-end;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--accent-light);
    border-radius: var(--radius);
}
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.field-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fg-muted);
    white-space: nowrap;
}
.field-group label small {
    font-weight: 400;
    color: var(--fg-muted);
}
.field-group--btn {
    justify-content: flex-end;
}
.search-results-cell {
    background: var(--bg-subtle);
    padding: 1rem !important;
    vertical-align: top;
}
.search-results-cell p {
    margin: 0 0 0.5rem;
}
.similar-names-table {
    margin-top: 0.5rem;
    border-collapse: collapse;
    width: 100%;
    max-width: 36rem;
}
.similar-names-table th,
.similar-names-table td {
    padding: 0.4rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.similar-names-table th {
    font-size: 0.8125rem;
}
.similar-names-table td a {
    color: var(--accent);
}
.similar-names-table td a:hover {
    text-decoration: underline;
}
.btn-small {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
}

/* ─── Abiklassid ─── */
.mt-0 { margin-top: 0; }
.mb-1 { margin-bottom: 1rem; }
.text-muted { color: var(--fg-muted); font-size: 0.875rem; }
.table-responsive { overflow-x: auto; }

/* ─── AVK tabel ─── */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.avk-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.875rem;
    background: white;
}

.avk-table th,
.avk-table td {
    padding: 0.5rem 0.85rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
}

.avk-table th {
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Grupipäised (1. rida päises): AVK ja Hooaeg */
.avk-table .col-group-header {
    text-align: center;
    background: var(--accent-dark);
    border-left: 3px solid rgba(255,255,255,0.25);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

/* Alampäised (2. rida päises): Sarjad, Kesk, Muutus, HA sarjad ... */
.avk-table thead tr:last-child th {
    background: #1f728f;
    font-size: 0.75rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    border-top: 1px solid rgba(255,255,255,0.15);
}

/* Grupipiir "Hooaeg" veergude alguses */
.avk-table thead tr:last-child th:nth-child(4),
.avk-table tbody td:nth-child(7) {
    border-left: 3px solid var(--accent-dark);
}

.avk-table .col-koht  { text-align: center; width: 3rem; }
.avk-table .col-nimi  { text-align: left; min-width: 10rem; }
/* col-klubi värvireegel ainult td-le, mitte th-le */
.avk-table td.col-klubi { color: var(--fg-muted); }
.avk-table .col-klubi   { text-align: left; min-width: 7rem; }
.avk-table .col-kesk    { font-weight: 700; }

.avk-table tbody tr:hover { background: var(--accent-light) !important; }
.avk-table tbody tr:nth-child(odd) { background: var(--bg-subtle); }

/* Muutuse värvikoodid */
.col-muutus {
    font-weight: 600;
    text-align: center;
    min-width: 5rem;
}

.muutus-pos  { color: #1e7e4a; }
.muutus-neg  { color: #c0392b; }
.muutus-zero { color: var(--fg-muted); font-weight: 400; }
.muutus-null { color: var(--fg-muted); font-weight: 400; }

/* Noole ikoon muutuse sees */
.muutus-arrow {
    display: inline-block;
    font-size: 0.7em;
    vertical-align: middle;
    margin-right: 0.15em;
    line-height: 1;
}

/* ─── Lehekülje ülaosa metainfo ─── */
.page-meta {
    font-size: 0.875rem;
    color: var(--fg-muted);
    margin-bottom: 1.25rem;
}

/* ─── Sisselogimise leht (index.php) ─── */
body.login-page {
    min-height: 100vh;
    background: var(--bg);
}

.login-header-only {
    justify-content: center;
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.75rem 1.5rem;
}

.login-heading {
    margin: 0 0 0.35rem 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--fg);
}

.login-lead {
    margin: 0 0 1.25rem 0;
    font-size: 0.875rem;
}

.login-form label {
    margin-top: 0.75rem;
}

.login-form label:first-of-type {
    margin-top: 0;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    margin-top: 0.25rem;
}

.login-form .error {
    margin-bottom: 0.5rem;
}

.login-actions {
    margin-top: 1.25rem;
}

.login-submit {
    width: 100%;
    padding: 0.55rem 1rem;
    font-size: 0.9375rem;
}

.login-footer {
    background: #2a3240;
    color: rgba(255, 255, 255, 0.65);
    padding: 0.75rem 1.5rem;
    font-size: 0.8125rem;
    text-align: center;
}

.login-footer p {
    margin: 0;
}
