* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #059669;
    --danger: #dc2626;
    --bg: #ffffff;
    --surface: #f8fafc;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --transition: all 0.2s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
}

/* Dark Mode */
body.dark {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

/* Vollbild Karte - Hauptfokus */
#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* Loading mit Hinweistext */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    flex-direction: column;
    gap: 1rem;
}

.loading.show {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.loading-subtitle {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Minimale Info-Leiste */
.info-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    z-index: 100;
    transition: var(--transition);
}

.info-bar.hidden {
    transform: translateY(100%);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

/* Floating Action Buttons */
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 1rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-end;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    position: relative;
}

.fab:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.fab-secondary {
    width: 48px;
    height: 48px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 1.1rem;
    opacity: 0;
    transform: scale(0) translateY(20px);
    pointer-events: none;
}

.fab-menu.open .fab-secondary {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.fab-menu.open .fab-secondary:nth-child(2) { transition-delay: 0.05s; }
.fab-menu.open .fab-secondary:nth-child(3) { transition-delay: 0.1s; }
.fab-menu.open .fab-secondary:nth-child(4) { transition-delay: 0.15s; }
.fab-menu.open .fab-secondary:nth-child(5) { transition-delay: 0.2s; }
.fab-menu.open .fab-secondary:nth-child(6) { transition-delay: 0.25s; }
.fab-menu.open .fab-secondary:nth-child(7) { transition-delay: 0.3s; }

/* Tooltips */
.fab[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.fab:hover[data-tooltip]::before {
    opacity: 1;
}

/* Panels */
.panel {
    position: fixed;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    transition: var(--transition);
    max-height: 80vh;
    overflow-y: auto;
}

.panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.panel-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.panel-close:hover {
    background: var(--border);
}

.panel-content {
    padding: 1rem;
}

/* Suchpanel */
#searchPanel {
    top: 1rem;
    left: 1rem;
    width: min(400px, calc(100vw - 2rem));
}

.search-group {
    margin-bottom: 1rem;
}

.search-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Listenpanel */
#listPanel {
    top: 1rem;
    right: 1rem;
    width: min(350px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
}

.bookshelf-list {
    max-height: 60vh;
    overflow-y: auto;
}

.bookshelf-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.bookshelf-item:hover {
    background: var(--surface);
}

.bookshelf-item:last-child {
    border-bottom: none;
}

.bookshelf-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.bookshelf-details {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Favoriten Panel */
#favoritesPanel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(500px, calc(100vw - 2rem));
}

/* Einstellungen Panel */
#settingsPanel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(400px, calc(100vw - 2rem));
}

.settings-group {
    margin-bottom: 1.5rem;
}

.settings-group h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.theme-buttons {
    display: flex;
    gap: 0.5rem;
}

.theme-btn {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.theme-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-content {
    padding: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.popup-content {
    padding: 1rem;
    max-width: 280px;
}

.popup-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.popup-description {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.popup-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.popup-details {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.popup-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.popup-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.popup-btn-primary {
    background: var(--primary);
    color: white;
}

.popup-btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Autocomplete */
.autocomplete-container {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.autocomplete-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.autocomplete-suggestion:hover {
    background: var(--surface);
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
    .fab-container {
        bottom: 100px;
        right: 1rem;
    }

    .fab {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }

    .fab-secondary {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    #searchPanel, #listPanel {
        width: calc(100vw - 2rem);
    }

    #listPanel {
        top: auto;
        bottom: 120px;
        right: 1rem;
        max-height: 50vh;
    }

    .panel-content {
        padding: 0.75rem;
    }
}

/* Dark Mode */
body.dark .info-bar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body.dark .fab-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

body.dark .autocomplete-suggestions {
    background: var(--surface);
}

/* Animationen */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideUp 0.3s ease;
}

/* Zusätzliche Komponenten */
.statistics-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.statistics-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.statistics-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.filter-tag {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.filter-tag-remove {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}
