/**
 * Pleyamins Pössl Diary Styles
 */

:root {
    /* Dark theme colors */
    --bg-color: #222;
    --bg-secondary: #333;
    --bg-tertiary: #444;
    --text-color: #f1f1f1;
    --text-muted: #aaa;
    --accent-color: #57c69d;
    --accent-rgb: 87, 198, 157;
    --border-color: #555;
    --border-color-dark: #444;
    --card-bg: #2a2a2a;
    --input-bg: #333;
    --bg-primary: #222;
    --text-primary: #f1f1f1;
    --danger-color: #e74c3c;
    --header-height: 60px;
    --header-height-compact: 50px;
    --safe-chrome: env(safe-area-inset-top, 0px);
    --safe-top: var(--safe-chrome);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    /* Fixed header occupies content height + iOS notch / Dynamic Island */
    --header-offset: calc(var(--header-height) + var(--safe-top));
    --header-offset-compact: calc(var(--header-height-compact) + var(--safe-top));
    --animation-speed: 0.3s;
}

/* iOS-PWA: Notch/Island mindestens 47px, Header-Inhalt extra darunter */
html[data-poessl-ios="1"] {
    --safe-chrome: max(env(safe-area-inset-top, 0px), 47px);
    --safe-top: calc(var(--safe-chrome) + 12px);
}

html[data-theme="light"] {
    --bg-color: #e8eaed;
    --bg-secondary: #ffffff;
    --bg-tertiary: #dde1e7;
    --text-color: #1a1d21;
    --text-muted: #5c6370;
    --accent-color: #2d9d78;
    --accent-rgb: 45, 157, 120;
    --border-color: #c5cad3;
    --border-color-dark: #b0b6c0;
    --card-bg: #ffffff;
    --input-bg: #f3f5f7;
    --bg-primary: #e8eaed;
    --text-primary: #1a1d21;
    --danger-color: #c0392b;
}

/* Base styles */
html {
    scroll-behavior: smooth;
    background-color: var(--bg-color);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Bleibt stehen, wenn der Header wegscrollt — Uhr/Kamera nicht über Content */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--safe-chrome);
    background-color: var(--bg-color);
    z-index: 200;
    pointer-events: none;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #6ad3a8;
}

/* Header */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
    padding: 10px;
    padding-top: calc(10px + var(--safe-top));
    padding-left: max(10px, var(--safe-left));
    padding-right: max(10px, var(--safe-right));
    height: var(--header-offset);
    display: flex;
    flex-direction: column;
    transition: transform var(--animation-speed) ease, height var(--animation-speed) ease, opacity var(--animation-speed) ease;
}

#main-header.hidden {
    transform: translateY(-100%);
}

#main-header.hidden #menu-toggle {
    visibility: hidden;
}

#main-header.compact {
    height: var(--header-offset-compact);
}

#main-header.compact h1 {
    font-size: 1.3rem;
}

#main-header.compact .stats-bar {
    font-size: 0.75rem;
}

#main-header h1 {
    font-size: 1.5rem;
    margin: 0;
    text-align: center;
    padding: 0 40px;
    transition: font-size var(--animation-speed) ease;
}

/* Menu */
#menu-toggle {
    position: absolute;
    left: max(10px, var(--safe-left));
    top: calc(10px + var(--safe-top));
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    z-index: 102;
}

#main-menu {
    position: fixed;
    top: var(--header-offset);
    left: -250px;
    width: 250px;
    height: calc(100dvh - var(--header-offset));
    padding-bottom: var(--safe-bottom);
    background-color: var(--bg-secondary);
    transition: left var(--animation-speed) ease, top var(--animation-speed) ease, height var(--animation-speed) ease;
    z-index: 101;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Menu overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--animation-speed) ease, visibility var(--animation-speed) ease;
    z-index: 100;
    pointer-events: none;
    cursor: pointer;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

#main-menu.open {
    left: 0;
}

/* Ensure menu content stays clickable */
#main-menu > * {
    position: relative;
    z-index: 1;
}

#main-header.compact + #main-menu {
    top: var(--header-offset-compact);
    height: calc(100dvh - var(--header-offset-compact));
}

#main-menu ul {
    list-style: none;
    padding: 0;
}

#main-menu li {
    border-bottom: 1px solid var(--border-color);
}

#main-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    color: var(--text-color);
    transition: background-color 0.2s ease;
}

#main-menu a svg {
    flex-shrink: 0;
    opacity: 0.8;
}

#main-menu a:hover {
    background-color: var(--bg-tertiary);
}

#main-menu a.active {
    background-color: var(--accent-color);
    color: #fff;
}

/* Stats bar */
.stats-bar {
    display: flex;
    justify-content: space-around;
	background-color: var(--bg-color);
    padding: 10px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: font-size var(--animation-speed) ease;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    align-items: center;
    padding: 0 5px;
}

.stat svg {
    margin-right: 5px;
}

/* Search form */
.search-form {
    display: flex;
	background-color: var(--bg-color);
    margin: 4px 34px 0;
}

.search-form input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    outline: none;
}

.search-form button {
    background: none;
    border: none;
    color: var(--text-muted);
    margin-left: -35px;
    cursor: pointer;
}

/* Main content */
#main-content {
    padding: calc(var(--header-offset) + 40px) 15px 80px;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    padding-bottom: calc(80px + 60px); /* Original padding-bottom + approx height of new sticky nav */
}

#main-header.compact ~ #main-content {
    padding-top: calc(var(--header-offset-compact) + 15px);
}

/* Filter bar */
.filter-bar {
    margin-bottom: 15px;
    background-color: var(--bg-secondary);
    border-radius: 10px;
}

.filter-controls {
    display: flex;
    gap: 10px;
    padding: 10px;
}

.filter-button {
    display: flex;
    align-items: center;
    background-color: var(--bg-tertiary);
    border: none;
    color: var(--text-color);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    min-width: 100px;
}

.filter-button:hover {
    background-color: var(--accent-color);
}

.filter-button.active {
    background-color: var(--accent-color);
}

.filter-button svg {
    margin-right: 5px;
}

.search-wrapper {
    position: relative;
    flex: 1;
}

.search-wrapper input {
    width: 100%;
    padding: 8px 35px 8px 15px;
    border: none;
    border-radius: 20px;
    background-color: var(--bg-tertiary);
    color: var(--text-color);
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.search-wrapper input:focus {
    background-color: var(--bg-color);
    outline: 1px solid var(--accent-color);
}

.search-wrapper button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.search-wrapper button:hover {
    color: var(--accent-color);
}

.search-wrapper .search-clear {
    display: none;
}

.search-wrapper.has-value .search-clear {
    display: block;
}

.search-wrapper.has-value #search-button,
.search-wrapper.has-value #cl-search-btn {
    display: none;
}

/* Filter bar styling */
.filters {
    display: none;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.filters.open {
    display: flex;
    flex-direction: column;
}

.filter-row-main {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.filter-row-secondary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

@media (max-width: 480px) {
    .filter-row-secondary {
        grid-template-columns: 1fr;
    }
}

.filters select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    min-width: 0;  /* Allow flex items to shrink below content size */
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.filters select:hover {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}

.filters select:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.filters select option {
    background: var(--input-bg);
    color: var(--text-color);
    padding: 0.5rem;
}

/* Adjust filter text size on mobile */
@media (max-width: 480px) {
    .filters select {
        font-size: 0.8rem;
        padding: 0.4rem;
    }
}

/* Year shortcuts */
.year-shortcuts {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 15px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.year-link {
    scroll-snap-align: start;
    padding: 5px 10px;
    background-color: var(--bg-secondary);
    color: var(--text-color);
    border-radius: 15px;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.year-link:hover, .year-link.active {
    background-color: var(--accent-color);
    color: #fff;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 15px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background-color: var(--border-color);
    z-index: 1;
}

.year-marker {
    position: relative;
    background-color: var(--bg-color);
    padding: 10px 0 10px 25px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 20px 0 10px -15px;
    z-index: 2;
    transition: padding var(--animation-speed) ease, box-shadow var(--animation-speed) ease;
    display: flex;
    align-items: center;
    gap: 8px;
    scroll-margin-top: 80px;
}

.year-marker.sticky {
    position: sticky;
    top: var(--header-offset-compact);
    background-color: var(--bg-color);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

.year-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 15px;
    height: 15px;
    background-color: var(--accent-color);
    border-radius: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.year-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: normal;
}

/* Count for bucket list and checklist types - similar to year-count */
.bucket-list-count,
.checklist-type-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 8px; /* Add some space from the main title */
}

.checklist-item-count {
    font-size: 0.8rem; /* Slightly smaller for item count within a card */
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 6px;
    opacity: 0.8; /* Make it a bit more subtle */
}

/* Diary entries */
.diary-entry {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease;
    scroll-margin-top: calc(var(--header-offset) + 60px); /* Erhöhter Abstand für den sticky Header */
}

/* Temporale Hierarchie:
 *   - past   (.diary-entry, ohne Modifier): leicht gedaempft
 *   - ongoing(.diary-entry--ongoing)      : prominent (Akzent-Border links, staerkerer Hintergrund)
 *   - planned(.diary-entry--planned)      : dezente gruene Note, hebt Zukunft visuell ab
 *
 * Die Daempfung wird nur innerhalb der Timeline angewendet (nicht auf der
 * Share-Seite oder im Service-View), damit dort keine unerwuenschte
 * Transparenz auftritt.
 */
:root {
    --accent-future: #4caf7d; /* gedaempftes Reise-Gruen, gut sichtbar in light & dark */
}

.timeline .diary-entry:not(.diary-entry--ongoing):not(.diary-entry--planned) {
    opacity: 0.88;
}
.timeline .diary-entry:not(.diary-entry--ongoing):not(.diary-entry--planned) .entry-meta,
.timeline .diary-entry:not(.diary-entry--ongoing):not(.diary-entry--planned) .entry-title time {
    opacity: 0.85;
}

.diary-entry--planned {
    background-color: color-mix(in srgb, var(--accent-future) 8%, var(--bg-secondary));
    border-left: 3px solid color-mix(in srgb, var(--accent-future) 55%, transparent);
}

.diary-entry--ongoing {
    background-color: color-mix(in srgb, var(--accent-color) 14%, var(--bg-secondary));
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    border-left: 4px solid var(--accent-color);
}

html[data-theme="light"] .diary-entry--ongoing {
    background-color: color-mix(in srgb, var(--accent-color) 16%, var(--bg-secondary));
}

.entry-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    position: relative;
}

.entry-flag {
    margin-right: 10px;
    font-size: 1.3rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
}
.entry-flag .fi {
    width: 1.5em;
    height: 1.125em;
    border-radius: 2px;
    display: inline-block;
}

.entry-title {
    flex: 1;
}

.entry-title h3 {
    margin: 0;
    font-size: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


.entry-badge {
    flex-shrink: 0;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: middle;
}

.entry-badge--planned {
    color: var(--accent-future);
    border: 1px solid color-mix(in srgb, var(--accent-future) 60%, transparent);
    background-color: color-mix(in srgb, var(--accent-future) 14%, transparent);
}

.entry-badge--ongoing {
    color: var(--accent-color);
    border: 1px solid color-mix(in srgb, var(--accent-color) 70%, transparent);
    background-color: color-mix(in srgb, var(--accent-color) 18%, transparent);
    animation: entryBadgeOngoingPulse 2.4s ease-in-out infinite;
}

@keyframes entryBadgeOngoingPulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-color) 35%, transparent); }
    50%      { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-color) 0%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
    .entry-badge--ongoing { animation: none; }
}

.entry-title time {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.entry-title time .dates {
    white-space: nowrap;
}

.entry-title time .nights {
    font-size: 0.75rem;
    opacity: 0.9;
}

.entry-countdown {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.95;
}

.entry-countdown--ongoing {
    color: color-mix(in srgb, var(--accent-color) 75%, var(--text-muted));
}

.entry-stars {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 2.5rem;
    margin-right: 10px;
    font-size: 0.75rem;
}

.entry-toggle {
    transform: rotate(0deg);
    transition: transform 0.3s ease;
}

.diary-entry.expanded .entry-toggle {
    transform: rotate(180deg);
}

.entry-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.diary-entry.expanded .entry-content {
    max-height: 2000px;
}

.entry-location {
    padding: 0 15px 15px;
    display: flex;
    align-items: center;
}

.entry-location a {
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.entry-location svg {
    margin-right: 5px;
    flex-shrink: 0;
}

.entry-hashtags {
    padding: 0 15px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.hashtag {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 15px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hashtag:hover {
    background-color: var(--accent-color);
    color: #fff;
}

.entry-notes {
    padding: 0 15px 15px;
    border-bottom: 1px solid var(--border-color);
}

.entry-meta {
    padding: 15px;
}

.entry-pros, .entry-cons {
    margin-bottom: 10px;
}

.entry-details {
    display: flex;
    flex-wrap: wrap;
    margin-top: 15px;
    gap: 15px;
}

.detail {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.detail svg {
    margin-right: 5px;
}

.entry-photos {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 15px 0;
    -webkit-overflow-scrolling: touch;
}

.photo-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.photo-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
    image-orientation: from-image;
}

.photo-thumbnail:hover img {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Dialog-basierte Lightbox für Fotos */
#photoDialog {
    border: none;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: visible;
    margin: auto;
    position: relative;
    background: var(--bg-primary, #111);
}

#photoDialog .photo-dialog-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

#photoDialog .photo-dialog-nav:hover,
#photoDialog .photo-dialog-nav:focus {
    background: rgba(0, 0, 0, 0.7);
    outline: none;
}

#photoDialog .photo-dialog-prev {
    left: 8px;
}

#photoDialog .photo-dialog-next {
    right: 8px;
}

#photoDialog .dialog-content img.photo-loading {
    opacity: 0.85;
    filter: blur(1px);
}

#photoDialog .dialog-content {
    touch-action: pan-y pinch-zoom;
}

#photoDialog::backdrop {
    background-color: rgba(0, 0, 0, 0.8);
}

#photoDialog .dialog-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    max-width: inherit; /* Nimmt max-width vom Dialog */
    max-height: inherit; /* Nimmt max-height vom Dialog */
}

#photoDialog img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-orientation: from-image; /* Versucht, EXIF-Orientierung zu berücksichtigen */
}

#photoDialog .dialog-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

#photoDialog .dialog-close:hover,
#photoDialog .dialog-close:focus {
    background: rgba(0, 0, 0, 0.6);
    outline: none;
}

.entry-actions {
    padding: 0 15px 15px;
    display: flex;
    gap: 10px;
}

/* Checklists */
.checklist-section {
    margin-bottom: 30px;
}

.checklist-section > h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.checklist-section-body {
    display: block;
}

.checklist-card-heading {
    margin: 0 0 10px;
    font-size: 1rem;
}

.checklist-card-toggle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    padding: 6px 4px;
    margin: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.checklist-card-toggle:hover,
.checklist-card-toggle:focus {
    background-color: rgba(255, 255, 255, 0.06);
    outline: none;
}

html[data-theme="light"] .checklist-card-toggle:hover,
html[data-theme="light"] .checklist-card-toggle:focus {
    background-color: rgba(0, 0, 0, 0.06);
}

.checklist-card-chevron {
    flex-shrink: 0;
    transform: rotate(-90deg);
    transition: transform 0.2s ease;
    opacity: 0.85;
}

.checklist-card.is-open .checklist-card-chevron {
    transform: rotate(0deg);
}

.checklist-card-title {
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

.checklist-card-body[hidden] {
    display: none !important;
}

.checklist-card-body:not([hidden]) {
    display: block;
}

.checklist-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}


.checklist-items {
    margin-bottom: 15px;
}

.checklist-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.checklist-item-done label span {
    text-decoration: line-through;
    opacity: 0.55;
}
.checklist-item-link {
    color: var(--accent-color, #57c69d);
    word-break: break-all;
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.checklist-item input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 5px;
    flex-shrink: 0;
}

.checklist-checkbox:checked + span {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checklist-actions {
    display: flex;
    gap: 10px;
}

/* Bucket List */
.bucket-list h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.bucket-item {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bucket-item-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.bucket-item-header h3 {
    flex: 1;
    font-size: 1rem;
}

.bucket-flag {
    font-size: 1.3rem;
    margin-left: 10px;
}
.bucket-flag .fi {
    width: 1.5em;
    height: 1.125em;
    border-radius: 2px;
    display: inline-block;
}

/* Flag icons in tables and inline contexts */
td .fi {
    width: 1.4em;
    height: 1.05em;
    display: inline-block;
    vertical-align: middle;
}

.bucket-location {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.bucket-location a {
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.bucket-location svg {
    margin-right: 5px;
}

.bucket-details {
    margin-bottom: 10px;
}

.bucket-recommender {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 15px;
}

.bucket-actions {
    display: flex;
    gap: 10px;
}

/* No entries message */
.no-entries {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    background-color: var(--bg-tertiary);
    color: var(--text-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

.btn svg {
    margin-right: 5px;
}

.btn:hover {
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

.btn-primary {
    background-color: var(--accent-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: #6ad3a8;
    color: #fff;
}

.btn-edit svg, .btn-share svg, .btn-delete svg, .btn-convert svg {
    margin-right: 5px;
}

.btn-delete {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-delete:hover {
    background-color: #e55c4d;
    color: #fff;
}

.btn-add {
    margin-top: 10px;
    display: inline-flex;
}

/* Floating action button */
.fab-add {
    position: fixed;
    bottom: calc(20px + var(--safe-bottom));
    right: max(20px, var(--safe-right));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.fab-add:hover {
    transform: scale(1.05);
    background-color: #6ad3a8;
    color: white;
}

/* Edit form styles */
#edit-content {
    padding: calc(var(--header-offset-compact) + 15px) 15px 30px;
    max-width: 600px;
    margin: 0 auto;
}

/* Ort/Adresse: GPS + Google (edit.php diary / bucket) */
.location-field-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-field-row input[type="text"] {
    flex: 1;
    min-width: 0;
}

.location-textarea-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.location-textarea-row textarea {
    flex: 1;
    min-width: 0;
}

.btn-location-gps {
    flex-shrink: 0;
    align-self: center;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
}

.btn-location-gps svg {
    flex-shrink: 0;
    display: block;
    margin: 0;
    vertical-align: middle;
}

.btn-location-gps:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--bg-secondary) 50%, transparent);
    color: var(--text-primary);
}

.btn-location-gps:active:not(:disabled) {
    background-color: color-mix(in srgb, var(--bg-tertiary) 60%, transparent);
}

.btn-location-gps:disabled {
    opacity: 0.65;
    cursor: wait;
}

.location-status {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    min-height: 1.2em;
}

.location-bucket-search {
    margin-bottom: 0.75rem;
}

.location-search-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.location-bucket-search input[type="text"] {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--input-bg);
    color: var(--text-color);
}

.form-group.floating-label.location-tools-wrap > label {
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.form-group.floating-label.location-tools-wrap:has(.location-field-row input:focus) > label,
.form-group.floating-label.location-tools-wrap:has(.location-field-row input:not(:placeholder-shown)) > label,
.form-group.floating-label.location-tools-wrap:has(.location-field-row input.has-value) > label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--accent-color);
}

.form-group.floating-label.location-tools-wrap-textarea > label {
    top: 16px;
    transform: none;
}

.form-group.floating-label.location-tools-wrap-textarea:has(.location-textarea-row textarea:focus) > label,
.form-group.floating-label.location-tools-wrap-textarea:has(.location-textarea-row textarea:not(:placeholder-shown)) > label,
.form-group.floating-label.location-tools-wrap-textarea:has(.location-textarea-row textarea.has-value) > label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--accent-color);
}

body.page-location-edit .pac-container {
    z-index: 12000;
}

.back-button {
    position: absolute;
    left: max(10px, var(--safe-left));
    top: calc(12px + var(--safe-top));
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
    width: 100%;
}

/* Floating Labels */
.form-group.floating-label {
    position: relative;
}

.form-group.floating-label label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: all 0.2s ease;
    color: var(--text-muted);
    font-size: 0.9rem;
    background-color: var(--input-bg);
    padding: 0 4px;
    z-index: 1;
}

.form-group.floating-label textarea + label {
    top: 16px;
    transform: none;
}

.form-group.floating-label input:focus + label,
.form-group.floating-label input:not(:placeholder-shown) + label,
.form-group.floating-label input.has-value + label,
.form-group.floating-label select:focus + label,
.form-group.floating-label select.has-value + label,
.form-group.floating-label textarea:focus + label,
.form-group.floating-label textarea:not(:placeholder-shown) + label,
.form-group.floating-label textarea.has-value + label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--accent-color);
}

.form-group.floating-label select:not([value=""]) + label,
.form-group.floating-label select:has(option[selected]:not([value=""])) + label {
    top: 0;
    transform: translateY(-50%);
}

.form-group.floating-label select option[value=""] {
    display: none;
}

.form-group.floating-label textarea:focus + label,
.form-group.floating-label textarea:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%);
}

.form-group.floating-label input,
.form-group.floating-label select,
.form-group.floating-label textarea {
    padding-top: 18px;
    padding-bottom: 8px;
}

.form-group.floating-label textarea {
    padding-top: 20px;
}

.form-group.floating-label .input-with-unit {
    position: relative;
}

.form-field-hint {
    display: block;
    margin-top: 4px;
    margin-left: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.85;
}

/* Share-Seite: dezente Karten-Vorschau */
.share-map {
    width: calc(100% - 8px);
    height: 220px;
    margin: 10px 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    overflow: hidden;
}

/* Skeleton-Helper fuer Lade-Zustaende (App-weit nutzbar) */
.skeleton {
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--bg-secondary) 80%, transparent) 0%,
        color-mix(in srgb, var(--bg-secondary) 65%, transparent) 50%,
        color-mix(in srgb, var(--bg-secondary) 80%, transparent) 100%);
    background-size: 200% 100%;
    animation: cdShimmer 1.2s ease-in-out infinite;
    border-radius: 6px;
    color: transparent;
    user-select: none;
}
.skeleton-card {
    height: 84px;
    margin-bottom: 12px;
}
@keyframes cdShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; }
}

/* Icon-only Buttons (z.B. Löschen-Trash) */
.btn-icon-only {
    padding: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-icon-only svg {
    pointer-events: none;
}

/* Delete-Button: Icon + Text, ausgegraut bis hover */
.btn-delete-soft {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    opacity: .45;
    transition: opacity .15s;
}
.btn-delete-soft:hover,
.btn-delete-soft:focus-visible {
    opacity: 1;
}
.btn-delete-soft svg { pointer-events: none; flex-shrink: 0; }

/* Submit-Button Loading-State (wird automatisch waehrend Submit gesetzt) */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
    min-width: 0;          /* verhindert Groeßensprung */
}
.btn.is-loading::after {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1em;
    height: 1em;
    margin-top: -0.5em;
    margin-left: -0.5em;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    transform-origin: center center;
    animation: cdBtnSpin 0.7s linear infinite;
}
html[data-theme="light"] .btn.is-loading::after {
    border-color: rgba(0,0,0,.2);
    border-top-color: rgba(0,0,0,.7);
}
@keyframes cdBtnSpin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .btn.is-loading::after { animation: none; }
}

/* Connectivity-Banner */
.cd-connectivity-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    background: #f4efe4;
    color: #1c1a16;
    border: none;
    border-top: 3px solid #c9a227;
    border-radius: 0;
    padding: 12px 72px 12px 16px;
    padding-bottom: calc(12px + var(--safe-bottom, 0px));
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.cd-connectivity-banner.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.cd-connectivity-banner--offline {
    background: #f6e7b8;
    border-top-color: #c48a00;
}
.cd-connectivity-banner--online {
    background: #d8f0e4;
    border-top-color: var(--accent-color, #2d9d78);
}
body.cd-offline .fab-add {
    opacity: 0.42;
    pointer-events: none;
}
.cd-connectivity-dot {
    width: 10px;
    height: 10px;
    margin-top: 0.35em;
    flex-shrink: 0;
    border-radius: 50%;
    background: #8a5a00;
}
.cd-connectivity-banner--online .cd-connectivity-dot {
    background: var(--accent-color, #2d9d78);
}
.cd-connectivity-text {
    flex: 1;
    min-width: 0;
    white-space: normal;
    word-spacing: 0.06em;
}

/* Statistik: Zeitraum-Auswertung (von - bis) */
.period-stats-panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}
.period-stats-panel > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: baseline;
    gap: 10px;
    user-select: none;
}
.period-stats-panel > summary::-webkit-details-marker { display: none; }
.period-stats-panel > summary::after {
    content: '▾';
    margin-left: auto;
    opacity: 0.6;
    transition: transform 0.2s ease;
}
.period-stats-panel[open] > summary::after { transform: rotate(180deg); }
.period-stats-panel-title { font-weight: 600; }
.period-stats-panel-hint { font-size: 0.85rem; color: var(--text-muted); }

.period-stats-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}
.period-stats-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: flex-end;
}
/* compact floating-label inside period form */
.period-stats-fields .period-date-group {
    flex: 1 1 130px;
    margin-bottom: 0;
}
.period-stats-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
    align-self: flex-end;
    padding-bottom: 2px;
}
.period-stats-error {
    margin-top: 10px;
    color: var(--danger-color, #d9534f);
    font-size: 0.85rem;
}
/* date input: treat as always-filled (label stays up) so Safari doesn't hide label */
.period-stats-fields input[type="date"]:not([value=""]) + label,
.period-stats-fields input[type="date"]:focus + label,
.period-stats-fields input[type="date"].has-value + label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--accent-color);
}
/* fallback: always float label on date inputs (they always have a native value visually) */
.period-stats-fields .form-group.floating-label label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
}

.period-stats-heading {
    margin: 0 0 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 1.1rem;
}
.period-stats-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 6px;
}
.period-stats-block {
    margin-top: 0;
    padding-top: 16px;
    padding-bottom: 4px;
    border-top: 1px solid var(--border-color);
}
.period-stats-block h4 { margin: 0 0 8px; font-size: 0.95rem; }
.period-stats-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.period-stats-list li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.9rem;
}
.period-stats-meta {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.period-stats-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.period-stats-tag-count {
    opacity: 0.7;
    font-size: 0.8em;
    margin-left: 4px;
}

/* --- Period Map --- */
.period-map-block { margin-top: 24px; }

.period-map-canvas {
    width: 100%;
    aspect-ratio: 16 / 10;
    max-height: 70vh;
    min-height: 200px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-bg, #f0f0f0);
    position: relative;
}

.period-map-skeleton {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--card-bg, #e8e8e8) 25%, #d4d4d4 50%, var(--card-bg, #e8e8e8) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
}

.period-map-legend-wrap {
    margin-top: 8px;
}
.period-map-legend-wrap > summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.period-map-legend-wrap > summary::-webkit-details-marker { display: none; }
.period-map-legend-wrap > summary::after {
    content: '▾';
    opacity: 0.6;
    transition: transform 0.2s ease;
}
.period-map-legend-wrap[open] > summary::after {
    transform: rotate(180deg);
}

.period-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.period-map-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.period-map-legend-warn {
    color: var(--danger-color, #c0392b);
}

.period-map-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.period-map-status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-secondary {
    background: transparent;
    border: 1.5px solid var(--accent-color, #2d9d78);
    color: var(--accent-color, #2d9d78);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent-color, #2d9d78);
    color: #fff;
}

.btn-secondary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
/* --- End Period Map --- */

.form-group.floating-label .input-with-unit label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: all 0.2s ease;
    color: var(--text-muted);
    font-size: 0.9rem;
    background-color: var(--input-bg);
    padding: 0 4px;
    z-index: 1;
}

.form-group.floating-label .input-with-unit .unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    z-index: 2;
}

.form-group.floating-label .input-with-unit input:focus ~ label,
.form-group.floating-label .input-with-unit input.has-value ~ label,
.form-group.floating-label .input-with-unit input:not(:placeholder-shown) ~ label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--accent-color);
}

.form-group.floating-label .cost-input-wrapper {
    position: relative;
}

.form-group.floating-label .cost-input-wrapper label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: all 0.2s ease;
    color: var(--text-muted);
    font-size: 0.9rem;
    background-color: var(--input-bg);
    padding: 0 4px;
    z-index: 1;
}

.form-group.floating-label .cost-input-wrapper .cost-unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    z-index: 2;
}

.form-group.floating-label .cost-input-wrapper input:focus ~ label,
.form-group.floating-label .cost-input-wrapper input.has-value ~ label,
.form-group.floating-label .cost-input-wrapper input:not(:placeholder-shown) ~ label {
    top: 0;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--accent-color);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Mobile-first approach - everything stacks by default */
.form-row {
    flex-direction: column;
    width: 100%;
}

.form-row .form-group {
    width: 100%;
    margin-bottom: 1rem;
}

/* Date inputs styling */
.form-row:has(input[type="date"]) {
    flex-direction: column;
    width: 100%;
}

.form-row:has(input[type="date"]) .form-group {
    width: 100%;
}

/* Mileage and cost inputs always stack */
.form-group:has(input[name="mileage"]),
.form-group:has(.cost-switch) {
    width: 100%;
}

/* Cost section styling */
.cost-switch {
    margin-bottom: 1rem;
}

.cost-inputs {
    margin-top: 1rem;
}

.cost-input-wrapper {
    margin-bottom: 1rem;
    width: 100%;
    position: relative;
}

.cost-input-wrapper input {
    width: 100%;
}

.cost-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

/* Form Sections */
.form-section {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--accent-color);
}

.form-section-header svg {
    color: var(--accent-color);
    flex-shrink: 0;
}

.form-section-hashtag-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-section-hashtag-tools .hashtag-select-dropdown {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.9rem;
}

/* Larger address input */
textarea[name="location"] {
    min-height: 4rem;
    resize: vertical;
}

/* Larger stars */
.star-rating .stars {
    font-size: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.star-rating label {
    cursor: pointer;
    padding: 0.25rem;
}

/* Pros and cons always stack */
.form-row:has(textarea[name="pros"]),
.form-row:has(textarea[name="cons"]) {
    flex-direction: column;
}

textarea[name="pros"],
textarea[name="cons"] {
    min-height: 4rem;
    resize: vertical;
    width: 100%;
}

/* Sticky form toolbar: Löschen links, Abbrechen Mitte, Speichern rechts */
.form-actions {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.75rem 1rem;
    width: 100%;
}

.form-actions-start {
    justify-self: start;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    min-width: 0;
}

.form-actions-center {
    justify-self: center;
    flex-shrink: 0;
}

.form-actions-end {
    justify-self: end;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    min-width: 0;
    grid-column: 2;
}

/* Diary- und Bucket-Bearbeitung: dezente Feldhervorhebung */
:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label input,
:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label select,
:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label textarea {
    background-color: color-mix(in srgb, var(--input-bg) 76%, #ffffff4d);
}

html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label input,
html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label select,
html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label textarea {
    background-color: color-mix(in srgb, var(--input-bg) 94%, #ffffff4d);
}

:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label > label:first-of-type,
:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label.location-tools-wrap > label {
    background-color: color-mix(in srgb, var(--input-bg) 76%, #ffffff4d);
}

html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label > label:first-of-type,
html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label.location-tools-wrap > label {
    background-color: color-mix(in srgb, var(--input-bg) 94%, #ffffff4d);
}

:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label .input-with-unit label {
    background-color: color-mix(in srgb, var(--input-bg) 76%, #ffffff4d);
}

html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .form-group.floating-label .input-with-unit label {
    background-color: color-mix(in srgb, var(--input-bg) 94%, #ffffff4d);
}

body.page-diary-edit .edit-form .cost-input-wrapper input {
    background-color: color-mix(in srgb, var(--input-bg) 76%, #ffffff4d);
}

html[data-theme="light"] body.page-diary-edit .edit-form .cost-input-wrapper input {
    background-color: color-mix(in srgb, var(--input-bg) 94%, #ffffff4d);
}

body.page-diary-edit .edit-form .hashtag-select-dropdown {
    background-color: color-mix(in srgb, var(--input-bg) 76%, #ffffff4d);
}

html[data-theme="light"] body.page-diary-edit .edit-form .hashtag-select-dropdown {
    background-color: color-mix(in srgb, var(--input-bg) 94%, #ffffff4d);
}

body.page-diary-edit .edit-form .file-upload-dropzone {
    background-color: color-mix(in srgb, var(--bg-tertiary) 84%, #ffffff4d);
}

html[data-theme="light"] body.page-diary-edit .edit-form .file-upload-dropzone {
    background-color: color-mix(in srgb, var(--bg-tertiary) 94%, #ffffff4d);
}

:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .location-bucket-search input[type="text"] {
    background-color: color-mix(in srgb, var(--input-bg) 76%, #ffffff4d);
}

html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .location-bucket-search input[type="text"] {
    background-color: color-mix(in srgb, var(--input-bg) 94%, #ffffff4d);
}

/* Infotexte an Eingaben etwas kräftiger, bleiben aber sekundär */
:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .location-status,
:is(body.page-diary-edit, body.page-bucket-edit) .edit-form .location-search-label,
body.page-diary-edit .edit-form .file-upload-hint,
body.page-diary-edit .edit-form .input-with-unit .unit,
body.page-diary-edit .edit-form .cost-input-wrapper .cost-unit {
    color: color-mix(in srgb, var(--text-muted) 35%, var(--text-primary));
}

html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .location-status,
html[data-theme="light"] :is(body.page-diary-edit, body.page-bucket-edit) .edit-form .location-search-label,
html[data-theme="light"] body.page-diary-edit .edit-form .file-upload-hint,
html[data-theme="light"] body.page-diary-edit .edit-form .input-with-unit .unit,
html[data-theme="light"] body.page-diary-edit .edit-form .cost-input-wrapper .cost-unit {
    color: color-mix(in srgb, var(--text-muted) 42%, var(--text-primary));
}

.admin-failures-more {
    margin-top: 0.5rem;
}

.admin-failures-more summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--accent-color);
    font-size: 0.85rem;
    list-style-position: outside;
}

.admin-failures-more .admin-table {
    margin-top: 0.5rem;
}

/* Sticky form actions */
.form-actions-sticky {
    position: sticky;
    bottom: 0;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    padding: 15px 0;
    margin-top: 30px;
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    z-index: 10;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.form-actions-sticky .form-actions {
    margin-top: 0;
    /* Keep Löschen | Abbrechen | Speichern in one row on narrow screens */
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    /* Gleiche Buttonhöhe: Zeile so hoch wie der höchste Button, alle mitstrecken */
    align-items: stretch;
}

.form-actions-sticky .form-actions-start,
.form-actions-sticky .form-actions-center,
.form-actions-sticky .form-actions-end {
    display: flex;
    align-items: stretch;
}

.form-actions-sticky .form-actions .btn {
    white-space: nowrap;
    box-sizing: border-box;
    min-height: 2.75rem;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 520px) {
    .form-actions-sticky .form-actions {
        gap: 0.35rem 0.45rem;
    }

    .form-actions-sticky .form-actions .btn {
        min-height: 2.5rem;
        padding-left: 10px;
        padding-right: 10px;
        font-size: 0.82rem;
    }
}

/* Responsive input sizing */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
select:hover,
textarea:hover {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

select {
    cursor: pointer;
}

select option {
    background: var(--input-bg);
    color: var(--text-color);
    padding: 0.5rem;
}

/* Desktop overrides */
@media (min-width: 768px) {
    /* Enhanced desktop styles for select fields */
    select {
        font-size: 1rem;
        padding: 0.85rem;
    }
    
    .filters select {
        font-size: 1rem;
        padding: 0.6rem;
    }
    
    #map-filters select {
        font-size: 1rem;
        padding: 10px 14px;
    }
    
    .map-filters-collapsible select {
        font-size: 1rem;
        padding: 10px 14px;
    }
    
    /* Better spacing for filter container on desktop */
    .filters {
        gap: 1rem;
        padding: 1rem;
        margin-top: 1rem;
    }
    
    /* Better map filter layout on desktop */
    #map-filters {
        padding: 15px;
    }
    
    .map-filters-collapsible {
        gap: 15px;
        padding: 0 15px 15px 15px;
    }
}

/* Improved mobile spacing */
@media (max-width: 768px) {
    .edit-form {
        padding: 1rem 0.5rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    label {
        margin-bottom: 0.5rem;
        display: block;
        font-weight: 500;
    }
}

/* Star Rating */
.star-rating-with-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
}

.star-rating-with-label .stars-phrase {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: color-mix(in srgb, var(--text-muted) 28%, var(--text-primary));
    min-height: 1.35em;
    line-height: 1.2;
}

html[data-theme="light"] .star-rating-with-label .stars-phrase {
    color: color-mix(in srgb, var(--text-muted) 38%, var(--text-primary));
}

.star-rating {
    display: inline-block;
    position: relative;
    margin: 0.5rem 0;
}

.star-rating-with-label .star-rating {
    margin: 0;
}

.star-rating .stars {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.star-rating input[type="radio"] {
    display: none;
}

.star-rating label {
    font-size: 24px;
    color: #ddd;
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.2s ease-in-out;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input[type="radio"]:checked ~ label {
    color: #ffd700;
}

.star-rating:hover input[type="radio"]:checked ~ label {
    color: #ddd;
}

.star-rating:hover label:hover,
.star-rating:hover label:hover ~ label {
    color: #ffd700 !important;
}

/* File upload */
.file-upload-area {
    position: relative;
}

input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

.file-upload-dropzone:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-tertiary);
}

.file-upload-dropzone.drag-over {
    border-color: var(--accent-color);
    background-color: rgba(var(--accent-rgb), 0.1);
    transform: scale(1.02);
}

.file-upload-dropzone p {
    margin: 5px 0;
    color: var(--text-color);
}

.file-upload-link {
    color: var(--accent-color);
    text-decoration: underline;
    font-weight: 600;
}

.file-upload-hint {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 5px;
}

.file-upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.file-upload-area.has-files .file-upload-dropzone {
    margin-bottom: 20px;
}

.file-preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.file-preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.file-preview-name {
    padding: 8px;
    font-size: 0.85em;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    padding: 0 8px 8px 8px;
    font-size: 0.75em;
    color: var(--text-muted);
}

.file-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.file-preview-remove:hover {
    opacity: 1;
    transform: scale(1.1);
}

.file-upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.photo-item {
    width: 80px;
    height: 80px;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-orientation: from-image;
}

.delete-photo {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.8;
}

.delete-photo:hover {
    opacity: 1;
    color: white;
}

/* Checklist editor */
.item-edit-done input[type=text] {
    text-decoration: line-through;
    opacity: 0.55;
}
.checklist-item-input {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: stretch;
}

.checklist-item-input input[type="text"] {
    padding-top: 14px;
    padding-bottom: 14px;
    min-height: 48px;
    line-height: 1.4;
}

.checklist-item-input .remove-item {
    min-height: 48px;
    height: auto;
}

.checklist-items-count {
    margin-left: 6px;
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.95em;
}

@media (max-width: 900px), (hover: none) {
    body.page-checklist-edit #edit-content {
        padding-bottom: max(12rem, 35vh);
    }
}

.remove-item {
    background-color: var(--bg-tertiary);
    border: none;
    color: var(--text-color);
    width: 38px;
    height: 38px;
    border-radius: 5px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.remove-item svg {
    display: block;
    opacity: 0.9;
}

.remove-item:hover {
    background-color: var(--danger-color);
}

/* Flatpickr customization */
.flatpickr-calendar {
    background-color: var(--bg-secondary);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.flatpickr-day {
    color: var(--text-color);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background-color: #6ad3a8;
    border-color: #6ad3a8;
}

.flatpickr-day.inRange {
    background-color: rgba(var(--accent-rgb), 0.2);
    border-color: transparent;
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays,
span.flatpickr-weekday {
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--text-muted);
}

/* Media queries */
@media (min-width: 768px) {
    .filters {
        flex-wrap: nowrap;
    }
    
    .form-group {
        margin-bottom: 25px;
    }
    
    #main-content {
        padding-left: 25px;
        padding-right: 25px;
    }
    
    .entry-title time {
        flex-direction: row;
        gap: 5px;
    }
    
    .entry-title time .nights {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .entry-title time {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
}

/* Form fields */
textarea {
    min-height: 120px;
    resize: vertical;
}

textarea[name="notes"] {
    min-height: 200px;
}

/* Pros and Cons */
.entry-pros {
    color: var(--text-color);
    background-color: rgba(var(--accent-rgb), 0.1);
    padding: 8px 12px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.entry-pros strong {
    color: var(--accent-color);
}

.entry-cons {
    color: var(--text-color);
    background-color: rgba(231, 76, 60, 0.1);
    padding: 8px 12px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.entry-cons strong {
    color: var(--danger-color);
}

/* Increase form field sizes in edit form */
.edit-form input[type="text"],
.edit-form input[type="number"],
.edit-form textarea {
    padding: 12px;
    font-size: 1rem;
    line-height: 1.5;
}

.edit-form .form-group {
    margin-bottom: 25px;
}

.edit-form textarea[name="pros"],
.edit-form textarea[name="cons"] {
    min-height: 80px;
}

/* Statistics Page */
.stats-grid {
    display: grid;
    gap: 1rem;
    padding: 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 1rem;
    }
}

.stats-section {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stats-section h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.stats-table-wrapper {
    margin: -0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stats-table {
        width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

.stats-table th,
.stats-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.stats-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    padding-right: 20px;
}

.stats-table th[data-sort]::after {
    content: '⇅';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
}

.stats-table th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.stats-table th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

.stats-table td {
    font-variant-numeric: tabular-nums;
}

/* Price trend section */
.price-trend-section {
    grid-column: 1 / -1;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.price-trend-section h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.price-trend {
    margin-top: 15px;
    height: 200px;
    width: 100%;
    position: relative;
}

.price-trend svg {
    display: block;
    width: 100%;
    height: 100%;
}

.price-trend circle {
    transition: r 0.2s ease;
    cursor: pointer;
}

.price-trend circle:hover {
    r: 5;
}

.price-trend path {
    stroke: var(--accent-color);
    stroke-width: 2;
    fill: none;
}

.price-trend .axis-line {
    stroke: var(--border-color);
    stroke-width: 1;
}

.price-trend .axis-text {
    fill: var(--text-muted);
    font-size: 0.75rem;
}

.hashtag-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.hashtag-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color);
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    font-size: 0.85rem;
}

.hashtag-stat .count {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

@media (min-width: 768px) {
    .stats-section {
        padding: 1.5rem;
    }

    .stats-section h2 {
        font-size: 1.25rem;
    }

    .stats-table {
        font-size: 0.9rem;
    }

    .stats-table th,
    .stats-table td {
        padding: 0.75rem;
    }

    .hashtag-stats {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .hashtag-stat {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Sortable tables */
.sortable-table th[data-sort] {
    cursor: pointer;
    position: relative;
    padding-right: 20px;
}

.sortable-table th[data-sort]::after {
    content: '⇅';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
}

.sortable-table th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.sortable-table th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

/* Price trend */
.price-trend {
    margin-top: 15px;
    height: 50px;
    width: 100%;
}

.price-trend svg {
    display: block;
    width: 100%;
}

.price-trend circle {
    transition: r 0.2s ease;
}

.price-trend circle:hover {
    r: 5;
}

/* Cost switch */
.cost-switch {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.cost-switch input[type="radio"] {
    display: none;
}

.cost-switch label {
    flex: 1;
    text-align: center;
    padding: 8px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cost-switch input[type="radio"]:checked + label {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.cost-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cost-input-wrapper {
    position: relative;
}

.cost-input-wrapper input {
    width: 100%;
    padding-right: 80px;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.cost-input-wrapper input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cost-currency {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.cost-type-label {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Search bar with clear button */
.search-wrapper {
    position: relative;
}

.search-wrapper .search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.search-wrapper.has-value .search-clear {
    display: flex;
}

.search-wrapper.has-value #search-button,
.search-wrapper.has-value #cl-search-btn {
    display: none;
}

/* PWA standalone: do not pad body-top — the fixed header already includes
   --safe-top. Extra body padding stacked with a 60px header and crushed the
   hamburger under the iOS status bar / Dynamic Island. */
@media (display-mode: standalone) {
    body {
        padding-bottom: var(--safe-bottom);
        padding-left: var(--safe-left);
        padding-right: var(--safe-right);
    }
}

html[data-poessl-standalone="1"] body {
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

/* Input fields with units */
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit input {
    padding-right: 45px;
}

.unit {
    position: absolute;
    right: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

/* Cost inputs */
.cost-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cost-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.cost-input-wrapper input {
    width: 100%;
    padding-right: 85px;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.cost-input-wrapper input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cost-unit {
    position: absolute;
    right: 10px;
    color: var(--text-muted);
    pointer-events: none;
    white-space: nowrap;
}

/* Calendar input styling */
input[type="date"] {
    color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Dashboard Styles */
.dashboard {
    padding: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.kpi-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.kpi-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-card h3 {
    margin: 0 0 15px;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.chart {
    position: relative;
    height: 350px;
    width: 100%;
}

.chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Tables Grid */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.table-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-card.full-width {
    grid-column: 1 / -1;
}

.table-card h3 {
    margin: 0 0 15px;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-table th {
    font-weight: 600;
    background-color: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.dashboard-table .total-row {
    background-color: var(--bg-tertiary);
    font-weight: 600;
}

.dashboard-table .total-row td {
    border-top: 2px solid var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .tables-grid {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        padding: 15px;
    }

    .kpi-value {
        font-size: 1.2rem;
    }

    .kpi-icon {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .dashboard {
        padding: 10px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .chart {
        height: 250px;
    }
}

.menu-app-meta {
    padding: 4px 12px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.menu-app-version {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

html[data-poessl-standalone="0"] .menu-app-standalone {
    display: none;
}

html[data-poessl-standalone="1"] .menu-app-standalone {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* menu-nav-btn: Buttons in <li> that look like nav links */
.menu-li-btn {
    border-bottom: 1px solid var(--border-color);
}
.menu-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: inherit;
    cursor: pointer;
    text-align: left;
    opacity: 0.7;
    transition: background-color 0.2s ease;
}
.menu-nav-btn svg { flex-shrink: 0; opacity: 0.8; }
.menu-nav-btn:hover { background-color: var(--bg-tertiary); opacity: 1; }

/* Install-Li ausblenden wenn bereits als App installiert */
html[data-poessl-standalone="1"] #poessl-install-li { display: none !important; }

/* Pulsieren wenn PWA installierbar */
@keyframes cd-install-pulse {
    0%, 100% { opacity: 0.7; }
    50%       { opacity: 1; }
}
#poessl-install-li.install-available .menu-nav-btn,
#poessl-install-trigger.install-available {
    color: var(--accent-color, #57c69d);
    opacity: 0.85;
    animation: cd-install-pulse 2.2s ease-in-out infinite;
}
#poessl-install-li.install-available .menu-nav-btn svg,
#poessl-install-trigger.install-available svg {
    color: var(--accent-color, #57c69d);
    opacity: 1;
}

html[data-poessl-standalone="0"] .menu-app-install-link {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--accent-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

html[data-poessl-standalone="0"] .menu-app-install-link:hover {
    opacity: 0.92;
}

html[data-poessl-standalone="1"] .menu-app-install-link {
    display: none !important;
}

.menu-app-feedback-link {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    margin: 0 0 2px;
    font: inherit;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.65;
    color: var(--accent-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.menu-app-feedback-link:hover {
    opacity: 0.92;
}

/* Menu Footer */
.menu-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.menu-theme-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.poessl-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-color);
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.poessl-theme-toggle:hover,
.poessl-theme-toggle:focus {
    background: var(--card-bg);
    outline: none;
}

.poessl-theme-toggle svg {
    flex-shrink: 0;
    display: block;
}

.poessl-theme-toggle svg path {
    fill: currentColor;
}

.poessl-theme-toggle .theme-icon-moon {
    display: none;
}

html[data-theme="light"] .poessl-theme-toggle .theme-icon-sun {
    display: none;
}

html[data-theme="light"] .poessl-theme-toggle .theme-icon-moon {
    display: block;
}

#main-menu .menu-footer {
    margin-top: auto;
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

/* Version reload modal */
.version-reload-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.version-reload-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    text-align: center;
}

.version-reload-content h3 {
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.version-reload-content p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.version-reload-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.version-reload-btn:hover {
    background: #6ad3a8;
}

.version-reload-later {
    width: 100%;
    margin-top: 8px;
}

/* PWA Install dialog */
.poessl-install-modal.version-reload-modal {
    z-index: 10001;
}

.poessl-feedback-modal.version-reload-modal {
    z-index: 10002;
}

.poessl-feedback-dialog {
    max-width: 400px;
    text-align: left;
}

.poessl-feedback-dialog h3 {
    text-align: center;
    margin-top: 0;
    padding-right: 28px;
}

.poessl-feedback-lead {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    line-height: 1.45;
}

.poessl-feedback-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.poessl-feedback-textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 5.5rem;
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.45;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-color);
    resize: vertical;
}

.poessl-feedback-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.85;
}

.poessl-feedback-textarea:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.poessl-feedback-status {
    min-height: 1.35em;
    font-size: 0.85rem;
    margin: 10px 0 0;
    color: var(--text-muted);
}

.poessl-feedback-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.poessl-install-dialog-inner {
    position: relative;
    max-width: 400px;
    text-align: left;
}

.poessl-install-dialog-inner h3 {
    text-align: center;
    margin-top: 0;
    padding-right: 28px;
}

.poessl-dialog-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
}

.poessl-dialog-close:hover {
    color: var(--text-color);
    background: var(--bg-tertiary);
}

.poessl-install-body {
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.poessl-install-body p {
    margin: 0 0 12px;
    line-height: 1.45;
}

.poessl-install-steps {
    margin: 0 0 12px;
    padding-left: 1.25rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.poessl-install-steps li {
    margin-bottom: 8px;
}

.poessl-install-body .poessl-install-hint,
.poessl-install-hint {
    font-size: 0.88rem !important;
    margin-bottom: 0 !important;
}

.poessl-install-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.poessl-install-copy-url {
    background: var(--bg-tertiary) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
}

.poessl-install-copy-url:hover {
    background: var(--border-color) !important;
}

.poessl-install-close-btn {
    background: transparent !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border-color) !important;
}

.poessl-install-close-btn:hover {
    color: var(--text-color) !important;
    border-color: var(--text-muted) !important;
}

/* Soft page load animation */
@keyframes softFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#main-content > div {
    animation: softFadeIn 0.3s ease-out forwards;
    will-change: opacity, transform;
}

/* Stagger child animations for diary entries */
.timeline .diary-entry {
    opacity: 0;
    animation: softFadeIn 0.3s ease-out forwards;
}

.timeline .diary-entry:nth-child(1) { animation-delay: 0.05s; }
.timeline .diary-entry:nth-child(2) { animation-delay: 0.1s; }
.timeline .diary-entry:nth-child(3) { animation-delay: 0.15s; }
.timeline .diary-entry:nth-child(4) { animation-delay: 0.2s; }
.timeline .diary-entry:nth-child(5) { animation-delay: 0.25s; }
.timeline .diary-entry:nth-child(n+6) { animation-delay: 0.3s; }

/* Stagger animations for bucket list items */
.bucket-list .bucket-item {
    opacity: 0;
    animation: softFadeIn 0.3s ease-out forwards;
}

.bucket-list .bucket-item:nth-child(1) { animation-delay: 0.05s; }
.bucket-list .bucket-item:nth-child(2) { animation-delay: 0.1s; }
.bucket-list .bucket-item:nth-child(3) { animation-delay: 0.15s; }
.bucket-list .bucket-item:nth-child(4) { animation-delay: 0.2s; }
.bucket-list .bucket-item:nth-child(5) { animation-delay: 0.25s; }
.bucket-list .bucket-item:nth-child(n+6) { animation-delay: 0.3s; }

/* Stagger animations for checklist cards */
.checklist-card {
    opacity: 0;
    animation: softFadeIn 0.3s ease-out forwards;
}

.checklist-section:nth-child(1) .checklist-card { animation-delay: 0.05s; }
.checklist-section:nth-child(2) .checklist-card { animation-delay: 0.1s; }
.checklist-section:nth-child(3) .checklist-card { animation-delay: 0.15s; }

/* Stats page animations */
.dashboard .kpi-card {
    opacity: 0;
    animation: softFadeIn 0.3s ease-out forwards;
}

.dashboard .kpi-card:nth-child(1) { animation-delay: 0.05s; }
.dashboard .kpi-card:nth-child(2) { animation-delay: 0.1s; }
.dashboard .kpi-card:nth-child(3) { animation-delay: 0.15s; }
.dashboard .kpi-card:nth-child(4) { animation-delay: 0.2s; }

.dashboard .chart-card {
    opacity: 0;
    animation: softFadeIn 0.3s ease-out forwards;
    animation-delay: 0.25s;
}

.dashboard .table-card {
    opacity: 0;
    animation: softFadeIn 0.3s ease-out forwards;
    animation-delay: 0.3s;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    #main-content > div,
    .timeline .diary-entry,
    .bucket-list .bucket-item,
    .checklist-card,
    .dashboard .kpi-card,
    .dashboard .chart-card,
    .dashboard .table-card {
        animation: none;
        opacity: 1;
    }
}

.checklist-nav {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    z-index: 98;
    border-top: 1px solid var(--border-color);
    margin: 0;
    padding: 0.5rem 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.checklist-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: space-around;
}

.checklist-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.checklist-nav a.active {
    color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.1);
}

.checklist-nav svg {
    margin-bottom: 0.25rem;
}

.checklist-nav span {
    font-size: 0.8rem;
    white-space: nowrap;
}

.checklist-section {
    scroll-margin-top: calc(var(--header-offset) + 4rem);
    margin-bottom: 5rem; /* Add space for fixed navigation */
}

.checklist-section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    margin: 0.25rem 0;
    transition: all 0.2s;
    touch-action: pan-y pinch-zoom;
}

.checklist-item label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.delete-item {
    opacity: 0;
    background: none;
    border: none;
    color: var(--danger-color);
    font-size: 1.5rem;
    padding: 0 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.checklist-item:hover .delete-item {
    opacity: 1;
}

/* Touch: no swipe-delete — show trash so items can still be removed */
@media (hover: none) {
    .checklist-item .delete-item {
        opacity: 0.75;
    }
}

/* Add styles for checked items */
.checklist-item input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    opacity: 0.6;
}

/* Improve checkbox styling */
.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

/* Hide floating action button in checklists view */
.view-checklists .fab-add {
    display: none;
}

/* Add safe area padding for mobile devices */
@supports (padding: max(0px)) {
    .checklist-nav {
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }
}

/* Map View Specific Styles */
.map-view-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#map-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

#map-filters select,
#map-filters input[type="text"],
#map-filters button {
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

#map-filters select:hover,
#map-filters input[type="text"]:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-secondary);
}

#map-filters select:focus,
#map-filters input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

#map-filters select {
    cursor: pointer;
}

#map-filters select option {
    background: var(--input-bg);
    color: var(--text-color);
    padding: 0.5rem;
}

#map-filters .filter-buttons-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

#map-filters .filter-buttons-row button {
    flex-grow: 1;
}

#map-filters input[type="text"] {
    flex-grow: 1;
}

#map-filters button {
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
    border: none;
}

#map-filters button:hover {
    background-color: color-mix(in srgb, var(--accent-color) 78%, black);
}

/* Style for secondary buttons like 'Reset Filters' or 'Share' */
#map-filters .btn-secondary,
#map-share-section .btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color-dark);
}

#map-filters .btn-secondary:hover,
#map-share-section .btn-secondary:hover {
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

#map-share-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 15px;
    margin-bottom: 10px;
}

#map-share-link {
    flex-grow: 1;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid var(--border-color-dark);
    background-color: var(--bg-primary);
    color: var(--text-muted);
    font-size: 0.9rem;
}

#map-canvas {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Styles for the new map filter bar structure */
.map-filter-bar .filter-controls {
    display: flex;
    gap: 10px;
    padding: 10px;
}

.map-filter-bar .filter-button {
    /* Styles from existing .filter-button can be inherited or customized */
}

.map-filter-bar .search-wrapper {
    flex-grow: 1;
    position: relative;
}

.map-filter-bar .search-wrapper input {
    width: 100%;
    padding: 8px 35px 8px 15px;
    border: none;
    border-radius: 20px;
    background-color: var(--bg-tertiary);
    color: var(--text-color);
    font-size: 0.9rem;
}

.map-filter-bar .search-wrapper .search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: none; /* Initially hidden */
}

.map-filter-bar .search-wrapper.has-value .search-clear {
    display: block;
}

.map-filter-bar .search-wrapper.has-value #search-button {
    display: none;
}

.map-filters-collapsible {
    display: none; /* Hidden by default */
    flex-direction: column; /* Stack select dropdowns */
    gap: 10px;
    padding: 0 10px 10px 10px; /* Padding for when it's open */
}

.map-filters-collapsible.open {
    display: flex; /* Show when open */
}

.map-filters-collapsible select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.map-filters-collapsible select:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-secondary);
}

.map-filters-collapsible select:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.map-filters-collapsible select option {
    background: var(--input-bg);
    color: var(--text-color);
    padding: 0.5rem;
}

/* Container for data source toggles, above filter controls */
.map-source-toggle-container {
    padding: 10px 10px 0 10px; /* Add padding, especially at the top */
}

.map-source-toggle {
    display: flex;
    gap: 0; /* Remove gap, buttons will be 50% width */
}

.map-source-toggle .btn-toggle {
    flex: 1; /* Each button takes 50% width */
    padding: 10px 12px; /* Slightly larger padding */
    border: 1px solid var(--border-color-dark);
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    text-align: center;
    border-radius: 0; /* Remove individual radius if they are joined */
}

.map-source-toggle .btn-toggle:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    border-right: none; /* Avoid double border if colors are similar */
}

.map-source-toggle .btn-toggle:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.map-source-toggle .btn-toggle.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Reset button styling (X icon) */
.btn-reset-map {
    background-color: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px; /* Adjust padding for icon button */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Make it round */
}

.btn-reset-map:hover {
    background-color: var(--bg-tertiary); /* Subtle hover */
    color: var(--danger-color); /* Red on hover */
}

/* Ensure the map filter bar itself has the right base styling */
.map-filter-bar {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px; /* Space below the filter bar */
}

/* Adjustments for the existing #map-filters which is now .map-filter-bar */
#map-filters {
    /* This ID might be redundant or need adjustment if .map-filter-bar is the main container */
    /* display: flex; /* Original */
    /* flex-direction: column; /* Original */
    /* gap: 10px; /* Original */
    /* padding: 10px; /* Original */
    /* background-color: var(--bg-secondary); /* Original */
    /* border-radius: 8px; /* Original */
    /* border: 1px solid var(--border-color); /* Original */
}

#map-filters select,
#map-filters input[type="text"],
#map-filters button {
    /* These might be overridden by more specific selectors above */
}

#map-filters .filter-buttons-row {
   /* display: flex; /* Original */
   /* gap: 10px; /* Original */
   /* width: 100%; /* Original */
}

#map-filters .filter-buttons-row button {
    /* flex-grow: 1; /* Original */
}

/* Auto-save indicator for edit page */
.save-indicator {
    position: fixed;
    top: 20px; /* Adjust as needed, considering header or other elements */
    right: 20px;
    background-color: var(--accent-color);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    z-index: 1001; /* Ensure it's above other content */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.save-indicator.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* --- Service Entries --- */
.service-entry .entry-header {
    /* display: flex; /* Already in .diary-entry, inherited via .diary-entry class */
    /* align-items: center; */
    /* gap: 10px; */
}

.service-entry .entry-icon.service-icon {
    color: var(--accent-color); /* Using main accent color for consistency */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px; 
}

.service-entry .entry-title h3 {
    /* font-size: 1.1em; /* Inherited from .diary-entry */
}

.service-entry .vehicle-name {
    font-size: 0.9em;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.service-entry .entry-details .detail svg {
    fill: var(--text-muted); /* Einheitliche Ikon-Farbe, kann angepasst werden */
    min-width: 16px; 
    margin-right: 8px; /* Sicherstellen, dass der Abstand konsistent ist */
}

/* Styling für Details in Service-Einträgen, um es an Tagebuch-Details anzugliedern */
.service-entry .entry-details {
    padding: 0 15px 15px; /* Ähnliches Padding wie entry-location, entry-notes etc. */
    display: flex;
    flex-direction: row; /* Geändert von column zu row */
    flex-wrap: wrap; /* Erlaube Umbruch bei Bedarf */
    gap: 15px; /* Angepasst an Tagebuch-Details */
}

.service-entry .entry-details .detail {
    display: flex;
    align-items: center;
    font-size: 0.9rem; /* Gleiche Schriftgröße wie Tagebuch-Details */
    color: var(--text-muted); /* Gleiche Textfarbe wie Tagebuch-Details */
}

.service-entry .vehicle-name-detail {
    font-style: italic;
    /* color: var(--text-muted); optional, da schon im parent .detail gesetzt */
}

.service-entry .entry-notes p {
    margin-bottom: 10px; /* Etwas Abstand, falls Notizen und Details zusammenkommen */
}

/* Ensure service entries look exactly like diary entries by sharing the base class styles */
/* .diary-entry class provides base styling for all timeline entries (diary and service) */
.service-entry {
    /* background-color: var(--bg-secondary); /* from .diary-entry */
    /* border: 1px solid var(--border-color); /* from .diary-entry */
    /* border-radius: var(--border-radius-m); /* from .diary-entry */
    /* margin-bottom: 15px; /* from .diary-entry */
    /* box-shadow: var(--shadow-elevation-low); /* from .diary-entry */
}

.service-entry .entry-content {
    /* padding: 10px 15px 15px 15px; /* from .diary-entry if it has content padding */
    /* If .diary-entry has specific content padding, ensure it's applied or defined here */
}


/* Year marker and entry grouping, ensure it works for service view too */
.year-marker {
    position: relative;
    background-color: var(--bg-color);
    padding: 10px 0 10px 25px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 20px 0 10px -15px;
    z-index: 2;
    transition: padding var(--animation-speed) ease, box-shadow var(--animation-speed) ease;
    display: flex;
    align-items: center;
    gap: 8px;
    scroll-margin-top: 80px;
}

.year-marker.sticky {
    position: sticky;
    top: var(--header-offset-compact);
    background-color: var(--bg-color);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

.year-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 15px;
    height: 15px;
    background-color: var(--accent-color);
    border-radius: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.year-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: normal;
}

/* Count for bucket list and checklist types - similar to year-count */
.bucket-list-count,
.checklist-type-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 8px; /* Add some space from the main title */
}

.checklist-item-count {
    font-size: 0.8rem; /* Slightly smaller for item count within a card */
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 6px;
    opacity: 0.8; /* Make it a bit more subtle */
}

body.view-checklists .checklist-type-nav-sticky { /* Increased specificity */
    display: flex;
    justify-content: space-around;
    background-color: var(--bg-secondary);
    padding: 10px 0;
    position: fixed !important;
    bottom: 0 !important; /* Changed to 0 for very bottom */
    top: auto !important;
    left: 0;
    right: 0;
    z-index: 90;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    border-radius: 8px 8px 0 0; /* Keep rounded top corners */
}

/* Remove or adjust these rules as they are for top stickiness */
/* #main-header.compact ~ #main-content .checklist-type-nav-sticky {
    top: var(--header-height-compact);
}

#main-header:not(.compact) ~ #main-content .checklist-type-nav-sticky {
    top: var(--header-height);
} */

.checklist-type-nav-sticky a.checklist-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition: background-color var(--animation-speed) ease, color var(--animation-speed) ease;
    flex-grow: 1;
    text-align: center;
}

.checklist-type-nav-sticky a.checklist-nav-item svg {
    width: 24px; /* Adjust as needed */
    height: 24px; /* Adjust as needed */
    margin-bottom: 4px;
    fill: currentColor; /* Inherit color from parent <a> */
}

.checklist-type-nav-sticky a.checklist-nav-item span {
    font-size: 0.8em;
    display: block;
}

.checklist-type-nav-sticky a.checklist-nav-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-color);
}

.checklist-type-nav-sticky a.checklist-nav-item.active {
    background-color: var(--accent-color);
    color: white;
}

/* Adjust main content padding if checklists view */
body.view-checklists #main-content {
    /* Add a bit more top padding to account for the sticky nav */
    /* The actual sticky nav height might vary, adjust this if needed */
    /* padding-top: calc(var(--header-height) + 40px + 70px); /* header + original_padding + approx_sticky_nav_height */
}

/* #main-header.compact ~ body.view-checklists #main-content { */
    /* padding-top: calc(var(--header-height-compact) + 15px + 70px); */
/* } */

/* Add padding to the bottom of the main content to prevent overlap by the new bottom sticky nav */
#main-content {
    /* ... existing styles ... */
    padding-bottom: calc(80px + 60px); /* Original padding-bottom + approx height of new sticky nav */
}

/* If the FAB is present with the bottom sticky nav, ensure it's above the nav */
.fab-container {
    /* ... existing styles ... */
    z-index: 95; /* Ensure FAB is above the checklist nav (z-index 90) */
    bottom: calc(20px + 60px); /* Original bottom + approx height of new sticky nav */
}

/* Auth overlay and modal */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-overlay-standalone {
    background: var(--bg-color);
}

.auth-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.auth-modal h2 {
    margin-bottom: 8px;
    font-size: 1.5rem;
    color: var(--text-color);
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.auth-form-group {
    margin-bottom: 15px;
}

.auth-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.auth-form-group input {
    width: 100%;
    padding: 12px 15px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
}

.auth-form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

@keyframes modal-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.auth-modal.shake,
.admin-form.shake {
    animation: modal-shake 0.5s ease-in-out;
}

.auth-error {
    color: var(--danger-color);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.auth-submit {
    width: 100%;
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.auth-submit:hover {
    background: #6ad3a8;
}

/* Share modal */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.share-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 480px;
    position: relative;
}

.share-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.share-modal-close:hover {
    color: var(--text-color);
}

.share-modal-content h3 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.share-modal-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.share-modal-url {
    display: flex;
    gap: 10px;
}

.share-modal-url input {
    flex: 1;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.9rem;
}

.btn-copy {
    flex-shrink: 0;
}

/* Share page */
.share-page .main-content {
    padding-top: calc(var(--header-offset-compact) + 14px);
    padding-bottom: 40px;
}

.share-notice {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 24px;
    margin-bottom: 0;
    text-align: center;
    opacity: .55;
    order: 99;
}

/* Share-Article: max-width wie main-app, zentriert */
#share-content article {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

.share-entry .entry-content,
.share-entry.entry-content {
    display: block;
    max-height: none;
    overflow: visible;
}

.share-entry .entry-header {
    cursor: default;
}

.share-entry .entry-header .entry-toggle {
    display: none;
}

.share-entry .entry-flag .fi,
.share-entry .bucket-flag .fi {
    width: 1.5em;
    height: 1.125em;
    display: inline-block;
    vertical-align: middle;
    border-radius: 2px;
}

.share-expand-btn {
    background: none; border: none; padding: 0; cursor: pointer;
    font: inherit; font-size: .82rem; color: var(--accent-color, #57c69d);
    margin-top: .2rem; display: inline-block;
}
.share-expand-btn:hover { text-decoration: underline; }
.photo-thumbnail-static { display: inline-block; cursor: default; }

.share-expired {
    text-align: center;
    padding: 60px 20px;
}

.share-expired h2 {
    margin-bottom: 15px;
    color: var(--text-color);
}

.share-expired p {
    color: var(--text-muted);
}

/* Photo dialog (div-based for share page) */
.photo-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.photo-dialog .photo-dialog-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.photo-dialog img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.photo-dialog .dialog-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.photo-dialog .dialog-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Admin view */
.admin-view {
    max-width: 600px;
    padding: 20px 0;
}
.admin-view h2 {
    margin-bottom: 24px;
}
.admin-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}
.admin-section:last-child {
    border-bottom: none;
}
.admin-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.admin-form .form-group {
    margin-bottom: 16px;
}
.admin-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.admin-form input[type="password"] {
    width: 100%;
    max-width: 300px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.admin-message {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}
.admin-message.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}
.admin-message.error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}
.admin-table-wrapper {
    overflow-x: auto;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.admin-table th {
    color: var(--text-muted);
    font-weight: 500;
}
.admin-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.admin-backup-hint,
.admin-app-identity-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
    margin: 0 0 14px;
}
.admin-app-identity-hint code,
.admin-backup-hint code {
    font-size: 0.85em;
}

.admin-field-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.admin-accent-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
    margin: 0 0 12px;
}

.admin-accent-default-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-color);
    max-width: 420px;
    line-height: 1.4;
}

.admin-accent-default-label input {
    margin-top: 4px;
    flex-shrink: 0;
}

.admin-accent-custom-wrap.is-disabled {
    opacity: 0.55;
}

.admin-accent-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#admin-app-accent-picker {
    width: 48px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-secondary);
}

#admin-app-accent-picker:disabled {
    cursor: not-allowed;
}

.admin-accent-hex {
    width: 7.5rem;
    max-width: 100%;
    font-family: ui-monospace, monospace;
}

.admin-form input[type="text"] {
    width: 100%;
    max-width: 360px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ── App splash screen (standalone / installed PWA only) ─────────── */
#app-splash {
    position: fixed;
    inset: 0;
    z-index: 9100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    background: var(--bg-color, #222);
    transition: opacity .45s ease;
}
#app-splash img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}
#app-splash-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color, #f1f1f1);
    letter-spacing: .02em;
}
#app-splash.app-splash--hidden {
    opacity: 0;
    pointer-events: none;
}


/* ── App-wide confirm dialog ──────────────────────────────────────── */
.app-confirm-dialog {
    border: none;
    border-radius: 16px;
    background: var(--bg-secondary, #333);
    color: var(--text-color, #f1f1f1);
    padding: 0;
    max-width: 300px;
    width: calc(100% - 2rem);
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    /* centre via top/left when showModal() centres automatically;
       fallback for browsers that don't auto-centre */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}
.app-confirm-dialog::backdrop {
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
}
.app-confirm-inner {
    padding: 1.4rem 1.4rem 1.2rem;
}
.app-confirm-msg {
    margin: 0 0 1.1rem;
    font-size: 1rem;
    line-height: 1.4;
}
.app-confirm-btns {
    display: flex;
    gap: .6rem;
    justify-content: flex-end;
}

/* ── KM-Prompt: eingebetteter Input im Dialog ────────────────────── */
.km-prompt-input-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .1rem 0 1rem;
}
.km-prompt-input {
    flex: 1;
    padding: .55rem .75rem;
    border: 1.5px solid var(--border-color, #555);
    border-radius: 8px;
    background: var(--input-bg, #1a1a1a);
    color: var(--text-color);
    font-size: 1.05rem;
    min-width: 0;
}
.km-prompt-input:focus {
    outline: none;
    border-color: var(--accent-color, #2d9d78);
}
.km-prompt-unit {
    font-size: .9rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Shared dialog close button (X oben rechts) ──────────────────── */
.app-dialog-close {
    position: absolute;
    top: .55rem;
    right: .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-color);
    opacity: .5;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s, background .15s;
    z-index: 2;
}
.app-dialog-close:hover { opacity: 1; background: rgba(128,128,128,.15); }

/* X-Close im Edit-Header (ist ein <a>-Tag, kein Button) */
.edit-header-close {
    position: absolute;
    right: max(.75rem, var(--safe-right));
    top: calc(var(--safe-top) + (var(--header-height-compact) / 2));
    transform: translateY(-50%);
}

/* ── Checklist share dialog ───────────────────────────────────────── */
.cl-share-dialog {
    border: none;
    border-radius: 16px;
    background: var(--bg-secondary, #333);
    color: var(--text-color, #f1f1f1);
    padding: 0;
    max-width: 320px;
    width: calc(100% - 2rem);
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}
.cl-share-dialog::backdrop {
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
}
.cl-share-dialog-inner {
    position: relative;
    padding: 1.4rem 1.4rem 1.2rem;
}
.cl-share-dialog-title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0 0 .25rem;
}
.cl-share-dialog-hint {
    font-size: .85rem;
    opacity: .7;
    margin: 0 0 1rem;
}
.cl-share-dialog-btns {
    display: flex;
    gap: .6rem;
}
.cl-share-dialog-btns .btn {
    flex: 1;
}
.cl-share-dialog-close {
    /* inherits all positioning from .app-dialog-close */
}

/* ── Checklist share toast ────────────────────────────────────────── */
.cl-share-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-color, #4CAF50);
    color: #fff;
    padding: .55rem 1.2rem;
    border-radius: 20px;
    font-size: .9rem;
    pointer-events: none;
    z-index: 9999;
    animation: cl-toast-in .2s ease;
}
@keyframes cl-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Admin backup import details ─────────────────────────────────── */
.admin-import-details {
    margin-top: .6rem;
}
.admin-import-details summary {
    cursor: pointer;
    color: var(--accent-color, #4CAF50);
    font-size: .9rem;
    user-select: none;
}
.admin-import-details summary:hover { opacity: .8; }
.admin-import-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: .6rem;
}
.admin-import-form input[type="file"] {
    flex: 1;
    min-width: 0;
    font-size: .85rem;
    color: var(--text-color, #f1f1f1);
}
