/* am.css – Anschriftmeister */

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

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    margin: 1em 1.5em;
    color: #222;
    background: #f0f2f5;
}

h1 {
    margin: 0 0 0.6em;
    font-size: 1.35rem;
    color: #334;
}

/* ── Such-Bereich ──────────────────────────────────────────────────────────── */

#suchBereich {
    background: #bbffbb;
    border: 1px solid #88cc88;
    border-radius: 4px;
    padding: 0.5em 0.75em;
    margin-bottom: 0.5em;
}

/* ── Einzelfeld-Suche (oben, an Tabellenspalten ausgerichtet) ─────────────── */

#suchFelder {
    display: flex;
    border: 1px solid #88cc88;
    border-radius: 3px;
    overflow: hidden;
    background: white;
    margin-bottom: 0.4em;
}

.such-feld-huelle {
    flex-shrink: 0;
    border-right: 1px solid #aaccaa;
    min-width: 0;
}
.such-feld-huelle:last-child { border-right: none; }

.such-aktionen-platz { background: #eef8ee; }

.such-feld {
    display: block;
    width: 100%;
    padding: 0.25em 0.4em;
    border: none;
    outline: none;
    font: inherit;
    font-size: 0.9em;
    background: transparent;
}
.such-feld:focus { background: #fffde0; }

/* ── Sammelsuche (darunter) ───────────────────────────────────────────────── */

#suchSammel {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75em;
}

#suchEingabe {
    width: 25em;
    padding: 0.3em 0.6em;
    border: 1px solid #aaa;
    border-radius: 3px;
    font: inherit;
}

#zeilenJeSeite {
    width: 4.5em;
    padding: 0.2em 0.4em;
    border: 1px solid #aaa;
    border-radius: 3px;
    text-align: right;
    font: inherit;
}

/* ── Ergebnis-Bereich ──────────────────────────────────────────────────────── */

#ergebnisBereich {
    background: #ccffcc;
    border: 1px solid #88cc88;
    border-radius: 4px;
    padding: 0.5em 0.75em;
}

/* ── Tabellen-Wrapper (Horizontalscrolling bei schmalen Fenstern) ─────────── */

#tabellenWrapper {
    overflow-x: auto;
    width: 100%;
}

/* ── Tabelle ─────────────────────────────────────────────────────────────── */

#anschriftenTabelle {
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 100%;
    background: white;
    border: 1px solid #bbc;
}

/* Standard-Spaltenbreiten (verschiebbar per Griff) */
#anschriftenTabelle col:nth-child(1) { width: 12%; }   /* Vorname */
#anschriftenTabelle col:nth-child(2) { width: 15%; }   /* Name    */
#anschriftenTabelle col:nth-child(3) { width: 28%; }   /* Straße  */
#anschriftenTabelle col:nth-child(4) { width:  8%; }   /* PLZ     */
#anschriftenTabelle col:nth-child(5) { width: 19%; }   /* Ort     */
#anschriftenTabelle col:nth-child(6) { width: 3em; }   /* Aktions */

#anschriftenTabelle th,
#anschriftenTabelle td {
    border: 1px solid #ccd;
    padding: 0.28em 0.5em;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ── Kopf- und Fußzeile ─────────────────────────────────────────────────── */

.kopfzeile th {
    background: #d8e4f0;
    position: relative;
    padding-right: 1.8em;   /* Platz für Pfeil */
    user-select: none;
}

.sortierbarer-kopf { cursor: pointer; }
.sortierbarer-kopf:hover  { background: #c4d8ee; }
.sortierbarer-kopf.aktiv  { background: #a8c8ee; }

.sp-pfeil {
    position: absolute;
    right: 1.1em;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85em;
    color: #558;
    pointer-events: none;
}

.aktions-kopf {
    text-align: center;
    cursor: default;
    padding: 0.2em;
}

/* ── Resize-Griff ────────────────────────────────────────────────────────── */

.resize-griff {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    z-index: 1;
}

.resize-griff:hover { background: rgba(40, 70, 160, 0.25); }

/* ── Datenzeilen ─────────────────────────────────────────────────────────── */

#anschriftenTabelle tbody tr:nth-child(odd)  { background: #ffffff; }
#anschriftenTabelle tbody tr:nth-child(even) { background: #eeffee; }
#anschriftenTabelle tbody tr:hover           { background: #d0f0d0; }

.editierbar { cursor: pointer; }
.editierbar:hover { outline: 1px solid #99b; background: #fffde0; }

/* Name (Nachname) fett */
.feld-Name { font-weight: bold; }

.leer {
    text-align: center;
    color: #888;
    padding: 1em;
    font-style: italic;
}

/* ── Inline-Edit: Eingabephase ───────────────────────────────────────────── */

td.edit-aktiv {
    padding: 0;
    background: white !important;
    outline: 2px solid #4488ee;
    overflow: visible;
}

.edit-input {
    width: 100%;
    padding: 0.28em 0.5em;
    border: none;
    outline: none;
    font: inherit;
    background: transparent;
}

/* ── Inline-Edit: Bestätigungsphase ─────────────────────────────────────── */

td.edit-bestaetigung {
    background: #fff8e0 !important;
    outline: 2px solid #cc8800;
    overflow: visible;
    white-space: normal;
    cursor: default;
}

.edit-vorschau  { font-weight: bold; }

.edit-frage {
    display: block;
    font-size: 0.82em;
    color: #884400;
    margin-top: 0.15em;
    white-space: nowrap;
}

.edit-frage kbd {
    background: #eee;
    border: 1px solid #bbb;
    border-radius: 2px;
    padding: 0.05em 0.3em;
    font: inherit;
    font-size: 0.9em;
}

/* ── Aktionsspalte ───────────────────────────────────────────────────────── */

.aktions-zelle {
    text-align: center;
    padding: 0.15em;
}

.loeschBtn {
    border: 1px solid #aa0000;
    background: #cc0000;
    color: white;
    border-radius: 3px;
    cursor: pointer;
    padding: 0.1em 0.35em;
    line-height: 1;
    font-size: 1em;
    font-weight: bold;
}
.loeschBtn:hover { background: #880000; border-color: #880000; }

#neuBtn {
    border: 1px solid #007700;
    background: #009900;
    color: white;
    border-radius: 3px;
    cursor: pointer;
    padding: 0.1em 0.45em;
    line-height: 1;
    font-weight: bold;
    font-size: 1.1em;
}
#neuBtn:hover { background: #006600; border-color: #006600; }

/* ── Neue Zeile ─────────────────────────────────────────────────────────── */

.neu-zeile td { background: #fffff0 !important; }

.neu-zeile .edit-input {
    background: transparent;
    outline: 1px solid #cc8;
}
.neu-zeile .edit-input:focus { outline: 2px solid #aa6; }

.neuAbbrechen {
    border: 1px solid #888;
    background: #eee;
    color: #444;
    border-radius: 3px;
    cursor: pointer;
    padding: 0.1em 0.35em;
    line-height: 1;
}
.neuAbbrechen:hover { background: #ccc; }

/* ── Paginierung ─────────────────────────────────────────────────────────── */

#paginierung {
    display: flex;
    align-items: center;
    gap: 0.4em;
    margin-top: 0.5em;
    font-size: 0.9em;
    color: #444;
}

#paginierung button {
    padding: 0.2em 0.55em;
    border: 1px solid #aaa;
    border-radius: 3px;
    background: #e8e8e8;
    cursor: pointer;
    font-size: 0.95em;
}
#paginierung button:hover:not(:disabled) {
    background: #4080cc;
    color: white;
    border-color: #4080cc;
}
#paginierung button:disabled { opacity: 0.35; cursor: default; }
