.topbar {

    display: flex;

    justify-content: center;

    align-items: center;

    width: 100%;

    margin-left: 0;

    margin-top: -8px;

    padding: 4px 12px;

    background:
        linear-gradient(
            135deg,
            #1e3a8a,
            #2563eb
        );

    color: white;

    position: sticky;

    top: 0;

    z-index: 9999;
}
/* =====================================
   PREMIUM NAV TOOLBAR
===================================== */

.nav-toolbar {

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 14px;

    width: 100%;

    padding: 5px 10px;
}
/* ICON BUTTON */

.nav-icon-btn {

    position: relative;

    background: transparent !important;

    border: none !important;

    color: white;

    font-size: 20px;

    width: 34px;

    height: 34px;

    border-radius: 12px;

    display: flex;

    align-items: center;

    justify-content: center;

    cursor: pointer;

    transition: all 0.22s ease;
}

.nav-icon-btn:hover {

    background:
        rgba(255,255,255,0.16) !important;

    transform: translateY(-1px);
}

/* DIVIDER */

.nav-divider {

    width: 1px;

    height: 24px;

    background:
        rgba(255,255,255,0.18);
}

/* PAGE INFO */

.page-info {

    color: white;

    font-weight: 600;

    font-size: 15px;

    min-width: 72px;

    text-align: center;
}

/* HOVER LABEL */

.nav-icon-btn::after {

    content: attr(data-label);

    position: absolute;

    bottom: -42px;

    left: 50%;

    transform:
        translateX(-50%);

    background: rgba(0,0,0,0.88);

    color: white;

    padding: 6px 10px;

    border-radius: 8px;

    font-size: 12px;

    white-space: nowrap;

    opacity: 0;

    pointer-events: none;

    transition: 0.18s ease;
}

.nav-icon-btn:hover::after {

    opacity: 1;
}

/* SECTIONS */
.nav-left,
.nav-center,
.nav-right {

    display: flex;

    align-items: center;

    gap: 10px;

    flex-wrap: nowrap;
}

/* CENTER ALIGN */
.nav-center {

    justify-content: center;

    flex: 1;
}

/* BUTTONS */
.topbar button {

    background: rgba(255,255,255,0.15);

    color: white;

    border: 1px solid rgba(255,255,255,0.18);

    padding: 8px 14px;

    border-radius: 10px;

    cursor: pointer;

    font-weight: 600;

    transition: all 0.2s ease;

    backdrop-filter: blur(4px);
}

.topbar button:hover {

    background: white;

    color: #1e3a8a;

    transform: translateY(-1px);
}

.page-info {
    font-weight: bold;
}

.viewer-container {

    width: 70vw;

    max-width: 1800px;

    margin: 10px auto;

    padding: 0;
}

.main-view {

    position: relative;

    width: 100%;

    background:
        linear-gradient(
            180deg,
            #f8fafc,
            #eef2ff
        );

    padding: 2px;

    border-radius: 6px;

    box-shadow:
        0 10px 30px rgba(15,23,42,0.08);

    overflow: hidden;
}

#mainImage {

    width: 100%;

    height: auto;

    display: block;

    transform-origin: center center;

    border-radius: 14px;

    box-shadow:
        0 8px 24px rgba(0,0,0,0.12);

    background: white;

    cursor: grab;

    touch-action: manipulation;

    opacity: 1;

    transition:
        opacity 0.25s ease,
        transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);

    position: relative;

    left: 0;

    top: 0;
}

.viewer-container {
    width: 100%;
}

/* CROP BOX */
#cropBox {
    position:absolute;
    border:2px dashed red;
    background: rgba(255,0,0,0.1);
    display:none;
    cursor:move;
}

/* resize handle */
#cropBox::after {
    content:"";
    position:absolute;
    width:12px;
    height:12px;
    background:red;
    right:-6px;
    bottom:-6px;
    cursor:se-resize;
}

.date-item {
    padding:8px;
    margin:4px 0;
    background:#f2f2f2;
    border-radius:6px;
    cursor:pointer;
    text-align:center;
}

.date-item:hover {
    background:#0d6efd;
    color:white;
}


/* CORNER HANDLES */
.handle {
    position:absolute;
    width:10px;
    height:10px;
    background:white;
    border:2px solid red;
    border-radius:50%;
    z-index:1000;
}

/* corners */
.tl { top:-7px; left:-7px; cursor:nwse-resize; }
.tr { top:-7px; right:-7px; cursor:nesw-resize; }
.bl { bottom:-7px; left:-7px; cursor:nesw-resize; }
.br { bottom:-7px; right:-7px; cursor:nwse-resize; }

/* 📅 CALENDAR BOX */
.calendar-box {
    position: absolute;
    background: white;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 9999;
    width: 260px;

    transform: scale(0.9);
    opacity: 0;
    transition: all 0.2s ease;
}

.calendar-box.show {
    transform: scale(1);
    opacity: 1;
}
/* HEADER */
.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
}

/* GRID */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

/* DAY CELL */
.cal-day {
    padding: 8px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

/* DISABLED */
.cal-day.disabled {
    background: #eee;
    color: #aaa;
    cursor: not-allowed;
}

/* AVAILABLE */
.cal-day.active {
    background: #0d6efd;
    color: white;
}

/* HOVER */
.cal-day.active:hover {
    transform: scale(1.1);
}

#calendarBtn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
    white-space: nowrap;   /* 🔥 prevent breaking into next line */
}

/* mobile bigger handles */
@media (max-width:768px){
    .handle {
        width:18px;
        height:18px;
    }
}

/* THUMBNAILS */
/* THUMBNAILS */
.sidebar {

    height: auto;

    min-height: 120px;

    display: flex;

    align-items: center;

    overflow-x: auto;

    gap: 10px;

    padding: 10px 12px;

    background: #cbd5e1;

    margin-top: 10px;

    border-radius: 18px;

    box-shadow:
        inset 0 2px 8px rgba(0,0,0,0.10),
        0 4px 14px rgba(15,23,42,0.08);
}

.thumb {

    width: 120px;

    cursor: pointer;

    margin-right: 4px;

    display: flex;

    align-items: center;

    justify-content: center;
}

.thumb img {

    width: 100%;

    border-radius: 10px;

    transition: all 0.2s ease;

    box-shadow:
        0 2px 10px rgba(0,0,0,0.08);
}

.thumb.active img {

    border: 3px solid #2563eb;

    transform: scale(1.04);

    box-shadow:
        0 8px 20px rgba(37,99,235,0.25);
}

/* SHARE PANEL */
#cropShareBar {
    position:absolute;
    display:none;
    flex-direction:column;
    gap:6px;
    background:rgba(0,0,0,0.6);
    padding:8px;
    border-radius:10px;
    backdrop-filter: blur(6px);
    z-index:99999;
}

/* BUTTON */
.share-btn {
    width:28px;
    height:28px;
    border-radius:8px;
    border:none;
    cursor:pointer;
    background:white;
    display:flex;
    align-items:center;
    justify-content:center;
}

.share-btn img {
    width:15px;
    height:15px;
}


/* 📱 MOBILE BIGGER BUTTONS */
@media (max-width: 768px) {
    /* 📱 HIDE PAGE NAV IN MOBILE */

    html,
    body {
        overflow-x: hidden;
    }

    #navPrevBtn,
    #navNextBtn,
    .page-info {

        display: none;
    }
    .share-btn {
        width:28px;
        height:28px;
        border-radius:8px;
    }

    .share-btn img {
        width:15px;
        height:15px;
    }
}

/* 📱 MOBILE NAVBAR FIX */
@media (max-width: 768px) {

    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px;
    }

    .nav-left,
    .nav-center,
    .nav-right {
        display: flex;

        align-items: center;

        justify-content: center;

        gap: 8px;

        flex-wrap: nowrap;

        overflow-x: auto;
    }

    .topbar button {

        flex: 0 0 auto;

        font-size: 13px;

        padding: 6px 10px;

        white-space: nowrap;
    }

    .page-info {
        font-size: 13px;
    }
}

@media (max-width: 768px) {

    .sidebar {

        min-height: 140px;

        padding: 6px 8px;

        gap: 8px;

        align-items: center;

        background: #cbd5e1;
    }

    .thumb {

        width: 20vw;

        flex-shrink: 0;

        margin-right: 4px;

        display: flex;

        align-items: center;

        justify-content: center;
    }

    .thumb img {

        width: 100%;

        height: auto;

        border-radius: 8px;
    }
}


/* 📱 MOBILE CLEAN MENU */
.mobile-menu-btn {
    display: none;
}

.floating-crop-btn {
    display: none;
}

/* 💻 PREMIUM CENTER TOOLBAR */
.mobile-menu {

    display: flex;

    justify-content: center;

    width: 100%;
}

@media (max-width: 768px) {
    /* 📱 FIXED BOTTOM TOOLBAR */
    .mobile-menu {

        position: fixed !important;

        left: 0;

        right: 0;

        bottom: 0;

        z-index: 2147483647;

        width: 100%;

        max-width: 100vw;

        overflow-x: hidden;

        flex: none !important;

        box-sizing: border-box;
    }


    /* 📱 MOBILE PREMIUM TOOLBAR */

    .nav-toolbar {

        display: flex;

        align-items: center;

        justify-content: center;

        gap: 6px;

        padding: 8px 12px;

        border-radius: 0px;

        background:
            rgba(0,0,0,0.72);

        backdrop-filter: blur(12px);

        box-shadow:
            0 4px 18px rgba(0,0,0,0.28);

        width: 100%;

        box-sizing: border-box;

        flex-wrap: nowrap;

        overflow-x: auto;

        max-width: 100vw;

        -webkit-overflow-scrolling: touch;
    }

    /* 📱 MOBILE ICONS */

    .nav-icon-btn {

        width: 32px;

        height: 32px;

        font-size: 16px;
    }

    /* 📱 MOBILE LABEL HIDE */

    .nav-icon-btn::after {

        display: none;
    }


    /* 🔥 FLOATING CROP BUTTON */
    .floating-crop-btn {
        display: block;
        position: fixed !important;
        left: max(16px, env(safe-area-inset-left));

        bottom: max(90px, env(safe-area-inset-bottom));

        z-index: 2147483647;

        background: #0d6efd;
        color: white;
        border: none;
        border-radius: 999px;
        padding: 14px 18px;

        font-weight: bold;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        pointer-events: auto;

        transform: translate3d(0,0,0);

        will-change: transform;

        backface-visibility: hidden;
    }
    /* 🔥 HIDE DESKTOP CROP BUTTON IN MOBILE */
    .desktop-crop-btn {
        display: none;
    }
    .viewer-container {
        padding: 0;
    }

    .main-view {
        padding: 0;
    }

    #mainImage {
        width: 100%;
    }
}

/* 🌙 DARK MODE BUTTON SPACING */
.dark-toggle-btn {
    margin-left: 10px;
}

/* ⚡ PAGE LOADING EFFECT */
.image-loading {
    opacity: 0.25;
}

/* ⚡ SWIPE PAGE EFFECT */
.page-swipe-left {
    animation: swipeLeft 0.22s ease;
}

.page-swipe-right {
    animation: swipeRight 0.22s ease;
}

@keyframes swipeLeft {

    from {
        transform: translateX(30px);
        opacity: 0.7;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes swipeRight {

    from {
        transform: translateX(-30px);
        opacity: 0.7;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* -------------------------
   ARTICLE HOTSPOTS
------------------------- */

#articleHotspots {

    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;
}


/* -------------------------
   ARTICLE REGION
------------------------- */

.article-hotspot {

    position: absolute;

    border: 2px solid transparent;

    background: rgba(0,255,136,0.01);

    pointer-events: auto;

    cursor: pointer;

    transition: 0.2s;
}

.article-hotspot:hover {

    border-color: #00ff88;

    background: rgba(0,255,136,0.18);

    box-shadow: 0 0 12px rgba(0,255,136,0.5);
}

/* -------------------------
   ARTICLE POPUP
------------------------- */

#articlePopup {

    position: fixed;

    left: 0;
    top: 0;

    width: 100%;
    height: 100%;

    display: none;

    z-index: 9999;
}


/* DARK BACKGROUND */

#popupOverlay {

    position: absolute;

    width: 100%;
    height: 100%;

    background: rgba(0,0,0,0.82);

    backdrop-filter: blur(3px);
}


/* CONTENT */
#popupContent {

    position: absolute;

    left: 50%;
    top: 50%;

    transform:
        translate(-50%, -50%);

    width: 75vw;

    max-width: 1200px;

    height: 85vh;

    background: white;

    border-radius: 18px;

    overflow: hidden;

    z-index: 2;

    display: flex;

    align-items: center;

    justify-content: center;

    transition: 0.25s ease;
}

/* VIEWPORT */

#popupImageViewport {

    width: 100%;

    height: 100%;

    overflow: auto;

    display: flex;

    align-items: center;

    justify-content: flex-start;

    background: #111;

    padding: 20px;
}

/* FULLSCREEN ZOOM MODE */
#popupContent.zoomed {

    position: fixed;

    left: 0;
    top: 0;

    transform: none;

    width: 100vw;

    max-width: none;

    height: 100vh;

    border-radius: 0;
}

/* IMAGE */

#popupArticleImage {

    max-width: 100%;

    max-height: 100%;

    width: auto;

    height: auto;

    border-radius: 10px;

    object-fit: contain;
}

/* IMAGE IN ZOOM MODE */

#popupContent.zoomed
#popupArticleImage {

    max-width: none;

    max-height: 95vh;

    width: auto;

    height: auto;

    object-fit: contain;
}

/* CLOSE BUTTON */

#closePopupBtn {

    position: fixed;

    top: 20px;
    right: 20px;

    width: 48px;
    height: 48px;

    border: none;

    border-radius: 50%;

    background: rgba(255,255,255,0.95);

    color: black;

    cursor: pointer;

    font-size: 22px;

    font-weight: bold;

    z-index: 99999;

    box-shadow:
        0 4px 14px rgba(0,0,0,0.25);
}


/* ZOOM BUTTON */
#zoomToggleBtn {

    position: fixed;

    top: 20px;
    right: 80px;

    width: 48px;
    height: 48px;

    border: none;

    border-radius: 50%;

    background: rgba(0,0,0,0.72);

    color: white;

    font-size: 18px;

    cursor: pointer;

    z-index: 99999;

    box-shadow:
        0 4px 14px rgba(0,0,0,0.35);

    opacity: 1;

    transition: 0.2s;
}


.subscription-test-box {

    background: #dc2626;

    color: white;

    padding: 14px;

    text-align: center;

    font-size: 18px;

    font-weight: bold;
}

/* 🔒 ARCHIVE LOCK */

.archive-lock-box {

    background: white;

    margin: 30px auto;

    padding: 30px;

    max-width: 500px;

    border-radius: 16px;

    text-align: center;

    box-shadow:
        0 4px 20px rgba(0,0,0,0.15);
}

.archive-lock-box h2 {

    margin-bottom: 15px;

    color: #dc2626;
}

.archive-lock-box p {

    margin-bottom: 20px;

    font-size: 16px;
}

.archive-login-btn {

    display: inline-block;

    padding: 10px 20px;

    background: #2563eb;

    color: white;

    text-decoration: none;

    border-radius: 10px;

    font-weight: bold;
}

.archive-login-btn:hover {

    background: #1d4ed8;
}

/* =====================================
   IMAGE SIDE NAVIGATION
===================================== */

.image-nav-btn {

    position: absolute;

    top: 32%;

    transform: translateY(-50%);

    width: 52px;

    height: 52px;

    border: none;

    border-radius: 50%;

    background:
        rgba(0,0,0,0.55);

    color: white;

    font-size: 38px;

    font-weight: 300;

    display: flex;

    align-items: center;

    justify-content: center;

    cursor: pointer;

    z-index: 200;

    backdrop-filter: blur(8px);

    transition: all 0.22s ease;

    opacity: 0.75;
}

/* HOVER */

.image-nav-btn:hover {

    opacity: 1;

    transform:
        translateY(-50%)
        scale(1.08);

    background:
        rgba(37,99,235,0.88);
}

/* LEFT */

.image-prev-btn {

    left: 18px;
}

/* RIGHT */

.image-next-btn {

    right: 18px;
}

/* HIDE BUTTON */

.image-nav-btn.hidden {

    display: none;
}

/* MOBILE */

@media (max-width: 768px) {

    .image-nav-btn {

        width: 42px;

        height: 42px;

        font-size: 30px;
    }

    .image-prev-btn {

        left: 8px;
    }

    .image-next-btn {

        right: 8px;
    }
}

html,
body {
    overflow-x: hidden;
}
