/* Tasawerali E-Paper — WordPress-friendly, responsive newspaper viewer */
.cep-viewer{
  --cep-bg:#f4f6f8;
  --cep-card:#fff;
  --cep-text:#17202a;
  --cep-muted:#68727d;
  --cep-border:#dfe4e8;
  --cep-accent:#1f2937;
  width:100%;max-width:1380px;margin:0 auto;padding:18px;
  box-sizing:border-box;background:var(--cep-bg);color:var(--cep-text);
  border:1px solid var(--cep-border);border-radius:12px;
  box-shadow:0 8px 30px rgba(20,30,40,.08);
}
.cep-viewer h1{margin:0;font-size:clamp(24px,3vw,38px);line-height:1.15;font-weight:700;color:var(--cep-text)}
.cep-edition-date{margin:6px 0 16px;color:var(--cep-muted);font-size:14px}
.cep-toolbar{
  display:flex;align-items:center;gap:7px;flex-wrap:wrap;padding:10px;
  margin-bottom:12px;background:var(--cep-card);border:1px solid var(--cep-border);
  border-radius:10px;position:sticky;top:10px;z-index:5;box-shadow:0 3px 14px rgba(20,30,40,.06)
}
.cep-toolbar button,.cep-toolbar select{
  appearance:none;min-height:38px;padding:7px 11px;border:1px solid #cfd6dc;
  border-radius:7px;background:#fff;color:#1f2937;font-size:14px;line-height:1.2;
  cursor:pointer;transition:background .15s,border-color .15s,transform .05s
}
.cep-toolbar button:hover,.cep-toolbar select:hover{background:#f2f4f6;border-color:#aeb8c2}
.cep-toolbar button:active{transform:translateY(1px)}
.cep-toolbar [data-action="prev"],.cep-toolbar [data-action="next"]{font-weight:600}
.cep-toolbar span{padding:0 8px;color:var(--cep-muted);font-size:14px;white-space:nowrap}
.cep-canvas-wrap{
  width:100%;min-height:420px;overflow:auto;text-align:center;background:#dfe3e7;
  border:1px solid #cfd5da;border-radius:8px;padding:16px;box-sizing:border-box;
  overscroll-behavior:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y pinch-zoom;-ms-touch-action:pan-y
}
.cep-canvas-wrap canvas{display:block;margin:0 auto;background:#fff;box-shadow:0 4px 20px rgba(0,0,0,.18);touch-action:pan-y pinch-zoom;-ms-touch-action:pan-y}
.cep-pages{
  display:flex;gap:6px;overflow-x:auto;padding:10px 2px 4px;margin-top:8px;
  scrollbar-width:thin
}
.cep-pages button{
  flex:0 0 auto;min-width:38px;height:34px;padding:4px 9px;border:1px solid #cfd6dc;
  border-radius:6px;background:#fff;color:#374151;cursor:pointer
}
.cep-pages button:hover{background:#f2f4f6}
.cep-pages button.active{background:#1f2937;color:#fff;border-color:#1f2937}
.cep-archive{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:12px;padding:12px;background:#fff;border:1px solid var(--cep-border);border-radius:10px}
.cep-archive label{font-weight:600;font-size:14px}
.cep-archive select{min-height:38px;padding:7px 34px 7px 10px;border:1px solid #cfd6dc;border-radius:7px;background:#fff;max-width:100%;font-size:14px}
.cep-status{min-height:20px;margin-top:9px;color:var(--cep-muted);font-size:13px;text-align:center}
.cep-progress{height:3px;width:100%;margin-top:8px;background:#e5e7eb;overflow:hidden;border-radius:99px}
.cep-progress::after{content:"";display:block;width:35%;height:100%;background:#6b7280;animation:cepProgress 1.1s ease-in-out infinite}
.cep-error .cep-canvas-wrap{min-height:120px;display:flex;align-items:center;justify-content:center}
@keyframes cepProgress{0%{transform:translateX(-120%)}100%{transform:translateX(320%)}}
.tasawerali-epaper-viewer-page{width:100%;max-width:1440px;margin:0 auto;padding:20px;box-sizing:border-box}

@media (max-width:767px){
  .cep-viewer{padding:10px;border-radius:8px}
  .cep-toolbar{position:static;padding:8px}
  .cep-toolbar button,.cep-toolbar select{min-height:36px;padding:6px 9px;font-size:13px}
  .cep-toolbar span{order:-1;width:100%;padding:2px 0 4px;text-align:center}
  .cep-canvas-wrap{min-height:300px;padding:8px}
  .tasawerali-epaper-viewer-page{padding:8px}
}

/* v2.1.7: edition selector is intentionally part of the top toolbar. */
.cep-toolbar select{min-width:170px;max-width:230px;cursor:pointer}
@media (max-width:600px){
  .cep-toolbar{gap:6px}
  .cep-toolbar button,.cep-toolbar select{font-size:13px;padding:6px 8px}
  .cep-toolbar select{min-width:145px;max-width:100%;flex:1}
}

/* v2.1.8 — Tasawerali newspaper toolbar styling */
.cep-viewer{
  --cep-brand:#06b6d4;
  --cep-brand-dark:#0891b2;
}
.cep-toolbar{
  background:#06b6d4;
  border:1px solid #0891b2;
  border-radius:12px;
  padding:9px 10px;
  gap:10px;
  color:#fff;
  box-shadow:0 5px 18px rgba(6,182,212,.20);
}
.cep-toolbar-main{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  flex:1 1 auto;
  min-width:0;
}
.cep-toolbar button,
.cep-toolbar select{
  min-height:38px;
  border:1px solid rgba(255,255,255,.62);
  border-radius:8px;
  background:#fff;
  color:#164e63;
  font-weight:600;
}
.cep-toolbar button:hover,
.cep-toolbar select:hover{
  background:#f0fdff;
  border-color:#fff;
}
.cep-toolbar span{color:#fff}
.cep-toolbar-main > span{
  color:#fff;
  background:rgba(0,0,0,.10);
  border-radius:7px;
  padding:8px 10px;
  font-weight:600;
}
.cep-archive-button{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  background:#075985 !important;
  color:#fff !important;
  border-color:rgba(255,255,255,.55) !important;
  min-width:142px;
  font-size:16px !important;
  font-family:Tahoma, Arial, sans-serif;
  direction:rtl;
}
.cep-archive-button:hover{background:#0c4a6e !important;color:#fff !important}
.cep-archive-icon{font-size:20px;line-height:1;color:#fff !important}
.cep-edition-control{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:7px;
  direction:rtl;
}
.cep-edition-control label{
  color:#fff;
  font-size:13px;
  font-weight:700;
  white-space:nowrap;
}
.cep-edition-control select{
  min-width:190px;
  max-width:240px;
  background:#06b6d4 !important;
  color:#fff !important;
  border:2px solid rgba(255,255,255,.92) !important;
  border-radius:9px !important;
  padding-left:12px;
  padding-right:12px;
  font-weight:700;
  outline:none;
}
.cep-edition-control select option{
  background:#fff;
  color:#164e63;
  font-weight:600;
}
.cep-archive{display:none !important}

/* Fullscreen: keep archive control at the far left and date control at the far right. */
.cep-viewer:fullscreen .cep-toolbar,
.cep-viewer:-webkit-full-screen .cep-toolbar{
  position:fixed;
  left:16px;
  right:16px;
  top:14px;
  z-index:999999;
}
.cep-viewer:fullscreen .cep-canvas-wrap,
.cep-viewer:-webkit-full-screen .cep-canvas-wrap{
  height:calc(100vh - 82px);
  margin-top:68px;
  min-height:0;
}

@media (max-width:900px){
  .cep-toolbar{align-items:stretch}
  .cep-archive-button{min-width:125px}
  .cep-toolbar-main{flex-wrap:wrap}
  .cep-edition-control select{min-width:165px}
}
@media (max-width:767px){
  .cep-toolbar{position:static;display:flex;align-items:center;padding:8px;gap:6px}
  .cep-archive-button{order:0;min-width:118px;font-size:14px !important;padding:6px 9px}
  .cep-toolbar-main{order:1;flex:1 1 100%;display:flex;justify-content:center;gap:5px}
  .cep-toolbar-main > span{order:-1;width:auto;font-size:12px;padding:6px 7px}
  .cep-toolbar-main button{font-size:12px;padding:6px 7px;min-height:34px}
  .cep-edition-control{order:2;width:100%;justify-content:flex-end}
  .cep-edition-control label{font-size:12px}
  .cep-edition-control select{flex:1;min-width:0;max-width:none;min-height:36px;font-size:12px}
  .cep-viewer:fullscreen .cep-toolbar,
  .cep-viewer:-webkit-full-screen .cep-toolbar{left:7px;right:7px;top:7px}
  .cep-viewer:fullscreen .cep-canvas-wrap,
  .cep-viewer:-webkit-full-screen .cep-canvas-wrap{height:calc(100vh - 120px);margin-top:108px}
}


/* v2.1.9 — archive/date picker: current edition stays visible in the header */
.cep-archive-picker{position:relative;flex:0 0 auto;direction:rtl}
.cep-archive-button{
  min-width:190px !important;
  min-height:48px !important;
  display:grid !important;
  grid-template-columns:auto 1fr auto;
  grid-template-areas:"icon title chevron" "icon date chevron";
  align-items:center;
  column-gap:8px;
  row-gap:1px;
  padding:6px 11px !important;
  text-align:right;
}
.cep-archive-icon{grid-area:icon;font-size:20px}
.cep-archive-title{grid-area:title;font-size:14px;line-height:1.1}
.cep-current-edition{grid-area:date;font-size:12px;font-weight:700;line-height:1.1;white-space:nowrap}
.cep-chevron{grid-area:chevron;font-size:18px;line-height:1}
.cep-edition-menu{
  position:absolute;right:0;top:calc(100% + 7px);width:250px;max-height:330px;overflow:auto;
  background:#fff;border:1px solid #bae6fd;border-radius:10px;padding:6px;
  box-shadow:0 14px 32px rgba(15,23,42,.18);z-index:100000;direction:rtl;
}
.cep-edition-option{
  display:flex;align-items:center;gap:9px;padding:10px 11px;border-radius:7px;
  color:#164e63 !important;text-decoration:none !important;font-weight:600;font-size:13px;
  transition:background .15s ease,transform .05s ease;
}
.cep-edition-option:hover{background:#ecfeff}
.cep-edition-option.is-current{background:#06b6d4;color:#fff !important}
.cep-edition-option-icon{font-size:14px}
.cep-toolbar-main{min-width:0}

@media (max-width:900px){
  .cep-archive-button{min-width:175px !important}
  .cep-edition-menu{width:230px}
}
@media (max-width:767px){
  .cep-toolbar{align-items:center}
  .cep-archive-picker{width:auto;max-width:55%}
  .cep-archive-button{min-width:165px !important;width:100%;font-size:13px !important}
  .cep-current-edition{font-size:11px}
  .cep-edition-menu{left:0;right:auto;width:min(250px,82vw);max-height:280px}
  .cep-toolbar-main{width:100%;flex:1 1 100%}
}

/* Fullscreen: archive/date picker remains at the left edge of the toolbar. */
.cep-viewer:fullscreen .cep-archive-picker,
.cep-viewer:-webkit-full-screen .cep-archive-picker{margin-right:auto}

/* v2.2.0 — selected edition date is shown on the RIGHT side of the header.
   "گزشتہ شمار" is only the archive trigger on the LEFT. */
.cep-toolbar{
  direction:ltr;
  justify-content:flex-start;
}
.cep-archive-picker{order:1;direction:rtl}
.cep-toolbar-main{order:2}
.cep-edition-date{
  order:3;
  margin:0 0 0 auto !important;
  min-height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 14px !important;
  background:#06b6d4;
  color:#fff !important;
  border:2px solid rgba(255,255,255,.95);
  border-radius:9px;
  font-family:Tahoma,Arial,sans-serif;
  font-size:15px !important;
  font-weight:800;
  white-space:nowrap;
  box-sizing:border-box;
  box-shadow:0 2px 8px rgba(0,0,0,.10);
}
.cep-archive-button .cep-current-edition{display:none !important}
@media (max-width:900px){
  .cep-edition-date{font-size:14px !important;padding:7px 11px !important}
}
@media (max-width:767px){
  .cep-toolbar{direction:ltr;flex-wrap:wrap}
  .cep-archive-picker{order:1;flex:0 0 auto}
  .cep-edition-date{
    order:2;
    margin-left:auto !important;
    min-height:36px;
    font-size:12px !important;
    padding:6px 9px !important;
  }
  .cep-toolbar-main{
    order:3;
    flex:1 1 100%;
    width:100%;
  }
}
/* Fullscreen keeps archive on the LEFT and selected date on the RIGHT. */
.cep-viewer:fullscreen .cep-archive-picker,
.cep-viewer:-webkit-full-screen .cep-archive-picker{margin-right:0 !important}
.cep-viewer:fullscreen .cep-edition-date,
.cep-viewer:-webkit-full-screen .cep-edition-date{margin-left:auto !important}


/* v2.2.1 — mobile-first reading/zoom improvements */
.cep-canvas-wrap{
  overflow:auto !important;
  overflow-x:auto !important;
  overflow-y:auto !important;
  scrollbar-gutter:stable both-edges;
  touch-action:pan-x pan-y pinch-zoom !important;
  overscroll-behavior:auto !important;
}
.cep-canvas-wrap canvas{
  max-width:none !important;
  touch-action:pan-x pan-y pinch-zoom !important;
}
.cep-pages{
  width:100%;
  box-sizing:border-box;
  overflow-x:auto !important;
  overflow-y:hidden;
  padding:12px 14px 16px !important;
  margin-top:12px !important;
  gap:8px !important;
  background:#fff;
  border:1px solid #dfe4e8;
  border-radius:10px;
  -webkit-overflow-scrolling:touch;
  touch-action:pan-x;
  scrollbar-width:auto;
}
.cep-pages button{
  min-width:42px !important;
  height:38px !important;
  flex:0 0 auto !important;
  font-weight:700;
}
.cep-pages::-webkit-scrollbar{height:8px}
.cep-pages::-webkit-scrollbar-thumb{background:#aeb8c2;border-radius:99px}
.cep-pages::-webkit-scrollbar-track{background:#eef1f3;border-radius:99px}

@media (max-width:767px){
  .cep-canvas-wrap{
    min-height:360px !important;
    padding:8px !important;
    text-align:left !important;
  }
  .cep-canvas-wrap canvas{margin:0 !important}
  .cep-pages{
    padding:11px 12px 15px !important;
    margin-left:0 !important;
    margin-right:0 !important;
  }
  .cep-pages button{min-width:44px !important;height:40px !important;font-size:14px}
}
