
/* #region APP ----------------------------- */

* {
    box-sizing: border-box;
}

html,
body,
#app {
    margin: 0;
    padding: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;    
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Helvetica Neue",
        Arial,
        sans-serif;
    background: #ffffff;
    color: #000000;
}

body {
    overscroll-behavior: none;
}

#map {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
}

@media (max-width: 400px) { /* unterhalb von 400px Breite */
    .page-header {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    .language-buttons,
    .list-buttons,
    .album-buttons {
        gap: 6px !important;
    }
}

/* #endregion */
/* #region PAGE ---------------------------- */

#pages {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
}

.page {
    position: absolute;
    inset: 0;
    display: none;
    overflow: auto;
    background: #ffffff;
}

/* Map ohne Safe Area */
#page-list,
#page-detail,
#page-album,
#page-info {
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    font-size: 24px;
    font-weight: 600;
    border-bottom: 1px solid #dddddd;
}

.page.offline #map,
.page.offline #list,
.page.offline #detail,
.page.offline #album,
.page.offline #info {
    display: none;
}

.page.offline .page-header {
    display: none;
}

.offline-message {
    display: none;
    padding: 40px 20px;
    text-align: center;
    font-size: 1.1em;
}

.offline-message.active {
    display: block;
}

/* #endregion */
/* #region BUTTONS ------------------------- */

.base-button {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: rgba(255, 255, 255, 0.75);
    color: #000;
    cursor: pointer;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.25);
}

.base-button.active {
    font-weight: bold;
    background: #007aff;
    color: #fff;
}

.base-button:not(.active):hover {
    background: #f0f0f0;
    color:#000
}

.text-button {
    font-size: 16px;
    font-weight: 600;
}

.image-button {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-button img {
    width: 26px;
    height: 26px;
    object-fit: scale-down;
}

.image-button.active img {
    filter: invert(1);
}

.zoom-buttons,
.language-buttons,
.list-buttons,
.album-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.zoom-buttons {
    bottom: 0;
    left: env(safe-area-inset-left, 0);
}

/* #endregion */
/* #region TAB BAR ------------------------- */

#tabbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);    
    display: flex;
    flex-direction: row;
    background: #ffffff;
    border-top: 1px solid #dddddd;
    z-index: 10000;
}

.tab {
    flex: 1 1 0;
    min-width: 0;
    height: 60px;
    margin: 0;
    padding: 3px 2px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #000000;
    font-family: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.tab-image {
    display: block;
    width: 24px;
    height: 24px;
    margin: 0 auto 3px;
    background-color: currentColor; /* nimmt automatisch die Farbe von .tab bzw. .tab.active */
    -webkit-mask-image: var(--icon);
    mask-image: var(--icon);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.tab-title {
    display: block;
    margin-top: 1px;
    line-height: 15px;
    font-size: 13px;
}

.tab.active { /* ausgewählter Tab */
    color: #007aff;
}

.tab:active { /* Tap wird gerade gedrückt */
    background: #eeeeee;
}

/* #endregion */
/* #region MAP ----------------------------- */

#page-map {
    overflow: hidden;
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.leaflet-bottom.leaflet-center {
    left: 50%;
    transform: translateX(-50%);
}

/* #endregion */
/* #region MAP MARKER ---------------------- */

.flag-marker {
    background: transparent;
    border: none;
}

.flag-marker-container {
    position: relative;
    width: 37px;
    height: 48px;
}

.flag-marker-frame {
    position: absolute;
    left: 0;
    top: 0;
    width: 37px;
    height: 48px;
    display: block;
    z-index: 1;
}

.flag-marker-image {
    position: absolute;
    left: 0;
    top: 0;
    width: 37px;
    height: 26px;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 2px 2px 2px rgba(0,0,0,0.25);
    z-index: 2;
}

/* #endregion */
/* #region MAP POPUP ----------------------- */

.one-sky-popup .leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
}

.one-sky-popup .leaflet-popup-content {
    width: 200px !important;
    max-width: 200px;
    margin: 0;
    padding: 0;
}

.flag-popup {
    width: 200px;
    padding: 10px;
    text-align: center;
    overflow: hidden;
}

.flag-popup-image {
    width: 180px;
    height: 180px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.flag-popup-image img {
    display: block;
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.flag-popup-country {
    font-size: 17px;
    font-weight: 600;
    line-height: 21px;
}

.flag-popup-name {
    margin-top: 2px;
    font-size: 14px;
    line-height: 18px;
    color: #666666;
}

/* #endregion */
/* #region LIST ---------------------------- */

#list {
    padding-bottom: 0px;
}

.list-item {
    display: flex;
    align-items: center;
    min-height: 64px;
    padding: 8px 14px;
    border-bottom: 1px solid #eeeeee;
    cursor: pointer;
}

.list-item:active {
    background: #eeeeee;
}

.list-item img {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
}

.list-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.list-text strong {
    font-size: 16px;
    line-height: 21px;
}

.list-text span {
    margin-top: 2px;
    font-size: 14px;
    line-height: 18px;
    color: #777777;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* #endregion */
/* #region DETAIL -------------------------- */

#detail {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    padding: 0 12px;
    background: #ffffff;
}

.detail-page {
    flex: 0 0 100%;
    scroll-snap-align: center;
}

.detail-image-wrapper {
    position: relative;
}

.detail-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 500px;
    margin: 0 auto 20px;
    object-fit: contain;
}

.detail h1 {
    margin: 0;
    font-size: 28px;
    line-height: 34px;
}

.detail h2 {
    margin: 4px 0 20px;
    font-size: 18px;
    font-weight: normal;
    color: #666666;
}

.detail-text {
    font-size: 17px;
    line-height: 26px;
    white-space: normal;
}

.empty-detail {
    padding: 40px 20px;
    text-align: center;
    color: #777777;
}

/* #endregion */
/* #region DETAIL BUTTONS ------------------ */

.detail-button {
    width: 60px;
    flex: 0 0 60px;
    padding: 0;
    margin: 0;
    text-indent: 0;
    border: none;
    background: #ffffff;
    color: #000000;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    cursor: default;
    appearance: none;
}

.detail-button:disabled {
    color: #000000;
    opacity: 1;
}

.audio-buttons,
.text-language-buttons,
.show-on-map-buttons {
    display: flex;
    gap: 8px;
    margin: 12px 0;
}

.audio-button,
.text-language-button,
.show-on-map-button {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 15px;
	font-weight: 600;
}

.audio-button.active,
.text-language-button.active,
.show-on-map-button.active {
    font-weight: bold;
    background: #007aff;
    color: #fff;
}

/* #endregion */
/* #region ALBUM --------------------------- */

/* 1. Zellen quadratisch
#album {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fill,
            minmax(140px, 1fr)
        );
    gap: 0px;
    padding: 0px;
}

.album-item {
    min-width: 0;
    cursor: pointer;
    text-align: center;
}

.album-item:active {
    opacity: 0.7;
}

.album-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #eeeeee;
}
*/

/* 2. Zellen proportional, aber Reihenfolge evt. problematisch
   1 4 7
   2 5 8
   3 6 9 */
#album {
    column-width: 140px;
    column-gap: 0;
    padding: 0;
}

.album-item {
    display: inline-block;
    position: relative;
    width: 100%;
    margin: 0;
    cursor: pointer;
    text-align: center;
    vertical-align: top;
    break-inside: avoid;
}

.album-item img {
    display: block;
    width: 100%;
    height: auto;
    background: #eeeeee;
}

/* 3. Nicht Masonry (am Ende fransig)
#album {
    display: flex;
    gap: 0;
    width: 100%;
    padding: 0;
}

.album-column {
    flex: 1;
    min-width: 0;
}

.album-item {
    width: 100%;
    margin: 0;
    padding: 0;
    cursor: pointer;
    text-align: center;
}

.album-item img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    background: #eeeeee;
}
*/

/* 4. Masonry (jedes Bild in die aktuell kürzeste Spalte)
#album {
    position: relative;
    width: 100%;
    padding: 0;
}

.album-item {
    position: absolute;
    margin: 0;
    padding: 0;
    cursor: pointer;
    text-align: center;
}

.album-item img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    background: #eeeeee;
}
*/

.album-item:active {
    opacity: 0.7;
}

/* Titel unterhalb des Bildes (.album-item: position: relative; löschen)
.album-title {
    margin-top: 6px;
    font-size: 14px;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
*/

.album-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 2px 4px;
    box-sizing: border-box;
    background: rgba(0, 122, 255, 0.5);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 2;
}

/* #endregion */
/* #region INFO ---------------------------- */

.info {
    padding: 24px;
    max-width: 700px;
    margin: 0 auto;
}

.info h1 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 28px;
}

.info h3 {
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 22px;
}

.info p {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 17px;
    line-height: 1.3;
}

.info-image {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 10px;
}

.info-container {
    display: flex;
    min-width: 0;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.info-column {
    flex: 1;
    text-align: center;
}

.info-column p {
    margin-top: 0;
    margin-bottom: 10px;
}

.infoImprint p {
    margin: 0;
    line-height: 1.3;
}

.infoImprint b {
    display: block;
    margin-bottom: 6px;
}

.info-image-small {
    width: 150px;
    max-width: 100%;
    height: auto;
}

#infoLocation {
    display: none;
}

.infoVideo {
    display: block;
    width: 100%;
    height: auto;
}

/* #endregion */
/* #region FLAGGE ALS SCHRIFT -------------- */

.flag-mask-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    z-index: 10001;
    display: none;
    background: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.flag-mask-overlay.active {
    display: block;
}

.flag-mask-content {
    width: 100%;
    padding: 0 12px;
}

.flag-mask-image-area {
    position: relative;
    width: 100%;
}

#flag-mask-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 500px;
    margin: 0 auto;
    object-fit: contain;
}

#flag-mask-editor {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 20px;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: rgba(0, 0, 0, 0.30);
    font-family: Impact, "Arial Black", sans-serif;
    font-size: 70px;
    font-weight: 900;
    line-height: 1.0;
    text-align: center;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

#flag-mask-editor:empty::before {
    content: "Text eingeben …";
    color: rgba(0, 0, 0, 0.25);
}

.flag-mask-toolbar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100%;
    margin-top: 15px;
    padding: 2px 8px;
}

.flag-mask-open-button {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.flag-mask-font-size {
    font-size: 20px;
    font-weight: 600;
    min-width: 35px;
    text-align: center;
}

/* #endregion */
