/* styles.css */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    overflow: hidden;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    position: relative;
}

.image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.controls button {
    padding: 5px 10px;
    margin-right: 5px;
    margin-bottom: 5px;
    cursor: pointer;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

.top-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #ccc;
    z-index: 1000;
    position: relative;
}

.controls,
#background-upload-panel {
    padding: 10px;
    flex: 1 1 45%;
    min-width: 250px;
    box-sizing: border-box;
}

.controls {
    display: flex;
    flex-direction: column;
    position: relative;
    /* Ensure it participates in layout */
    z-index: 1;
    /* Lower than background panel if needed */
}

#toggle-upload-panel,
#toggle-marker-panel {
    position: relative;
    z-index: 10;
    padding: 7px;
    /* Higher than background image panel */
    margin: 10px;
}

/* Background upload form layout */
#background-upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#background-upload-form>* {
    flex: 1 1 auto;
    min-width: 120px;
}

/* Hide panel when needed */
.hidden {
    display: none !important;
}

/* Marker upload form styling */
#marker-upload-form {
    flex-basis: 100%;
    margin-top: 5px;
    display: none;
}

#marker-upload-form input[type="file"] {
    max-width: 100%;
}

#marker-upload-form button {
    margin-top: 5px;
}

/* Responsive behavior */
@media (min-width: 768px) {
    .top-bar {
        flex-wrap: nowrap;
    }

    #background-upload-form {
        flex-wrap: nowrap;
    }
}

.main-slideshow {
    position: relative;
    width: 100%;
    height: 100%;
}

.slide-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.main-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    object-fit: contain;
}

.main-image.active {
    display: block;
}

.main-slideshow button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 20px;
}

.main-slideshow .prev {
    left: 10px;
}

.main-slideshow .next {
    right: 10px;
}

.marker-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.marker {
    position: absolute;
    /* width: 25px; */
    /* height: 25px; */
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    background: red;
    border-radius: 50%;
    cursor: pointer;
    z-index: 15;
    transform: translate(-50%, -50%);
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.marker.new {
    background: blue;
    cursor: move;
    width: 30px;
    height: 30px;
    border: 3px solid white;
    z-index: 20;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 0, 255, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 0, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 0, 255, 0);
    }
}

.marker.dragging {
    opacity: 0.8;
    cursor: grabbing;
}

.marker.selected {
    box-shadow: 0 0 0 3px white, 0 0 0 5px #ff9900;
    background: #ff9900;
}

.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    width: 99vw;
    height: 99vh;
    padding: 0;
    /* width: 100vw;
    height: 100vw; */
}

.popup-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.popup img:first-child {
    display: block;
}

.popup button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 20px;
    z-index: 5;
}

.popup .prev {
    left: 10px;
}

.popup .next {
    right: 10px;
}

.popup .counter {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(200, 200, 200, 0.7);
    padding: 0.5em;
    text-align: center;
    margin: 5px;
}

.close {
    position: absolute;
    top: 30px;
    right: 10px;
    font-size: 28px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    z-index: 10;
    padding: 0 5px;
    line-height: 1;
    background-color: rgba(200, 200, 200, 0.7);
    border-radius: 50%;
}

.close:hover {
    color: black;
    background-color: rgba(255, 255, 255, 0.9);
}

.main-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 16px;
    z-index: 10;
}

.context-menu {
    position: absolute;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.context-menu div {
    padding: 8px 12px;
    cursor: pointer;
}

.context-menu div:hover {
    background-color: #f0f0f0;
}