/* ===== HEADER STYLES ===== */

#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 0 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 2000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-home-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    overflow: hidden;
    cursor: pointer;
}

.header-logo {
    height: 35px;
    width: auto;
}

#header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--title-color, var(--primary-color));
}

/* Header Tools Container */
.header-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Header Tool Buttons (40x40px einheitlich) */
.header-tool-btn,
a.header-tool-btn,
button.header-tool-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-sizing: border-box;
    text-decoration: none;
    padding: 0;
    margin: 0;
    line-height: 1;
    flex-shrink: 0;
    flex-grow: 0;
}

.header-tool-btn:hover,
a.header-tool-btn:hover,
button.header-tool-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.header-tool-btn.active,
a.header-tool-btn.active,
button.header-tool-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* Hamburger Menu Button - oben rechts */
.menu-btn {
    width: 40px;
    height: 40px;
    background: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.menu-btn:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
}

.menu-btn.active {
    background: var(--primary-color);
    color: #fff;
}

/* Hamburger Lines für CSS-only Version */
.hamburger {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    margin: 4px 0;
    transition: 0.3s;
}

/* ===== SEARCH PANEL ===== */

.search-panel {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: transparent;
    padding: 12px 15px;
    z-index: 1900;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    pointer-events: none;
}

.search-panel.visible {
    transform: translateY(0);
}

.search-container {
    position: relative;
    width: 320px;
    max-width: calc(100% - 30px);
    margin: 0 auto;
    pointer-events: auto;
}

#placeSearch {
    width: 100%;
    padding: 10px 36px 10px 40px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

#placeSearch:focus {
    border-color: var(--primary-color);
    box-shadow: 0 2px 12px rgba(var(--primary-color-rgb), 0.3);
}

.search-container .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
}

.clear-search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
}

.clear-search-btn:hover {
    background: rgba(var(--primary-color-rgb), 0.15);
    color: var(--primary-hover);
}

.clear-search-btn.visible {
    display: flex;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 4px 0 0 0;
    padding: 0;
    list-style: none;
    background: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    max-height: min(65vh, 440px);
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.search-results.visible {
    display: block;
}

.search-results li {
    padding: 7px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    line-height: 1.35;
    color: #444;
}

/* Touch-Geräte: Einträge wieder komfortabel (Mindest-Trefferfläche ~44px) */
@media (pointer: coarse) {
    .search-results {
        max-height: min(70vh, 520px);
    }
    .search-results li:not(.search-section-header) {
        padding-top: 11px;
        padding-bottom: 11px;
        min-height: 44px;
        box-sizing: border-box;
    }
}

.search-results li:last-child {
    border-bottom: none;
}

.search-results li:hover,
.search-results li.selected {
    background: rgba(var(--primary-color-rgb), 0.08);
}

.search-results li mark {
    background: transparent;
    color: var(--primary-color);
    font-weight: 600;
}

/* ===== POI-Suche-Integration (2. Sektion) ===== */
.search-results li.search-section-header {
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #888;
    background: #f3f5f7;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 6px;
}
.search-results li.search-section-header:hover {
    background: #f3f5f7;
}
.search-results li.search-poi-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-results li.search-poi-item .search-poi-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}
.search-results li.search-poi-item .search-poi-icon-fa {
    width: 20px;
    text-align: center;
    color: #888;
    flex-shrink: 0;
}
.search-poi-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-poi-badge {
    font-size: 10px;
    color: #666;
    background: #eef2f5;
    border-radius: 8px;
    padding: 1px 7px;
    white-space: nowrap;
    flex-shrink: 0;
}
.search-results li.search-more-item {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
    padding: 7px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.search-results li.search-more-item:hover {
    background: rgba(var(--primary-color-rgb), 0.08);
}

/* ===== ALKIS-PROVIDER (Straße + Hausnummern) ===== */

.search-results li.alkis-street-item,
.search-results li.alkis-street-selected {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-results li.alkis-street-selected {
    background: rgba(var(--primary-color-rgb), 0.08);
    font-weight: 500;
    cursor: default;
}

.alkis-street-icon {
    color: var(--primary-color);
    font-size: 14px;
    flex-shrink: 0;
}

.search-results li.alkis-houses-row {
    padding: 10px 14px 12px;
    cursor: default;
    background: #fafafa;
    border-bottom: none;
}

.search-results li.alkis-houses-row:hover {
    background: #fafafa;
}

.alkis-houses-label {
    font-size: 12px;
    color: #777;
    margin-bottom: 6px;
}

.alkis-houses-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.alkis-house-btn {
    min-width: 32px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    transition: all 0.15s;
}

.alkis-house-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.alkis-house-btn.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.alkis-houses-empty {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* ===== USER MENU (Login/Logout) ===== */

.header-user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    display: none;
    z-index: 3000;
    overflow: hidden;
}

.user-dropdown.visible {
    display: block;
}

.user-dropdown-header {
    padding: 12px 14px;
    background: rgba(var(--primary-color-rgb), 0.05);
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-weight: 500;
}

.user-dropdown-header i {
    font-size: 20px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #444;
    text-decoration: none;
    transition: background 0.2s;
}

.user-dropdown-item:hover {
    background: rgba(var(--primary-color-rgb), 0.08);
    color: var(--primary-color);
}

.user-dropdown-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Main Content Layout */
#main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
}
