/* ═══════════════════════════════════════════════════
   ePaper Newsboard v2 — Combined Frontend Styles
   Covers: Edition grid, Page Viewer, News Detail,
           Region Tooltip
═══════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
    --enb-red:          #d32f2f;
    --enb-red-dark:     #9a0007;
    --enb-red-light:    #ffebee;
    --enb-gold:         #f59e0b;
    --enb-dark:         #1a1a1a;
    --enb-mid:          #444;
    --enb-muted:        #888;
    --enb-border:       #e2e2e2;
    --enb-bg:           #f5f5f5;
    --enb-white:        #ffffff;
    --enb-sidebar-w:    200px;
    --enb-header-h:     52px;
    --enb-radius:       8px;
    --enb-shadow:       0 2px 12px rgba(0,0,0,0.12);
    --enb-shadow-hover: 0 8px 28px rgba(0,0,0,0.20);
}

/* ══════════════════════════════════════════════
   1. EDITIONS GRID  (homepage-style, 2 cols)
══════════════════════════════════════════════ */
.enb-editions-wrapper {
    width: 100%;
    padding: 0 8px;
}

.enb-editions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 760px;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .enb-editions-grid { grid-template-columns: 1fr; }
}

.enb-edition-card {
    border-radius: var(--enb-radius);
    overflow: hidden;
    box-shadow: var(--enb-shadow);
    background: var(--enb-white);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.enb-edition-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--enb-shadow-hover);
}

.enb-edition-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.enb-edition-thumb-wrap {
    position: relative;
    width: 100%;
    background: #f0f0f0;
    aspect-ratio: 2 / 3;
    overflow: hidden;
}
.enb-edition-thumb-wrap img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.35s ease;
}
.enb-edition-card:hover .enb-edition-thumb-wrap img { transform: scale(1.03); }

.enb-edition-hover-overlay {
    position: absolute; inset: 0;
    background: rgba(211,47,47,0.0);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease, background 0.25s ease;
}
.enb-edition-card:hover .enb-edition-hover-overlay {
    opacity: 1;
    background: rgba(211,47,47,0.25);
}

.enb-read-label {
    color: var(--enb-white);
    background: var(--enb-red);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px; font-weight: 600;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.enb-no-thumb {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #e8e8e8; color: var(--enb-muted); font-size: 14px;
}

.enb-edition-footer {
    padding: 10px 14px 12px;
    text-align: center;
}
.enb-edition-name {
    display: block; font-weight: 700; font-size: 15px;
    color: var(--enb-dark); margin-bottom: 3px;
}
.enb-edition-date {
    display: block; font-size: 12px; color: var(--enb-muted);
}

/* ══════════════════════════════════════════════
   2. VIEWER LAYOUT  (Yeshobhumi-style)
══════════════════════════════════════════════ */

.enb-viewer-wrap {
    width: 100%;
    background: var(--enb-bg);
    border-radius: var(--enb-radius);
    overflow: hidden;
    box-shadow: var(--enb-shadow);
    display: flex;
    flex-direction: column;
    min-height: 600px;
    /* Full-viewport height like Yeshobhumi */
    height: calc(100vh - 80px);
    max-height: 1100px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Header bar ── */
.enb-viewer-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    height: var(--enb-header-h);
    min-height: var(--enb-header-h);
    background: var(--enb-red);
    color: var(--enb-white);
    flex-shrink: 0;
    border-bottom: 3px solid var(--enb-red-dark);
}

.enb-viewer-newspaper {
    font-size: 18px; font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1;
}

.enb-viewer-date {
    font-size: 12px; opacity: 0.85; white-space: nowrap;
    background: rgba(0,0,0,0.2);
    padding: 3px 10px; border-radius: 16px;
}

.enb-viewer-page-label {
    font-size: 12px; white-space: nowrap;
    background: rgba(255,255,255,0.18);
    padding: 3px 12px; border-radius: 16px;
    display: flex; gap: 3px; align-items: center;
}
.enb-current-num { font-weight: 700; }

/* ── Body ── */
.enb-viewer-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ── */
.enb-viewer-sidebar {
    width: var(--enb-sidebar-w);
    min-width: var(--enb-sidebar-w);
    background: #fff;
    border-right: 1px solid var(--enb-border);
    overflow: hidden;
    flex-shrink: 0;
}

.enb-sidebar-inner {
    height: 100%;
    overflow-y: auto;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--enb-red) transparent;
}
.enb-sidebar-inner::-webkit-scrollbar       { width: 4px; }
.enb-sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.enb-sidebar-inner::-webkit-scrollbar-thumb { background: var(--enb-red); border-radius: 2px; }

.enb-sidebar-item {
    cursor: pointer;
    border-radius: 5px; overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f8f8; outline: none;
}
.enb-sidebar-item:hover {
    border-color: rgba(211,47,47,0.4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.enb-sidebar-item.active {
    border-color: var(--enb-red);
    box-shadow: 0 0 0 1px var(--enb-red);
}

.enb-sidebar-thumb img {
    width: 100%; height: auto; display: block;
    aspect-ratio: 2/3; object-fit: cover;
}

.enb-sidebar-label {
    text-align: center; font-size: 11px;
    color: var(--enb-mid); padding: 4px 2px;
    font-weight: 500; background: #fff;
}
.enb-sidebar-item.active .enb-sidebar-label {
    color: var(--enb-red); font-weight: 700;
}

/* ── Main viewer ── */
.enb-viewer-main {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #e0e0e0;
}

.enb-viewer-main-inner {
    height: 100%;
    overflow-y: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--enb-red) transparent;
}
.enb-viewer-main-inner::-webkit-scrollbar       { width: 5px; }
.enb-viewer-main-inner::-webkit-scrollbar-track { background: transparent; }
.enb-viewer-main-inner::-webkit-scrollbar-thumb { background: var(--enb-red); border-radius: 3px; }

/* ── Area-map wrap: image + region overlays ── */
.enb-areamap-wrap {
    position: relative;
    display: block;
    line-height: 0;
    /* shadow like Yeshobhumi page image */
    box-shadow: 0 4px 24px rgba(0,0,0,0.22);
    margin: 12px auto;
    max-width: 960px;
}

.enb-viewer-full-img {
    width: 100%; height: auto; display: block;
    transition: opacity 0.3s ease;
}

/* ── Loading overlay ── */
.enb-loading-overlay {
    position: absolute; inset: 0;
    background: rgba(245,245,245,0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 20;
}

.enb-spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(211,47,47,0.2);
    border-top-color: var(--enb-red);
    border-radius: 50%;
    animation: enb-spin 0.8s linear infinite;
}
@keyframes enb-spin { to { transform: rotate(360deg); } }

/* ── Clickable regions overlay ── */
.enb-regions-overlay {
    position: absolute; inset: 0;
    pointer-events: none;
}

.enb-region {
    position: absolute;
    pointer-events: auto;
    border: 2px solid transparent;
    background: rgba(211,47,47,0);
    transition: background 0.18s ease, border-color 0.18s ease;
    cursor: pointer; display: block;
    text-decoration: none;
    box-sizing: border-box;
}
.enb-region:hover {
    border-color: var(--enb-red);
    background: rgba(211,47,47,0.10);
}

/* ── Navigation arrows (Yeshobhumi style) ── */
.enb-nav-arrow {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    z-index: 10;
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--enb-border);
    border-radius: 50%;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 26px;
    color: var(--enb-red);
    transition: background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    padding: 0; line-height: 1;
}
.enb-nav-arrow:hover {
    background: var(--enb-red);
    color: #fff;
    border-color: var(--enb-red);
    box-shadow: 0 4px 16px rgba(211,47,47,0.35);
}
.enb-nav-arrow:disabled {
    opacity: 0.25; cursor: default; pointer-events: none;
}
.enb-nav-prev { left: 10px; }
.enb-nav-next { right: 10px; }

/* ══════════════════════════════════════════════
   3. HOVER TOOLTIP  (news region popup)
══════════════════════════════════════════════ */

.enb-region-tooltip {
    position: absolute;           /* positioned by JS via top/left */
    z-index: 9999;
    pointer-events: none;         /* does not block mouse events */
    width: 240px;
    background: #fff;
    border: 1px solid var(--enb-border);
    border-top: 3px solid var(--enb-red);
    border-radius: var(--enb-radius);
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    padding: 10px 13px 10px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.enb-region-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Small caret arrow pointing down (tooltip is above region) */
.enb-region-tooltip::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px 7px 0;
    border-style: solid;
    border-color: #fff transparent transparent;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.08));
}
.enb-region-tooltip::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: var(--enb-border) transparent transparent;
}

.enb-tooltip-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--enb-dark);
    line-height: 1.4;
    margin-bottom: 5px;
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.enb-tooltip-excerpt {
    font-size: 11.5px;
    color: var(--enb-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.enb-tooltip-cta {
    font-size: 11px;
    font-weight: 600;
    color: var(--enb-red);
    letter-spacing: 0.02em;
    border-top: 1px solid var(--enb-border);
    padding-top: 6px;
    margin-top: 2px;
}

/* ══════════════════════════════════════════════
   4. Mobile responsive (viewer)
══════════════════════════════════════════════ */
@media (max-width: 640px) {
    :root { --enb-sidebar-w: 90px; }
    .enb-viewer-wrap { height: calc(100vh - 60px); }
    .enb-viewer-newspaper { font-size: 15px; }
    .enb-viewer-date { display: none; }
    .enb-nav-arrow { width: 34px; height: 34px; font-size: 20px; }
    .enb-nav-prev { left: 4px; }
    .enb-nav-next { right: 4px; }
    .enb-region-tooltip { width: 200px; }
    .enb-areamap-wrap { margin: 6px auto; }
}

@media (max-width: 420px) {
    :root { --enb-sidebar-w: 70px; }
}

/* ══════════════════════════════════════════════
   5. NEWS ARTICLE DETAIL
══════════════════════════════════════════════ */
.enb-news-detail {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 0 40px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.enb-news-meta-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0 16px;
    border-bottom: 2px solid var(--enb-red);
    margin-bottom: 14px;
}

.enb-news-newspaper {
    background: var(--enb-red); color: #fff;
    padding: 4px 12px; border-radius: 3px;
    font-size: 13px; font-weight: 700;
}
.enb-news-date { font-size: 13px; color: var(--enb-muted); }

/* Share buttons */
.enb-news-share { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

.enb-share-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%;
    color: #fff; text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.enb-share-btn:hover { opacity: 0.85; transform: scale(1.08); color: #fff; }

.enb-share-fb { background: #1877f2; }
.enb-share-tw { background: #000; }
.enb-share-wa { background: #25d366; }
.enb-share-tg { background: #0088cc; }

/* Clipped image */
.enb-news-image-box {
    border: 1px solid var(--enb-border);
    border-radius: var(--enb-radius);
    overflow: hidden; margin-bottom: 22px;
    background: #fafafa; text-align: center; padding: 4px;
}
.enb-news-image-box img { max-width: 100%; height: auto; display: inline-block; }

/* Content body */
.enb-news-content-body { font-size: 16px; line-height: 1.75; color: var(--enb-dark); }

.enb-news-placeholder {
    padding: 24px; background: var(--enb-red-light);
    border-radius: var(--enb-radius);
    border-left: 4px solid var(--enb-red);
    color: var(--enb-mid); font-size: 15px;
}

/* Back links */
.enb-news-back-links {
    display: flex; gap: 14px; margin-top: 28px;
    padding-top: 18px; border-top: 1px solid var(--enb-border); flex-wrap: wrap;
}
.enb-news-back-links a {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 16px; border-radius: 4px;
    font-size: 13px; font-weight: 600; text-decoration: none;
    transition: background 0.2s ease;
}
.enb-back-edition { background: var(--enb-red); color: #fff; }
.enb-back-edition:hover { background: var(--enb-red-dark); color: #fff; }
.enb-back-home { background: var(--enb-border); color: var(--enb-mid); }
.enb-back-home:hover { background: #ccc; color: var(--enb-dark); }

/* ── Notices ── */
.enb-notice {
    padding: 12px 16px;
    background: var(--enb-red-light);
    border: 1px solid rgba(211,47,47,0.3);
    border-radius: var(--enb-radius);
    color: var(--enb-red-dark); font-size: 14px;
}