/* ============================================================
   YS Project - User-facing Popup Styles
   Mobile-first responsive design
   ============================================================ */

/* ── Overlay ── */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-overlay--hidden {
    display: none;
}

/* ── Container: holds all popup windows ── */
.popup-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    height: 100%;
    padding: 0;
}

/* ── Individual popup window ── */
.popup-window {
    background: #fff;
    border: 2px solid #000;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Hidden popups (beyond visible limit) stacked behind */
.popup-window--stacked {
    position: absolute;
    z-index: 0;
    opacity: 0.3;
    pointer-events: none;
    transform: scale(0.95);
}

/* ── Popup content area ── */
.popup-window__content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

/* Remove default margins from Summernote content inside popup */
.popup-window__content p {
    margin: 0;
}

.popup-window__content img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ── Popup footer (buttons) ── */
.popup-window__footer {
    display: flex;
    flex-shrink: 0;
}

.popup-window__btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    background: #000;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: #fff;
    text-align: center;
    transition: opacity 0.15s;
}

.popup-window__btn:hover {
    opacity: 0.8;
}

.popup-window__btn + .popup-window__btn {
    border-left: 1px solid #333;
}

.popup-window__btn--today {
    font-size: 12px;
}

.popup-window__btn--close {
    font-weight: 600;
}

/* ============================================================
   MOBILE: Full-screen, one popup at a time
   ============================================================ */
@media (max-width: 768px) {
    .popup-container {
        flex-direction: column;
        padding: 0;
        align-items: center;
        justify-content: center;
    }

    .popup-window {
        width: 100%;
        height: auto;
        max-height: 100%;
        border-radius: 0;
    }

    /* On mobile, only show one popup at a time, hide others */
    .popup-window--mobile-hidden {
        display: none;
    }

    .popup-window--stacked {
        display: none;
    }

    .popup-window__content {
        overflow-y: auto;
    }
}

/* ============================================================
   PC: Up to 3 popups side by side
   ============================================================ */
@media (min-width: 769px) {
    .popup-container {
        padding: 40px 24px;
        max-width: 1200px;
        margin: 0 auto;
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .popup-window {
        width: 360px;
        max-width: calc((100vw - 80px) / 3);
        max-height: 80vh;
        border-radius: 4px;
    }

    .popup-window__content {
        max-height: calc(80vh - 48px);
    }

    /* Stacked (overflow) popups */
    .popup-window--stacked {
        display: flex;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        width: 360px;
        max-height: 80vh;
        border-radius: 4px;
    }
}

/* ── Narrower PC screens: adjust popup width ── */
@media (min-width: 769px) and (max-width: 960px) {
    .popup-window {
        width: 280px;
        max-width: calc((100vw - 64px) / 3);
    }

    .popup-window--stacked {
        width: 280px;
    }
}
