:root {
    --primary-font: "Inter", "Open Sans", Helvetica, sans-serif;

    --theme-background-start: rgb(233 244 223);
    --theme-background-mid: rgba(230, 243, 251, 0.25);
    --theme-background-end: rgb(254 225 212);

    --background-color-light: #FFFFFF;
    --background-color-interface: #F7F9FA;
    --background-color-interface-subtle: #EFF3F6;
    --background-color-image-placeholder: #EEEEEE;
    --skeleton-base-color: #e0e0e0;
    --skeleton-shine-color: #d0d0d0;


    --text-color-primary: #2c3e50;
    --text-color-secondary: #34495e;
    --text-color-tertiary: #767676;
    --text-color-subtle: #95a5a6;
    --text-color-inverted: #ffffff;

    --text-color-accent: #DB7C00;
    --text-color-accent-dark: #B86B00;

    --border-color-light: #e0e7ef;
    --border-color-medium: #d1d9e0;
    --border-color-dark: #bdc3c7;
    --border-color-accent: var(--text-color-accent);


    --box-shadow-soft: 0 2px 4px rgba(0, 0, 0, 0.04);
    --box-shadow-medium: 0 3px 6px rgba(0, 0, 0, 0.06);
    --box-shadow-popup: 0 5px 15px rgba(0, 0, 0, 0.08);
    --box-shadow-floating-sidebar: 0 8px 24px rgba(0, 0, 0, 0.12);
    --box-shadow-bottom-sheet: 0 -3px 10px rgba(0, 0, 0, 0.07);
    --box-shadow-interactive-hover: 0 2px 5px rgba(0, 0, 0, 0.08);

    --border-radius-small: 4px;
    --border-radius-medium: 6px;
    --border-radius-large: 8px;
    --border-radius-xlarge: 12px;
    --border-radius-round: 50%;
    --border-radius-pill: 20px;
    --border-radius-sheet: 16px;

    --scrollbar-thumb-color: #bdc3c7;
    --scrollbar-track-color: #ecf0f1;

    --font-size-xs: 10px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-md: 14px;
    --font-size-lg: 15px;
    --font-size-xl: 16px;
    --font-size-xxl: 18px;

    --line-height-base: 1.5;
    --line-height-paragraph: 1.7;

    --button-padding-y: 10px;
    --button-padding-x: 18px;

    --focus-outline-color: var(--text-color-accent);
}

html,
body {
    height: 100%;
    margin: 0;
    font-family: var(--primary-font);
    color: var(--text-color-primary);
    overflow: hidden;
    /* Prevent body scroll when sheet is active */
}

*:focus-visible {
    outline: none;
    box-shadow: none;
}

#app-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/*Material Icon Close-Icon für das Leeren des Inputfelds*/
[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    height: 24px;
    width: 24px;
    background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjRweCIgZmlsbD0iIzAwMDAwMCI+PHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGQ9Ik0xOSA2LjQxTDE3LjU5IDUgMTIgMTAuNTkgNi40MSA1IDUgNi40MSAxMC41OSAxMiA1IDE3LjU5IDYuNDEgMTkgMTIgMTMuNDEgMTcuNTkgMTkgMTkgMTcuNTkgMTMuNDEgMTJ6Ii8+PC9zdmc+);
    background-size: 24px 24px;
    color: var(--text-color-tertiary);
}

#project-list-sidebar {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 450px;
    height: calc(100vh - 20px);
    background-color: var(--background-color-light);
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow-floating-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

#project-list-sidebar .search-input-container {
    padding: 0px 15px 5px 15px;
    flex-shrink: 0;
    position: relative;
}

.material-input-wrapper {
    position: relative;
    padding-top: 16px;
    background-color: var(--background-color-light);
}

.material-input-wrapper input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 40px 0px 2px;
    font-size: var(--font-size-md);
    height: 3rem;
    border: none;
    border-bottom: 1px solid var(--border-color-medium);
    background-color: #F9F9F9;
    color: var(--text-color-primary);
    line-height: 1.5;
    position: relative;
    z-index: 1;
    outline: none;
}

.material-input-wrapper input[type="search"]::-webkit-search-cancel-button {
    right: 30px;
    z-index: 2;
}


.material-input-wrapper label {
    position: absolute;
    z-index: 9999;
    left: 2px;
    top: calc(12px + 8px);
    font-size: var(--font-size-sm);
    color: var(--text-color-tertiary);
    pointer-events: none;
    transition: all 0.2s ease-out;
    transform-origin: left top;
}

.material-input-wrapper input[type="search"]:focus+label,
.material-input-wrapper input[type="search"]:not(:placeholder-shown)+label {
    top: 4px;
    transform: scale(0.75);
    color: var(--text-color-accent);
}

.material-input-wrapper .input-border-highlight {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background-color: var(--text-color-accent);
    transform: scaleX(0);
    transition: transform 0.2s ease-out;
    z-index: 2;
}

.material-input-wrapper input[type="search"]:focus~.input-border-highlight {
    transform: scaleX(1);
}

.material-input-wrapper .search-icon-md {
    position: absolute;
    top: calc(16px + 8px + (var(--font-size-md) * var(--line-height-base) / 2) - 10px);
    right: 10px;
    width: 30px;
    height: 30px;
    fill: var(--text-color-accent);
    pointer-events: none;
    z-index: 999;
    transition: fill 0.2s ease-out;
}

.material-input-wrapper input[type="search"]:focus~.search-icon-md {
    fill: var(--text-color-accent);
}


#project-list-sidebar .sm-autocomplete {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    max-width: none;
    margin: 0;
    font-size: var(--font-size-lg);
    box-shadow: none;
    border: 0px solid var(--border-color-medium);
    border-radius: var(--border-radius-medium);
    z-index: 105;
}

#category-filters-container {
    padding: 15px 15px;
    background-color: transparent;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.category-filter-button {
    background-color: var(--background-color-light);
    color: var(--text-color-accent);
    border: 1px solid var(--text-color-accent);
    padding: 7px 14px;
    border-radius: var(--border-radius-pill);
    cursor: pointer;
    font-size: var(--font-size-md);
    font-weight: 500;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease, box-shadow 0.1s ease;
    white-space: nowrap;
}

.category-filter-button:hover:not(.active),
.category-filter-button:focus-visible:not(.active) {
    background-color: #e0e0e0;
    border-color: var(--border-color-medium);
    box-shadow: var(--box-shadow-interactive-hover);
    outline: none;
}

.category-filter-button.active {
    background-color: var(--text-color-accent);
    color: var(--text-color-inverted);
    border-color: var(--text-color-accent);
    box-shadow: none;
}

.category-filter-button.active:focus-visible {
    outline: 2px solid var(--text-color-accent-dark);
    outline-offset: 1px;
    box-shadow: none;
}


#project-list-header {
    padding: 8px 15px 8px 15px;
    background-color: transparent;
    flex-shrink: 0;
}

#project-list-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 400;
    color: var(--text-color-tertiary);
}

#project-list {
    list-style: none;
    padding: 0 0 15px 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.no-projects-message {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-color-subtle);
    font-style: normal;
    font-size: var(--font-size-md);
}

.skeleton-list-item {
    background-color: var(--background-color-light);
    padding: 15px;
    margin: 0 15px 10px 15px;
    border-radius: var(--border-radius-medium);
    box-shadow: var(--box-shadow-soft);
}

.skeleton-list-item div[class^="skeleton-"] {
    background-color: var(--skeleton-base-color);
    border-radius: var(--border-radius-small);
    margin-bottom: 8px;
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

.skeleton-list-item .skeleton-header,
.skeleton-list-item .skeleton-image-gallery,
.skeleton-list-item .skeleton-small-images {
    background-color: transparent;
    animation: none;
}


.skeleton-list-item .skeleton-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.skeleton-seal {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.skeleton-category {
    width: 80px;
    height: 12px;
}

.skeleton-title {
    width: 70%;
    height: 18px;
    margin-bottom: 10px;
}

.skeleton-short-desc {
    width: 90%;
    height: 14px;
}

.skeleton-image-gallery {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.skeleton-large-image {
    flex: 2;
    height: 150px;
}

.skeleton-small-images {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-small-image {
    width: 100%;
    height: calc(75px - 5px);
}

@keyframes skeleton-pulse {
    0% {
        background-color: var(--skeleton-base-color);
    }

    50% {
        background-color: var(--skeleton-shine-color);
    }

    100% {
        background-color: var(--skeleton-base-color);
    }
}


#project-list::-webkit-scrollbar {
    width: 8px;
}

#project-list::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb-color);
    border-radius: var(--border-radius-small);
}

#project-list::-webkit-scrollbar-track {
    background-color: var(--scrollbar-track-color);
}

#project-list {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color);
}

.project-list-item {
    cursor: pointer;
    background-color: transparent;
    transition: background-color 0.2s ease, transform 0.15s ease;
    padding: 15px;
    border-radius: var(--border-radius-medium);
}

.project-list-item:last-child {
    margin-bottom: 0;
}


.project-list-item:hover,
.project-list-item:focus-visible {
    background-color: var(--background-color-interface-subtle);
    outline: none;
}

.list-item-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-item-header {
    display: flex;
    align-items: center;
    gap: 4px;
}

.list-item-seal-badge {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-image: url('./sealcheck.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: none;
}

.list-item-category-text {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-color-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.list-item-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-color-primary);
    margin: 0;
    line-height: 1.3;
}

.list-item-short-description {
    font-size: var(--font-size-sm);
    color: var(--text-color-secondary);
    line-height: var(--line-height-base);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item-image-gallery {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.list-item-large-image-wrapper {
    flex: 2;
    min-width: 0;
    border-radius: var(--border-radius-medium);
    overflow: hidden;
    height: 180px;
}

.list-item-large-image-wrapper,
.list-item-small-image-wrapper {
    background-color: var(--background-color-image-placeholder);
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-item-large-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-item-small-images-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    height: 180px;
}

.list-item-small-image-wrapper {
    flex: 1;
    border-radius: var(--border-radius-small);
    overflow: hidden;
    height: calc(75px - 5px);
    background-color: var(--background-color-image-placeholder);
}

.list-item-small-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#map-main-content {
    width: 100%;
    height: 100%;
    position: relative;
}

#map-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    background-image: url(./stars.jpg);
    background-size: cover;
}

#project-detail-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 100%;
    max-width: 450px;
    height: calc(100vh - 20px);
    background-color: var(--background-color-light);
    z-index: 110;
    overflow-y: auto;
    box-sizing: border-box;
    display: none;
    border-radius: var(--border-radius-large);
    box-shadow: var(--box-shadow-floating-sidebar);
}

#project-detail-overlay::-webkit-scrollbar {
    width: 8px;
}

#project-detail-overlay::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb-color);
    border-radius: var(--border-radius-small);
}

#project-detail-overlay::-webkit-scrollbar-track {
    background-color: var(--scrollbar-track-color);
}

#project-detail-overlay {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color);
}

#detail-view-close-button,
.mobile-detail-close-button {
    position: sticky;
    top: 0;
    font-weight: 400;
    background-color: var(--background-color-light);
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color-light);
    z-index: 20;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    left: 0;
    font-size: var(--font-size-md);
    color: var(--text-color-accent);
    border: none;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    /* Ensure button does not shrink */
}


#detail-view-close-button svg,
.mobile-detail-close-button svg {
    width: 20px;
    height: 20px;
    color: var(--text-color-accent);
    flex-shrink: 0;
}

#detail-view-close-button span,
.mobile-detail-close-button span {
    font-size: var(--font-size-md);
    color: var(--text-color-accent);
    margin-left: 4px;
}


#detail-view-body {
    /* Desktop detail body */
    padding: 10px;
}

#detail-view-body .popup-custom-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

#detail-view-body .popup-project-image-container {
    width: 100%;
    height: 240px;
    border-radius: var(--border-radius-large);
    background-color: var(--background-color-image-placeholder);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#detail-view-body .popup-project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#detail-view-body .popup-content-area {
    min-height: auto;
}

#detail-view-body .popup-project-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-color-primary);
    -webkit-line-clamp: unset;
    max-height: none;
}

#detail-view-body .popup-category-text {
    font-size: var(--font-size-sm);
    color: var(--text-color-accent);
    font-weight: 500;
}

#detail-view-body .popup-seal-icon {
    width: var(--font-size-xl);
    height: var(--font-size-xl);
    filter: none;
}

.detail-additional-info p {
    font-size: var(--font-size-md);
    line-height: var(--line-height-paragraph);
    color: var(--text-color-secondary);
    margin: 12px 0;
}

.detail-additional-info strong {
    color: var(--text-color-primary);
    font-weight: 600;
}

.detail-website-button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 24px;
    background-color: var(--text-color-accent);
    color: var(--text-color-inverted) !important;
    text-decoration: none;
    border-radius: var(--border-radius-medium);
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    font-size: var(--font-size-md);
}

.detail-website-button:hover,
.detail-website-button:focus-visible {
    background-color: var(--text-color-accent-dark);
    text-decoration: none;
    box-shadow: var(--box-shadow-interactive-hover);
    outline: none;
}

.detail-website-button:active {
    transform: translateY(0px);
    box-shadow: none;
}

.image-map-marker {
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    background-image: url(./pin.svg);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    border: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.image-map-marker:hover,
.image-map-marker:focus-visible {
    transform: scale(1.2);
    outline: none;
}

.image-map-marker.marker-active {
    transform: scale(1.2);
}


.maplibregl-popup {
    max-width: 320px !important;
    cursor: pointer;
}

.maplibregl-popup-content {
    font-family: var(--primary-font);
    background: var(--background-color-light);
    border: 1px solid var(--border-color-light);
    box-shadow: var(--box-shadow-popup);
    border-radius: var(--border-radius-large);
    color: var(--text-color-primary);
    padding: 0;
    overflow: hidden;
}

.maplibregl-popup-tip {
    display: none !important;
}

.popup-custom-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 12px;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.popup-project-image-container {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: var(--border-radius-medium);
    background-color: var(--background-color-image-placeholder);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.popup-project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-project-image[src=""],
.popup-project-image[src="#"] {
    display: none;
}

.popup-content-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0px;
    gap: 5px;
    flex-grow: 1;
    min-height: 80px;
    justify-content: space-between;
}

.popup-content-top-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0px;
    gap: 6px;
    width: 100%;
    height: var(--font-size-xl);
}

.popup-seal-icon {
    width: var(--font-size-xl);
    height: var(--font-size-xl);
    flex-shrink: 0;
    background-image: url(./sealcheck.svg);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: none;
}

.popup-category-text {
    font-family: var(--primary-font);
    font-style: normal;
    font-weight: 600;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-base);
    letter-spacing: 0.075em;
    text-transform: uppercase;
    color: var(--text-color-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.popup-main-text-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 4px 0px 8px 0px;
    gap: 3px;
    width: 100%;
}

.popup-project-title {
    font-family: var(--primary-font);
    font-style: normal;
    font-weight: 600;
    font-size: var(--font-size-md);
    line-height: var(--line-height-base);
    letter-spacing: -0.01em;
    color: var(--text-color-primary);
    width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: calc(var(--line-height-base) * 2em);
}

.popup-project-subtitle {
    font-family: var(--primary-font);
    font-style: normal;
    font-weight: 700;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-base);
    letter-spacing: -0.01em;
    color: var(--text-color-secondary);
    width: 100%;
    margin-top: 2px;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    max-height: calc(var(--line-height-base) * 2em);
}

.detail-project-description {
    font-family: var(--primary-font);
    font-style: normal;
    font-weight: 400;
    font-size: var(--font-size-md);
    line-height: var(--line-height-paragraph);
    letter-spacing: normal;
    color: var(--text-color-primary);
    width: 100%;
    margin-top: 10px;
    word-wrap: break-word;
    display: block;
    -webkit-line-clamp: unset;
    max-height: none;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
}

.maplibregl-popup-close-button {
    display: none;
    /* Should be controlled by SmartMaps GL, but ensure it's not forced visible */
    color: var(--text-color-tertiary);
    font-size: 20px;
    font-weight: normal;
    padding: 0;
    position: absolute;
    right: 6px;
    top: 6px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: var(--border-radius-round);
    z-index: 10;
    transition: background-color 0.2s, color 0.2s, transform 0.1s ease;
}

.maplibregl-popup-close-button:hover,
.maplibregl-popup-close-button:focus-visible {
    color: var(--text-color-primary);
    background: var(--border-color-light);
    transform: rotate(90deg);
    outline: none;
}

.sm-autocomplete>svg {
    /* Hides YellowMap search icon in autocomplete input */
    display: none;
}

.maplibre-gl-ctrl-top-right {
    z-index: 15;
    /* Ensure map controls are above other elements but below sheet if needed */
    top: 15px;
    right: 15px;
}


@media (max-width: 768px) {

    html,
    body {
        /* overflow: hidden; Already set globally, ensure it's here for mobile too if needed */
    }

    #app-container {
        /* flex-direction: column; Not needed if body handles overflow */
        /* position: relative; Already set */
        /* overflow: hidden; Removed for robust scroll solution */
        background-color: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    #map-wrapper {
        /* top and height are dynamically adjusted by map.setPadding in JS */
        /* top: 100px; */
        /* height: calc(100vh - 100px); */
    }

    #project-list-sidebar .search-input-container,
    #project-list-sidebar #category-filters-container {
        display: none;
        /* Hide desktop search/filters on mobile */
    }

    #project-list-sidebar {
        /* Mobile Bottom Sheet */
        position: absolute;
        bottom: 0px;
        left: 0;
        width: 100%;
        height: 100vh;
        /* Sheet itself is full height, transform controls visible part */
        transform: translateY(calc(100% - 60px));
        /* Initial peek height */
        min-height: 0;
        /* Important for flex children */
        border-right: none;
        border-bottom: none;
        border-top: 1px solid var(--border-color-light);
        background-color: var(--background-color-light);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        z-index: 1000;
        /* High z-index for the sheet */
        display: flex;
        flex-direction: column;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-top-left-radius: var(--border-radius-sheet);
        border-top-right-radius: var(--border-radius-sheet);
        box-shadow: var(--box-shadow-bottom-sheet);
        overflow: hidden;
        /* ADDED: Crucial for clipping its 100vh content to the transformed visible area */
    }

    #mobile-sheet-handle {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 12px 0px 0px 0px;
        /* Keep some padding for touch */
        cursor: grab;
        flex-shrink: 0;
        /* Prevent handle from shrinking */
        background-color: var(--background-color-light);
        /* Match sheet */
        border-top-left-radius: var(--border-radius-sheet);
        /* Match sheet */
        border-top-right-radius: var(--border-radius-sheet);
        /* Match sheet */
        touch-action: none;
    }

    #mobile-sheet-handle .handle-bar {
        width: 40px;
        height: 5px;
        background-color: var(--border-color-dark);
        border-radius: 2.5px;
    }

    #project-list-sidebar #project-list {
        /* Mobile project list specific styling */
        overflow-y: auto;
        flex-grow: 1;
        min-height: 0;
        /* Added for flex scroll robustness */
        -webkit-overflow-scrolling: touch;
        padding: 0;
        /* Remove default ul padding */
    }

    .project-list-item {
        /* General project list item, ensure mobile overrides if needed */
        background-color: var(--background-color-light);
        margin-left: 0;
        /* Mobile: full width */
        margin-right: 0;
        /* Mobile: full width */
        border-radius: 0;
        /* Mobile: no radius */
        box-shadow: none;
        /* Mobile: no shadow */
        border-bottom: 1px solid var(--border-color-light);
        /* Separator for mobile items */
    }

    .project-list-item:hover,
    .project-list-item:focus-visible {
        background-color: var(--background-color-interface-subtle);
        transform: none;
        /* No transform on hover for mobile list items */
        box-shadow: none;
    }

    .skeleton-list-item {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
        box-shadow: none;
        border-bottom: 1px solid var(--border-color-light);
    }

    .maplibregl-ctrl-top-right {
        top: 115px !important;
    }

    #mobile-top-controls {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        box-sizing: border-box;
        padding: 0px 15px 10px 15px;
        background-color: var(--background-color-light);
        box-shadow: var(--box-shadow-medium);
        z-index: 1001;
        gap: 10px;
        border-bottom-left-radius: var(--border-radius-large);
        border-bottom-right-radius: var(--border-radius-large);
    }

    #mobile-top-controls .search-input-container {
        padding: 0;
        position: relative;
        flex-shrink: 0;
    }

    #mobile-top-controls #mobile-category-filters-container {
        padding: 0;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        justify-content: flex-start;
        scrollbar-width: none;
        position: relative;
    }

    #mobile-top-controls #mobile-category-filters-container::-webkit-scrollbar {
        display: none;
    }

    #mobile-top-controls #mobile-category-filters-container::before,
    #mobile-top-controls #mobile-category-filters-container::after {
        content: '';
        position: sticky;
        top: 0;
        bottom: 0;
        width: 25px;
        z-index: 0;
        /* Should be behind buttons if buttons have higher z-index */
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(255, 255, 255, 0.6);
        opacity: 0;
        pointer-events: none;
        font-weight: bold;
        font-size: 24px;
        color: var(--text-color-accent);
    }

    #mobile-top-controls #mobile-category-filters-container.show-scroll-arrow-left::before,
    #mobile-top-controls #mobile-category-filters-container.show-scroll-arrow-right::after {
        opacity: 1;
    }

    #mobile-top-controls #mobile-category-filters-container::before {
        left: 0;
        content: "‹";
    }

    #mobile-top-controls #mobile-category-filters-container::after {
        right: 0;
        content: "›";
    }

    #mobile-top-controls .category-filter-button {
        padding: 6px 10px;
        font-size: 12px;
        flex-shrink: 0;
    }

    .sm-autocomplete {
        /* Yellowmap Autocomplete specific for mobile if needed */
        box-shadow: none;
        width: 100%;
        border-top: 0px;
        border-left: 0px;
        border-right: 0px;
    }

    #mobile-detail-content-container {
        overscroll-behavior: contain;
        background-color: var(--background-color-light);
        height: 100%;
        /* Nimmt die volle Höhe von #project-list-sidebar (dem Sheet) */
        /* overflow: hidden; */ /* ENTFERNT/GEÄNDERT: Damit der Inhalt scrollen kann */
        display: flex;
        flex-direction: column;
    }

    #mobile-detail-content-container #mobile-detail-view-body {
        padding: 12px 16px 16px 16px;
        flex-grow: 1;
        overflow-y: auto; /* Dieses Element ist für das Scrollen zuständig */
        -webkit-overflow-scrolling: touch;
        text-align: left;
    }


    #mobile-detail-view-body .popup-custom-layout {
        /* Layout of content within mobile-detail-view-body */
        flex-direction: column;
        align-items: stretch;
        /* Make children take full width */
        gap: 0px;
        /* Adjust gap as needed */
    }

    #mobile-detail-view-body .popup-project-image-container {
        width: 100%;
        /* Full width within padding */
        height: 220px;
        /* Or aspect-ratio */
        margin-bottom: 10px;
        border-radius: var(--border-radius-large);
        /* Keep rounded images */
    }

    #mobile-detail-view-body .popup-project-image {
        border-radius: var(--border-radius-large);
    }

    #mobile-detail-view-body .popup-project-title {
        font-size: var(--font-size-xxl);
        font-weight: 700;
        -webkit-line-clamp: unset;
        padding: 4px 0px 4px 0px;
        max-height: none;
        line-height: 1.3;
    }

    #mobile-detail-view-body .popup-content-area {
        min-height: auto;
        /* Allow it to size based on content */
    }

    #map-main-content {
        height: 100vh;
    }

    #project-detail-overlay {
        display: none !important;
    }
}

@media (min-width: 769px) {
    #mobile-sheet-handle {
        display: none;
    }

    #mobile-detail-content-container {
        display: none !important;
    }

    #mobile-top-controls {
        display: none;
    }

    #project-list-sidebar .search-input-container,
    #project-list-sidebar #category-filters-container {
        display: block;
    }

    #project-list-sidebar #category-filters-container {
        display: flex;
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .maplibre-gl-ctrl-top-left {
        margin-left: calc(var(--map-padding-left, 0px) + 10px);
    }
}

a.smartmaps-gl-ctrl-logo {
    /* SmartMaps logo adjustment */
    margin: 0 0 3px calc(450px + 20px);
    /* Default for desktop */
}

@media (max-width: 768px) {
    a.smartmaps-gl-ctrl-logo {
        margin: 0 0 3px 10px;
        /* Adjusted for mobile, simpler margin */
        /* transform: translateY(calc(-1 * (var(--peek-height, 60px) + 10px))); */
        /* Example to move it above peek sheet */
    }
}
/* Detail View Image Gallery - Layout similar to list items */
.detail-view-image-gallery {
    display: flex;
    flex-direction: row; /* Large image left, small column right */
    gap: 10px;          /* Gap between large image and small images column */
    margin-bottom: 15px;
    width: 100%;        /* Ensure it takes available width */
}

.detail-view-large-image-wrapper {
    flex: 2; 
    min-height: 100%; 
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--border-radius-medium);
    /* background-color is set by inline style from JS for placeholder */
}
/* Add cursor only if it's a clickable image for the lightbox */
.detail-view-large-image-wrapper[data-image-url]:not([data-image-url=""]) {
    cursor: pointer;
}
.detail-view-large-image-wrapper .detail-project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-view-small-images-column {
    flex: 1; /* Takes up 1/3 of the space */
    /* Or use a fixed percentage: flex: 0 0 40%; */
    display: flex;
    flex-direction: column; /* Stack small images vertically */
    gap: 10px;          /* Gap between the two small images */
    min-height: 100%;   /* Fill the height of the gallery container */
}

.detail-view-small-image-wrapper {
    flex: 1; /* Each small image takes half the column height, considering the gap */
    min-height: 0; /* Allow flex to distribute space; min-height set by parent column and flex:1 */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--border-radius-medium);
}
/* Add cursor only if it's a clickable image for the lightbox */
.detail-view-small-image-wrapper[data-image-url]:not([data-image-url=""]) {
    cursor: pointer;
}
.detail-view-small-image-wrapper .detail-project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Optional: Responsive adjustments for the detail gallery */
@media (max-width: 768px) { /* For tablet and mobile */
    .detail-view-image-gallery {
        max-height: 180px;
}
}

/* Lightbox CSS */
.image-lightbox {
    position: fixed;
    z-index: 10000; /* Ensure it's on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lightbox-img { /* Class already .lightbox-image, use that */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.lightbox-close-button,
.lightbox-prev-button,
.lightbox-next-button {
    position: absolute;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    z-index: 10001;
    transition: color 0.2s ease-in-out;
}

.lightbox-close-button {
    top: 15px;
    right: 35px;
    font-size: 45px;
}

.lightbox-prev-button,
.lightbox-next-button {
    top: 50%;
    transform: translateY(-50%);
    padding: 16px;
    background-color: rgba(0,0,0,0.2); /* Subtle background */
    border-radius: 3px;
}
.lightbox-prev-button { left: 20px; }
.lightbox-next-button { right: 20px; }

.lightbox-prev-button:hover,
.lightbox-next-button:hover,
.lightbox-close-button:hover {
    color: #bbb;
}

.lightbox-caption {
    text-align: center;
    color: #ccc;
    padding: 15px 0 5px 0; /* Adjusted padding */
    position: absolute;
    bottom: 15px; /* Positioned at bottom */
    width: 100%;
    left: 0;
    font-size: 16px;
    background-color: rgba(0,0,0,0.3); /* Optional: slight background for caption readability */
}

/* Hide placeholder text for empty images */
img[src=""], img:not([src]) {
    /* This can hide broken image icons if src is empty or invalid before JS error handling kicks in */
    /* However, your JS error handling for images is better: onerror="this.style.display='none'; ..." */
}
