/* =============================================
   MAIN THEME — Daily Borendrokontho E-Paper
   Clean, modern newspaper reader design
   ============================================= */

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; }
body * { border-radius: 0 !important; }

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Roboto', 'Noto Sans Bengali', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: #e8eaed;
    color: #333;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

a { color: #c0392b; transition: color 0.2s; }
a:hover { color: #e74c3c; text-decoration: none; }

img { max-width: 100%; }

/* === HEADER === */
.epaper-header {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
}

.header-inner a {
    display: block;
}

.header-inner img {
    height: 50px;
    max-width: 320px;
    width: auto;
}

/* === NAVIGATION === */
.epaper-nav {
    background: #1a1a2e;
    border-top: 3px solid #c0392b;
    position: relative;
    z-index: 99;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    gap: 12px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.edition-name {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edition-date {
    color: #aaa;
    font-size: 12px;
    white-space: nowrap;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-archive {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #c0392b;
    color: #fff;
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.2s;
    border: none;
}

.btn-archive:hover, .btn-archive:focus {
    background: #e74c3c;
    color: #fff;
    text-decoration: none;
}

/* === TOOLBAR === */
.epaper-toolbar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 5px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-group label {
    font-weight: 600;
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin: 0;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #ddd;
    margin: 0 4px;
}

.toolbar-select {
    appearance: none;
    -webkit-appearance: none;
    background: #f5f5f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E") no-repeat right 8px center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 28px 5px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    height: 32px;
    outline: none;
    transition: border-color 0.2s;
}

.toolbar-select:focus {
    border-color: #c0392b;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.toolbar-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.toolbar-btn.active {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.toolbar-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 32px;
}

.toolbar-btn-text:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.toolbar-btn-text i {
    font-size: 13px;
}

.toolbar-spacer {
    flex: 1;
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px;
}

.zoom-controls .toolbar-btn {
    border: none;
    background: transparent;
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.zoom-controls .toolbar-btn:hover {
    background: #ddd;
    color: #333;
}

.zoom-pct {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    min-width: 36px;
    text-align: center;
    user-select: none;
}

/* === MAIN CONTENT === */
.epaper-main {
    padding: 10px 0;
}

/* === VIEWER LAYOUT === */
.epaper-viewer {
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* === THUMBNAIL SIDEBAR === */
#thumbSidebar {
    width: 130px;
    min-width: 120px;
    background: #f8f8f8;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-heading {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #c0392b;
    padding: 10px 6px 8px;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#thumbBar {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

#thumbBar::-webkit-scrollbar {
    width: 4px;
}

#thumbBar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

#thumbBar .pagethumb {
    margin-bottom: 8px;
    cursor: pointer;
    text-align: center;
    border-radius: 3px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

#thumbBar .pagethumb img {
    width: 100%;
    display: block;
    border-radius: 2px;
}

#thumbBar .pagethumb:hover {
    border-color: #c0392b;
}

#thumbBar .pagethumb.current {
    border-color: #f39c12;
    box-shadow: 0 0 0 1px #f39c12;
}

#thumbBar .pg_label {
    display: block;
    font-size: 9px;
    color: #888;
    padding: 2px 0;
    text-align: center;
    background: #f0f0f0;
    font-weight: 600;
}

#thumbBar .pg_title {
    display: none;
}

/* === PAGE VIEWER === */
#contentArea {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

#page_area {
    position: relative;
    text-align: center;
    background: #fff;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.can {
    position: relative;
    width: 100%;
    line-height: 0;
}

.can #mapimage {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* === PAGE NAVIGATION BAR === */
.epaper-pagination {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.page-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.page-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.page-nav-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
    text-decoration: none;
}

.page-nav-btn.active {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.page-nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.page-nav-info {
    font-size: 12px;
    color: #888;
    font-weight: 600;
    margin: 0 8px;
    white-space: nowrap;
}

/* === EDITION BLOCK (legacy) === */
.mainContent {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.edition-block {
    background: #fff;
    margin-top: 0;
    overflow: hidden;
}

/* === PAGE HEADING === */
.page-heading {
    border-top: 3px solid #c0392b;
    border-bottom: 1px solid #e0e0e0;
    font-size: 20px;
    font-weight: 700;
    padding: 10px 0;
    margin: 10px 0;
}

.page-heading .edition_date {
    color: #999;
    font-size: 13px;
    font-weight: normal;
}

/* === TOOLBAR AREA (legacy compatibility) === */
.toolbar_area {
    padding: 5px 10px;
    background: #f5f5f5;
    border-radius: 4px 4px 0 0;
    margin-bottom: 0;
    display: none;
}

/* === THUMBNAIL MODAL === */
#thumbnail_browser .modal-content {
    border-radius: 6px;
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

#thumbnail_browser .modal-header {
    background: #1a1a2e;
    color: #fff;
    border: none;
    padding: 12px 16px;
}

#thumbnail_browser .modal-header .close {
    color: #fff;
    opacity: 0.7;
    text-shadow: none;
}

#thumbnail_browser .modal-header .close:hover {
    opacity: 1;
}

#thumbnail_browser .modal-title {
    font-weight: 700;
    font-size: 16px;
}

#thumbnail_browser .modal-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
}

#thumbnail_browser .thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

#thumbnail_browser .thumb-item {
    cursor: pointer;
    text-align: center;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: #f9f9f9;
}

#thumbnail_browser .thumb-item:hover {
    border-color: #c0392b;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

#thumbnail_browser .thumb-item.active {
    border-color: #f39c12;
    box-shadow: 0 0 0 2px #f39c12;
}

#thumbnail_browser .thumb-item img {
    width: 100%;
    display: block;
}

#thumbnail_browser .thumb-item .thumb-label {
    font-size: 11px;
    color: #666;
    padding: 6px 4px;
    font-weight: 600;
    background: #f0f0f0;
}

/* === ARTICLE DIALOG === */
#dialogWindow {
    display: none;
}

.pdialog.ui-dialog {
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    position: fixed;
    z-index: 99999 !important;
    border-radius: 6px;
    overflow: hidden;
    border: none;
}

.pdialog.ui-dialog .ui-dialog-content {
    padding: 0;
    overflow: hidden;
}

.pdialog .ui-dialog-titlebar {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.pdialog .ui-dialog-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.ui-dialog-overlay {
    background: rgba(0,0,0,0.5);
}

/* === MAPSTER HIGHLIGHTS === */
.mapster-container {
    position: relative;
}

/* === LOADING OVERLAY === */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.85);
    z-index: 9999;
    text-align: center;
    padding-top: 40vh;
    backdrop-filter: blur(2px);
}

.loading-overlay.active {
    display: block;
}

.loading-overlay i {
    font-size: 36px;
    color: #c0392b;
}

.loading-overlay span {
    display: block;
    margin-top: 10px;
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

/* === FOOTER === */
.epaper-footer {
    background: #1a1a2e;
    color: #ccc;
    padding: 20px 0;
    font-size: 12px;
    margin-top: 10px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.footer-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-brand img {
    max-width: 160px;
    height: auto;
    margin-bottom: 8px;
    display: block;
    
}

.footer-brand p {
    color: #999;
    font-size: 11px;
    margin: 0;
    line-height: 1.6;
}

.footer-info {
    line-height: 1.8;
}

.footer-info strong {
    color: #ddd;
}

.footer-info a {
    color: #e74c3c;
}

.footer-bottom {
    text-align: center;
    padding-top: 12px;
    color: #666;
    font-size: 11px;
}

.footer-bottom a {
    color: #aaa;
}

.footer-bottom a:hover {
    color: #fff;
}

/* Legacy footer compatibility */
#footer {
    display: none;
}

/* === CALENDAR / DATEPICKER === */
.ui-datepicker {
    z-index: 5000000 !important;
}

.ui-datepicker .ui-state-active {
    background: #c0392b !important;
    border-color: #c0392b !important;
}

.cal_outer {
    display: inline-block;
}

/* Hidden inputs for datepicker */
#datetext_nav_cal,
#datetext_cal {
    position: absolute;
    width: 0;
    height: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    visibility: hidden;
}

/* === AD SIDEBAR === */
.ad-sidebar {
    margin-top: 10px;
}

.ad-sidebar img {
    width: 100%;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ad-placeholder {
    background: #f0f0f0;
    border: 2px dashed #ddd;
    border-radius: 4px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder span {
    color: #aaa;
    font-size: 14px;
    font-weight: 600;
}

/* === UTILITY === */
.hidden { display: none !important; }
.no-print { }

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* === PRINT === */
@media print {
    .epaper-header,
    .epaper-nav,
    .epaper-toolbar,
    .epaper-pagination,
    .epaper-footer,
    .loading-overlay,
    #thumbSidebar,
    .shareit_outer,
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .epaper-main {
        padding: 0;
    }

    .epaper-viewer {
        box-shadow: none;
        border: none;
    }

    #page_area {
        min-height: auto;
    }

    #mapimage {
        width: 100% !important;
    }
}

/* Legacy print compatibility */
@media print {
    body * { visibility: hidden; }
    #print_img, #print_img * { visibility: visible; }
    #print_img {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

#print_img { display: none; }
