/*
Theme Name: Max E-Paper Pro
Theme URI: https://example.com/
Author: Max Web Solution
Description: Responsive newspaper e-paper reader (Max E-Paper Pro) with page thumbnails, main page viewer, and right-side view tabs.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: max-epaper-reader
*/
:root{--ep-red:#ed1c24;--ep-dark:#24272b;--ep-border:#d7dce1;--ep-bg:#f6f7f9}
*{box-sizing:border-box}
body{margin:0;background:var(--ep-bg);color:#202124;font-family:Arial,"Noto Sans Bengali",sans-serif}
a{color:inherit}
.ep-wrap{max-width:1920px;margin:auto;padding:12px 16px}
.ep-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.ep-toolbar button,.ep-toolbar select,.ep-toolbar input{font:inherit;border:1px solid #aeb6bf;background:#fff;border-radius:9px;min-height:46px;padding:8px 13px}
.ep-toolbar button{cursor:pointer;font-size:20px;min-width:48px}
.ep-toolbar .ep-page-no{min-width:60px;text-align:center}
.ep-edition{min-width:220px}
.ep-reader{display:grid;grid-template-columns:154px minmax(300px,1fr) minmax(300px,26%);gap:22px;align-items:start}
.ep-thumbs{height:calc(100vh - 105px);min-height:460px;overflow:auto;padding:0 4px 0 0}
.ep-thumb{display:block;width:100%;border:2px solid #d9dde2;background:#fff;padding:5px;margin:0 0 14px;cursor:pointer}
.ep-thumb img{display:block;width:100%;height:auto}
.ep-thumb.active{border:3px solid var(--ep-red);padding:4px}
.ep-main{background:#fff;border:1px solid var(--ep-border);min-height:500px;display:flex;align-items:flex-start;justify-content:center;overflow:auto;max-height:calc(100vh - 105px);padding:12px}
.ep-main img{display:block;width:100%;height:auto;max-width:100%;object-fit:contain;transform-origin:top center;transition:transform .15s}
.ep-main.zoomed img{width:150%;max-width:none;cursor:zoom-out}
.ep-sidebar{min-width:0}
.ep-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border:1px solid var(--ep-red);border-radius:10px 10px 0 0;overflow:hidden;background:#fff}
.ep-tab{font-family:inherit;border:0;border-right:1px solid var(--ep-red);padding:14px 5px;min-height:76px;background:#fff;font-size:clamp(14px,1.15vw,23px);cursor:pointer;line-height:1.3}
.ep-tab:last-child{border-right:0}
.ep-tab.active{background:#303137;color:#fff}
.ep-actions{display:flex;justify-content:center;gap:12px;padding:14px 0}
.ep-round{width:48px;height:48px;border:0;border-radius:50%;background:#18885c;color:#fff;font-size:20px;cursor:pointer}
.ep-round:nth-child(2){background:#1877f2}.ep-round:nth-child(3){background:#202124}.ep-round:nth-child(4){background:#df3445}.ep-round:nth-child(5){background:#747d85}
.ep-panel{background:#fff;border:1px solid var(--ep-border);padding:16px;max-height:calc(100vh - 300px);min-height:300px;overflow:auto}
.ep-panel[hidden]{display:none}
.ep-panel img{width:100%;height:auto;display:block;margin:0 0 20px;border-bottom:1px solid #e0e3e7;padding-bottom:20px}
.ep-panel .ep-text-content{line-height:1.8;white-space:pre-wrap}
.ep-print{display:flex;justify-content:flex-end;margin-bottom:14px}
.ep-print button{background:white;border:1px solid #9ca3af;border-radius:7px;padding:10px 14px;cursor:pointer}
.ep-notice{color:#69717a;text-align:center;padding:30px 12px}
.ep-mobile-pages{display:none}
@media(max-width:1100px){.ep-reader{grid-template-columns:112px minmax(0,1fr)}.ep-sidebar{grid-column:1/-1}.ep-panel{max-height:600px}.ep-main{max-height:none}.ep-tabs{grid-template-columns:repeat(4,1fr)}}
@media(max-width:640px){.ep-wrap{padding:8px}.ep-toolbar{gap:5px}.ep-toolbar button,.ep-toolbar select,.ep-toolbar input{min-height:40px;padding:6px 9px}.ep-edition{min-width:145px;flex:1}.ep-reader{grid-template-columns:1fr;gap:10px}.ep-thumbs{display:flex;gap:8px;height:auto;min-height:0;overflow-x:auto;overflow-y:hidden;padding:0 0 8px}.ep-thumb{flex:0 0 76px;width:76px;margin:0}.ep-main{min-height:200px;padding:5px;max-height:none}.ep-sidebar{grid-column:auto}.ep-tab{min-height:60px;font-size:14px;padding:8px 3px}.ep-actions{gap:8px}.ep-round{width:40px;height:40px}.ep-panel{max-height:450px;min-height:180px;padding:10px}}


/* Header */
.ep-header{background:#fff;border-bottom:1px solid #e5e7eb;padding:8px 0}
.ep-header-inner{max-width:1920px;margin:auto;padding:0 16px;display:flex;align-items:center;justify-content:space-between;gap:16px}
.ep-logo{flex:0 0 auto}
.ep-logo img{max-height:48px;width:auto}
.ep-logo-text{text-decoration:none;display:flex;flex-direction:column;line-height:1.05}
.ep-logo-main{font-size:20px;font-weight:700;color:#ed1c24}
.ep-logo-tag{font-size:10px;color:#555;margin-top:1px}
.ep-header-meta{display:flex;align-items:center;gap:12px;font-size:13px;color:#333;margin-left:auto}
.ep-meta-item{display:flex;align-items:center;gap:5px}
.ep-meta-date{font-weight:600}
.ep-header-social{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;text-decoration:none;flex-shrink:0}
.ep-header-social.ep-fb{background:#1877f2}
.ep-header-social.ep-mail{background:#e74c3c}

@media(max-width:768px){
  .ep-header{padding:8px 0}
  .ep-header-inner{flex-wrap:wrap;gap:6px;align-items:center}
  .ep-logo{order:1;flex:1;text-align:center}
  .ep-logo-main{font-size:18px}
  .ep-logo img{max-height:36px}
  .ep-header-meta{order:2;width:100%;display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px;margin-left:0;padding:0 4px}
  .ep-meta-item:first-child{order:1}
  .ep-meta-date{order:1}
  .ep-online-btn{order:2;margin:0 auto}
  .ep-header-social{order:3;width:28px;height:28px}
  .ep-header-meta > a.ep-header-social:nth-of-type(1){margin-left:auto}
}
@media(max-width:480px){
  .ep-logo-main{font-size:16px}
  .ep-logo-tag{font-size:9px}
  .ep-header-meta{gap:6px;font-size:11px}
  .ep-meta-item svg{width:14px;height:14px}
}

/* Footer */

.ep-footer{background:#f8f9fa;border-top:1px solid #e5e7eb;margin-top:30px;font-size:14px;color:#333}
.ep-footer-main{max-width:1920px;margin:auto;padding:28px 16px;display:grid;grid-template-columns:1.1fr 1.2fr 1.4fr;gap:30px;align-items:start}
.ep-footer-col{padding:0 10px}
.ep-footer-editors,.ep-footer-contact{border-left:1px solid #d0d5dd}
.ep-footer-brand{display:flex;flex-direction:column;line-height:1.15}
.ep-brand-main{font-size:32px;font-weight:800;color:#ed1c24}
.ep-brand-tag{font-size:13px;color:#444;margin-top:4px}
.ep-footer-logo-img{max-width:180px;margin-bottom:6px}
.ep-footer-logo-img img{max-height:48px;width:auto;display:block}
.ep-footer-editors p,.ep-footer-contact p{margin:0 0 8px;line-height:1.6}
.ep-contact-line{display:flex;align-items:center;gap:8px;margin-top:10px}
.ep-icon{font-size:16px}
.ep-footer-bottom{border-top:1px solid #e5e7eb;max-width:1920px;margin:auto;padding:14px 16px;display:flex;justify-content:space-between;align-items:center}
.ep-copyright{font-size:15px}
.ep-social{display:flex;gap:10px}
.ep-social-btn{width:36px;height:36px;border-radius:50%;background:#1877f2;color:#fff;display:flex;align-items:center;justify-content:center;text-decoration:none;font-weight:700;font-size:16px}
.ep-social-btn:last-child{background:#333}

@media(max-width:900px){
  .ep-footer-main{grid-template-columns:1fr;gap:18px}
  .ep-footer-editors,.ep-footer-contact{border-left:0;border-top:1px solid #e5e7eb;padding-top:14px}
  .ep-header-inner{flex-direction:column;text-align:center}
  .ep-header-right{text-align:center}
  .ep-menu{justify-content:center}
}
@media(max-width:640px){
  .ep-brand-main{font-size:26px}
  .ep-footer-logo-img img{max-height:36px}
  .ep-footer-bottom{flex-direction:column;gap:10px;text-align:center}
}


/* Mobile Layout Order */
@media(max-width:640px){
  .ep-wrap{padding:8px}
  .ep-toolbar{order:1;margin-bottom:10px}
  .ep-reader{display:flex;flex-direction:column;gap:12px}
  .ep-main{order:2;min-height:200px;padding:5px}
  .ep-thumbs{order:3;display:flex;gap:8px;height:auto;min-height:0;overflow-x:auto;overflow-y:hidden;padding:8px 0}
  .ep-thumb{flex:0 0 70px;width:70px;margin:0}
  .ep-sidebar{order:4}
  .ep-tabs{grid-template-columns:repeat(4,1fr)}
  .ep-tab{min-height:52px;font-size:12px;padding:6px 2px}
}


/* Mobile Popup */
#ep-mobile-popup{display:none;position:fixed;inset:0;z-index:999999}
#ep-mobile-popup.open{display:block}
.ep-popup-overlay{position:absolute;inset:0;background:rgba(0,0,0,.65)}
.ep-popup-content{position:absolute;left:0;right:0;bottom:0;top:70px;background:#fff;border-radius:16px 16px 0 0;overflow:auto;padding:16px}
.ep-popup-close{position:fixed;top:12px;right:12px;width:48px;height:48px;border-radius:50%;background:#e74c3c;color:#fff;border:0;font-size:24px;font-weight:bold;cursor:pointer;z-index:9999999;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 8px rgba(0,0,0,.3)}
.ep-popup-body .ep-tabs{margin-bottom:12px}
.ep-popup-body .ep-actions{margin-bottom:12px}
@media(min-width:641px){
  #ep-mobile-popup{display:none !important}
  .ep-sidebar{display:block}
}
@media(max-width:640px){
  .ep-sidebar{display:none}
}

.ep-online-btn{display:inline-flex;align-items:center;gap:5px;padding:6px 12px;background:#ed1c24;color:#fff;border-radius:20px;text-decoration:none;font-size:13px;font-weight:600}
.ep-online-btn:hover{background:#c4161d}
.ep-header-social.ep-yt{background:#ff0000}


/* Linked slice in sidebar */
.ep-linked-slice img{display:block;margin-top:4px}
.ep-linked-slice strong{font-size:15px}



/* Print button */
.ep-print-btn{background:#555 !important;display:flex;align-items:center;justify-content:center}
.ep-print-btn svg{display:block}
.ep-print-icon-btn{background:#fff;border:1px solid #9ca3af;border-radius:7px;padding:8px 14px;cursor:pointer;font:inherit;display:inline-flex;align-items:center;gap:6px}
.ep-print-icon-btn:hover{background:#f5f5f5}
@media print {
  .ep-header,.ep-footer,.ep-toolbar,.ep-thumbs,.ep-tabs,.ep-actions,.ep-print,.ep-sidebar > .ep-tabs{display:none !important}
  .ep-reader{display:block}
  .ep-sidebar{width:100%}
  .ep-panel{max-height:none;border:0;padding:0}
  .ep-panel img{max-width:100%;page-break-inside:avoid}
}
