/*@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700&display=swap');*/


/* ── Reset & Basis ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green-dark  : #1b5e20;
    --green       : #2e7d32;
    --green-mid   : #388e3c;
    --green-light : #e8f5e9;
    --red         : #c62828;
    --grey-bg     : #f5f5f5;
    --grey-border : #ddd;
    --text        : #212121;
    --text-muted  : #757575;
    --nav-h       : 64px;
    --header-h    : 52px;
}

html, body { height: 100%; background: var(--grey-bg); font-family: "Avenir"; color: var(--text); }

/* ── Header ────────────────────────────────────────────────── */
header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    /*font-family: 'Cinzel', serif;*/
    height: var(--header-h);
    background: var(--green);
    color: white;
    display: flex; align-items: center; justify-content: center;
    padding: 0 16px;

    font-size: 1.3rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,.3);
}

#btnReload {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0.85;
    transition: opacity .15s, transform .3s;
}
#btnReload:active { opacity: 1; }
#btnReload.spinning svg { animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Seiteninhalt ──────────────────────────────────────────── */
main {
    position: fixed;
    top: var(--header-h);
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); /* neu */
    left: 0; right: 0;
    overflow: hidden;
}

/* ── Tabs (Views) ──────────────────────────────────────────── */
.view { position: absolute; inset: 0; overflow-y: auto; display: none; }
.view.active { display: block; }

/* Karte-View hat eigene Regeln */
#viewMap { overflow: hidden; }
#map { width: 100%; height: 100%; }

/* ── Umschalter Standard-/Satellitenansicht ───────────────────── */
.btn-maptype {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 5;
    background: white;
    color: var(--text);
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    cursor: pointer;
}

.btn-maptype:active { background: var(--green-light); }

/* ── Karten-Filter ─────────────────────────────────────────── */
#mapFilterWrapper {
    position: absolute;
    top: 12px; left: 12px;
    z-index: 5;
}

.btn-mapfilter {
    background: white;
    color: var(--text);
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
    cursor: pointer;
}

.btn-mapfilter.active {
    background: var(--green);
    color: white;
}

.btn-mapfilter:active { background: var(--green-light); }

#mapFilterPanel {
    margin-top: 8px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

#mapFilterPanel select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--grey-border);
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
    color: var(--text);
}

/* ── Location-Liste ────────────────────────────────────────── */
.list-item {
    display: flex; align-items: center;
    background: white;
    border-bottom: 1px solid var(--grey-border);
    padding: 14px 16px;
    cursor: pointer;
    gap: 12px;
    -webkit-tap-highlight-color: transparent;
}

.list-item:active { background: var(--green-light); }

.list-item .icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--green-light); color: var(--green);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}

.list-item .info { flex: 1; min-width: 0; }
.list-item .info .title { font-weight: bold; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .info .sub   { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.list-item .arrow { color: var(--grey-border); font-size: 1.1rem; }

.empty-state { padding: 48px 24px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* ── Formular (Neu anlegen) ────────────────────────────────── */
.form-card {
    background: white;
    margin: 16px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    padding: 20px 16px;
}

.form-card h1 { font-size: 20px; margin-bottom: 16px; color: var(--green-dark); }
.form-card h2 { font-size: 16px; margin-top: 25px; margin-bottom: 16px; color: var(--green-dark); }


label { display: block; font-size: 0.82rem; font-weight: bold; color: var(--text-muted); margin-bottom: 4px; margin-top: 12px; }
label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--grey-border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--grey-bg);
    color: var(--text);
    outline: none;
    -webkit-appearance: none;
}

input:focus, textarea:focus { border-color: var(--green-mid); background: white; }
textarea { height: 80px; resize: none; }

.coords-row { display: flex; gap: 8px; align-items: flex-end; }
.coords-row > div { flex: 1; }

.btn-gps {
    padding: 12px 14px;
    background: var(--green-light);
    color: var(--green-dark);
    border: 1px solid var(--green-mid);
    border-radius: 8px;
    font-size: 1.3rem;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.btn-gps:active { background: #c8e6c9; }

/*Button*/
.btn-submit {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    background: var(--green-mid);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
}

.btn-submit:active { background: var(--green-dark); }
.btn-submit:disabled { background: #aaa; }

/* ── Detail-Sheet (über Karte) ─────────────────────────────── */
#detailSheet {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,.2);
    padding: 16px 16px 24px;
    transform: translateY(100%);
    transition: transform .3s ease, height .3s ease;
    overflow-y: auto;
    z-index: 10;
}

#detailSheet.open     { transform: translateY(0); }
#detailSheet.expanded { height: 75vh; }

#detailSheet .handle {
    width: 40px; height: 4px; border-radius: 2px;
    background: #ccc; margin: 0 auto 12px;
}

#detailSheet h3 { font-size: 1.05rem; margin-bottom: 6px; }
#detailSheet p  { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
p  { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }

.sheet-btn-row { display: flex; gap: 8px; margin-top: 16px; }

.btn-close {
    flex: 1; padding: 12px;
    background: var(--grey-bg); border: 1px solid var(--grey-border);
    border-radius: 8px; font-size: 0.9rem; cursor: pointer;
}

.btn-delete {
    padding: 12px 16px;
    background: #ffebee; color: var(--red);
    border: 1px solid #ffcdd2;
    border-radius: 8px; font-size: 0.9rem; cursor: pointer;
}

.btn-details {
    padding: 12px 16px;
    background: var(--green-light); color: var(--green-dark);
    border: 1px solid var(--green-mid);
    border-radius: 8px; font-size: 0.9rem; font-weight: bold; cursor: pointer;
}

.btn-details:active { background: #c8e6c9; }

/* ── Bottom Navigation ─────────────────────────────────────── */
nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); /* neu */
    background: white;
    border-top: 1px solid var(--grey-border);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom); /* neu */
}

.nav-btn {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; cursor: pointer;
    color: var(--text-muted); font-size: 0.68rem; font-weight: bold;
    border: none; background: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn .nav-icon { font-size: 1.5rem; }
.nav-btn.active { color: var(--green-dark); }

.nav-icon {
    width: 28px;
    height: 28px;
}

/* Standardmäßig: graues Icon sichtbar, grünes versteckt */
.nav-btn .active-icon  { display: none; }
.nav-btn .inactive     { display: block; }

/* Wenn Tab aktiv: grünes Icon sichtbar, graues versteckt */
.nav-btn.active .active-icon  { display: block; }
.nav-btn.active .inactive     { display: none; }



/* ── Toast ─────────────────────────────────────────────────── */
#toast {
    position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #323232; color: white;
    padding: 10px 20px; border-radius: 20px;
    font-size: 0.85rem; white-space: nowrap;
    opacity: 0; transition: opacity .3s, transform .3s;
    pointer-events: none; z-index: 200;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }




/* ── Native Dropdown (Select) ─────────────────────────────────
   Nutzt das Standard-<select>-Element: Aussehen & Verhalten des
   Auswahlmenüs (Aufklapp-Liste) übernimmt das Betriebssystem/Browser,
   nur der Rahmen des Felds wird hier gestylt. */
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--grey-border);
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--grey-bg);
    color: var(--text);
    outline: none;
    -webkit-appearance: none;
    appearance: none;

    /*Pfeil*/
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23388e3c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select:focus { border-color: var(--green-mid); background: white; }

input::placeholder,
textarea::placeholder {
    font-size: 0.85rem;
}

/* ── Radio-Gruppe ──────────────────────────────────────────── */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--grey-bg);
    border: 1px solid var(--grey-border);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    margin-top: 0;
}

.radio-option input[type="radio"] {
    width: auto;
    margin: 0;
}

.radio-option:has(input:checked) {
    background: var(--green-light);
    border-color: var(--green-mid);
    color: var(--green-dark);
}

.radio-option {
    font-weight: normal;
}


.input-unit-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-unit-row input {
    flex: 1;
}

.unit-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}


/* ── Plus-Button (Neu anlegen) ────────────────────────────────── */
.btn-add {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 16px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--green-mid);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add:hover { background: var(--green-dark); }

/* ── Zurück-Bar ────────────────────────────────────────────── */
.back-bar {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--grey-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-back {
    background: none;
    border: none;
    color: var(--green-mid);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
}

/* ── Tab-Tiere ────────────────────────────────────────────── */
.tiere-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-bottom: 2px solid var(--grey-border);
}

.tiere-filter-bar select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--grey-border);
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--grey-bg);
    color: var(--text);

    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23388e3c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.tiere-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.85rem;
}

.tiere-table th {
    padding: 10px 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--green-dark);
    text-align: left;
    background: var(--green-light);
    border-bottom: 2px solid var(--grey-border);
}

.tiere-table td {
    padding: 12px;
    border-bottom: 1px solid var(--grey-border);
}

.tiere-table tr { cursor: pointer; }
.tiere-table tr:active td { background: var(--green-light); }

.sichtungen-list-header {
    padding: 10px 16px;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--grey-bg);
    border-bottom: 1px solid var(--grey-border);
}

.back-bar-title {
    font-weight: bold;
    font-size: 1rem;
}

.tiere-filter-reset {
    font-size: 0.8rem;
    color: var(--green-mid);
    text-align: right;
    cursor: pointer;
    padding: 2px 0;
}

.tiere-filter-reset:active { color: var(--green-dark); }


/* ── Location Toggle ───────────────────────────────────────── */
.location-toggle {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.toggle-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--grey-border);
    border-radius: 8px;
    background: var(--grey-bg);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}

.toggle-btn.active {
    background: var(--green-light);
    border-color: var(--green-mid);
    color: var(--green-dark);
    font-weight: bold;
}

.sichtung-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
}

.btn-add-inline {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--green-mid);
    color: white;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add-inline:hover { background: var(--green-dark); }

.tiere-table th {
    white-space: nowrap;
}

/*Sichtungsliste*/
.tiere-table th:nth-child(1),
.tiere-table td:nth-child(1) { width: 20%; }

.tiere-table th:nth-child(2),
.tiere-table td:nth-child(2) { width: 22%; }

.tiere-table th:nth-child(3),
.tiere-table td:nth-child(3) { width: 28%; }

.tiere-table th:nth-child(4),
.tiere-table td:nth-child(4) { width: 30%; }


/*Tierliste*/
#tiereTableBody tr td:nth-child(1),
#tiereSubList table th:nth-child(1) { width: 10%; }

#tiereTableBody tr td:nth-child(2),
#tiereSubList table th:nth-child(2) { width: 25%; }

#tiereTableBody tr td:nth-child(3),
#tiereSubList table th:nth-child(3) { width: 35%; }


/*Sichtungsseite*/
.sichtung-filter-row {
    display: flex;
    flex-direction: column;
    background: white;
    padding: 10px 16px;
    gap: 8px;
    align-items: stretch;
    border-bottom: 1px solid var(--grey-border);

}

.sichtung-filter-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sichtung-filter-top select {
    flex: 1;
}

.sichtung-filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sichtung-filter-selects {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sichtung-filter-row select {
    flex: 1;
    max-width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--grey-border);
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--grey-bg);
    color: var(--text);
    appearance: none;
    -webkit-appearance: none;
    outline: none;

    /*Pfeil*/
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23388e3c' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;

}

