/* =============================================================================
   ePaper Display — Scoped Bootstrap 5 Responsive Grid + Plugin Styles
   All rules are nested under .epaper-display to prevent theme conflicts.
   ============================================================================= */

/* --------------------------------------------------------------------------
   Bootstrap 5 Grid (scoped)
   Extracted from Bootstrap 5.3 — container, row, col-* classes only.
   -------------------------------------------------------------------------- */

.epaper-display *,
.epaper-display *::before,
.epaper-display *::after {
  box-sizing: border-box;
}

/* --- Row --- */
.epaper-display .ep-row {
  --ep-gutter-x: 1.5rem;
  --ep-gutter-y: 0;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--ep-gutter-y));
  margin-right: calc(-0.5 * var(--ep-gutter-x));
  margin-left: calc(-0.5 * var(--ep-gutter-x));
}

.epaper-display .ep-row > * {
  flex-shrink: 0;
  width: 100%;       /* default: full width (mobile first) */
  max-width: 100%;
  padding-right: calc(var(--ep-gutter-x) * 0.5);
  padding-left: calc(var(--ep-gutter-x) * 0.5);
  margin-top: var(--ep-gutter-y);
}

/* Align helpers */
.epaper-display .ep-align-items-start  { align-items: flex-start !important; }
.epaper-display .ep-align-items-center { align-items: center !important; }
.epaper-display .ep-align-items-end    { align-items: flex-end !important; }

/* --- Columns: base (xs, always) ---
   !important ensures theme CSS cannot override column widths              */
.epaper-display .ep-col    { flex: 1 0 0% !important; }
.epaper-display .ep-col-1  { flex: 0 0 auto !important; width:  8.33333333% !important; }
.epaper-display .ep-col-2  { flex: 0 0 auto !important; width: 16.66666667% !important; }
.epaper-display .ep-col-3  { flex: 0 0 auto !important; width: 25% !important; }
.epaper-display .ep-col-4  { flex: 0 0 auto !important; width: 33.33333333% !important; }
.epaper-display .ep-col-5  { flex: 0 0 auto !important; width: 41.66666667% !important; }
.epaper-display .ep-col-6  { flex: 0 0 auto !important; width: 50% !important; }
.epaper-display .ep-col-7  { flex: 0 0 auto !important; width: 58.33333333% !important; }
.epaper-display .ep-col-8  { flex: 0 0 auto !important; width: 66.66666667% !important; }
.epaper-display .ep-col-9  { flex: 0 0 auto !important; width: 75% !important; }
.epaper-display .ep-col-10 { flex: 0 0 auto !important; width: 83.33333333% !important; }
.epaper-display .ep-col-11 { flex: 0 0 auto !important; width: 91.66666667% !important; }
.epaper-display .ep-col-12 { flex: 0 0 auto !important; width: 100% !important; }

/* --- sm breakpoint (≥576px) --- */
@media (min-width: 576px) {
  .epaper-display .ep-col-sm-1  { flex: 0 0 auto !important; width:  8.33333333% !important; }
  .epaper-display .ep-col-sm-2  { flex: 0 0 auto !important; width: 16.66666667% !important; }
  .epaper-display .ep-col-sm-3  { flex: 0 0 auto !important; width: 25% !important; }
  .epaper-display .ep-col-sm-4  { flex: 0 0 auto !important; width: 33.33333333% !important; }
  .epaper-display .ep-col-sm-5  { flex: 0 0 auto !important; width: 41.66666667% !important; }
  .epaper-display .ep-col-sm-6  { flex: 0 0 auto !important; width: 50% !important; }
  .epaper-display .ep-col-sm-7  { flex: 0 0 auto !important; width: 58.33333333% !important; }
  .epaper-display .ep-col-sm-8  { flex: 0 0 auto !important; width: 66.66666667% !important; }
  .epaper-display .ep-col-sm-9  { flex: 0 0 auto !important; width: 75% !important; }
  .epaper-display .ep-col-sm-10 { flex: 0 0 auto !important; width: 83.33333333% !important; }
  .epaper-display .ep-col-sm-11 { flex: 0 0 auto !important; width: 91.66666667% !important; }
  .epaper-display .ep-col-sm-12 { flex: 0 0 auto !important; width: 100% !important; }
}

/* --- md breakpoint (≥768px) --- */
@media (min-width: 768px) {
  .epaper-display .ep-col-md-1  { flex: 0 0 auto !important; width:  8.33333333% !important; }
  .epaper-display .ep-col-md-2  { flex: 0 0 auto !important; width: 16.66666667% !important; }
  .epaper-display .ep-col-md-3  { flex: 0 0 auto !important; width: 25% !important; }
  .epaper-display .ep-col-md-4  { flex: 0 0 auto !important; width: 33.33333333% !important; }
  .epaper-display .ep-col-md-5  { flex: 0 0 auto !important; width: 41.66666667% !important; }
  .epaper-display .ep-col-md-6  { flex: 0 0 auto !important; width: 50% !important; }
  .epaper-display .ep-col-md-7  { flex: 0 0 auto !important; width: 58.33333333% !important; }
  .epaper-display .ep-col-md-8  { flex: 0 0 auto !important; width: 66.66666667% !important; }
  .epaper-display .ep-col-md-9  { flex: 0 0 auto !important; width: 75% !important; }
  .epaper-display .ep-col-md-10 { flex: 0 0 auto !important; width: 83.33333333% !important; }
  .epaper-display .ep-col-md-11 { flex: 0 0 auto !important; width: 91.66666667% !important; }
  .epaper-display .ep-col-md-12 { flex: 0 0 auto !important; width: 100% !important; }
}

/* --- lg breakpoint (≥992px) --- */
@media (min-width: 992px) {
  .epaper-display .ep-col-lg-1  { flex: 0 0 auto !important; width:  8.33333333% !important; }
  .epaper-display .ep-col-lg-2  { flex: 0 0 auto !important; width: 16.66666667% !important; }
  .epaper-display .ep-col-lg-3  { flex: 0 0 auto !important; width: 25% !important; }
  .epaper-display .ep-col-lg-4  { flex: 0 0 auto !important; width: 33.33333333% !important; }
  .epaper-display .ep-col-lg-5  { flex: 0 0 auto !important; width: 41.66666667% !important; }
  .epaper-display .ep-col-lg-6  { flex: 0 0 auto !important; width: 50% !important; }
  .epaper-display .ep-col-lg-7  { flex: 0 0 auto !important; width: 58.33333333% !important; }
  .epaper-display .ep-col-lg-8  { flex: 0 0 auto !important; width: 66.66666667% !important; }
  .epaper-display .ep-col-lg-9  { flex: 0 0 auto !important; width: 75% !important; }
  .epaper-display .ep-col-lg-10 { flex: 0 0 auto !important; width: 83.33333333% !important; }
  .epaper-display .ep-col-lg-11 { flex: 0 0 auto !important; width: 91.66666667% !important; }
  .epaper-display .ep-col-lg-12 { flex: 0 0 auto !important; width: 100% !important; }
}

/* --- xl breakpoint (≥1200px) --- */
@media (min-width: 1200px) {
  .epaper-display .ep-col-xl-1  { flex: 0 0 auto !important; width:  8.33333333% !important; }
  .epaper-display .ep-col-xl-2  { flex: 0 0 auto !important; width: 16.66666667% !important; }
  .epaper-display .ep-col-xl-3  { flex: 0 0 auto !important; width: 25% !important; }
  .epaper-display .ep-col-xl-4  { flex: 0 0 auto !important; width: 33.33333333% !important; }
  .epaper-display .ep-col-xl-5  { flex: 0 0 auto !important; width: 41.66666667% !important; }
  .epaper-display .ep-col-xl-6  { flex: 0 0 auto !important; width: 50% !important; }
  .epaper-display .ep-col-xl-7  { flex: 0 0 auto !important; width: 58.33333333% !important; }
  .epaper-display .ep-col-xl-8  { flex: 0 0 auto !important; width: 66.66666667% !important; }
  .epaper-display .ep-col-xl-9  { flex: 0 0 auto !important; width: 75% !important; }
  .epaper-display .ep-col-xl-10 { flex: 0 0 auto !important; width: 83.33333333% !important; }
  .epaper-display .ep-col-xl-11 { flex: 0 0 auto !important; width: 91.66666667% !important; }
  .epaper-display .ep-col-xl-12 { flex: 0 0 auto !important; width: 100% !important; }
}

/* =============================================================================
   ePaper Display — Component Styles
   ============================================================================= */

.epaper-display {
  font-family: inherit;
  line-height: 1.5;
  color: inherit;
}

/* --- Grid Template --- */
.epaper-display .ep-card {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
  background: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.epaper-display .ep-card-img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  display: block;
}

.epaper-display .ep-card-img-link {
  display: block;
  overflow: hidden;
  background: #f0f0f0;
}

.epaper-display .ep-card-body {
  padding: 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.epaper-display .ep-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  background: #e9ecef;
  color: #495057;
  border-radius: 4px;
  padding: 2px 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.epaper-display .ep-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0.25rem 0;
  line-height: 1.3;
}

.epaper-display .ep-card-title a {
  color: inherit;
  text-decoration: none;
}

.epaper-display .ep-card-title a:hover {
  text-decoration: underline;
}

.epaper-display .ep-card-text {
  font-size: 0.82rem;
  color: #6c757d;
  margin: 0;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.epaper-display .ep-card-meta {
  font-size: 0.75rem;
  color: #adb5bd;
}

/* --- List Template --- */
.epaper-display .ep-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.epaper-display .ep-list-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.epaper-display .ep-list-item:last-child {
  border-bottom: none;
}

.epaper-display .ep-list-thumb {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.epaper-display .ep-list-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
  line-height: 1.3;
}

.epaper-display .ep-list-title a {
  color: inherit;
  text-decoration: none;
}

.epaper-display .ep-list-title a:hover {
  text-decoration: underline;
}

.epaper-display .ep-list-excerpt {
  font-size: 0.8rem;
  color: #6c757d;
  margin: 0 0 0.2rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.epaper-display .ep-list-meta {
  font-size: 0.73rem;
  color: #adb5bd;
}

/* --- Card (Article) Template --- */
.epaper-display .ep-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* When ep-cards-stack is combined with ep-row, ep-row wins */
.epaper-display .ep-cards-stack.ep-row {
  flex-direction: row;
}

.epaper-display .ep-article-card {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.epaper-display .ep-article-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.epaper-display .ep-article-content {
  padding: 0.75rem;
}

.epaper-display .ep-article-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.epaper-display .ep-category-tag {
  font-size: 0.68rem;
  font-weight: 700;
  background: #0d6efd;
  color: #fff;
  border-radius: 3px;
  padding: 1px 6px;
  text-transform: uppercase;
}

.epaper-display .ep-date {
  font-size: 0.73rem;
  color: #adb5bd;
}

.epaper-display .ep-article-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

.epaper-display .ep-article-title a {
  color: inherit;
  text-decoration: none;
}

.epaper-display .ep-article-title a:hover {
  text-decoration: underline;
}

.epaper-display .ep-article-desc {
  font-size: 0.82rem;
  color: #6c757d;
  margin: 0 0 0.35rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.epaper-display .ep-author {
  font-size: 0.73rem;
  color: #495057;
  font-style: italic;
}

/* --- Ticker Template --- */
.epaper-display .ep-ticker-wrap {
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #1a1a2e;
  color: #fff;
  border-radius: 4px;
  height: 40px;
}

.epaper-display .ep-ticker-label {
  flex-shrink: 0;
  background: #e63946;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 12px;
  height: 100%;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.epaper-display .ep-ticker-scroll {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.epaper-display .ep-ticker-inner {
  display: flex;
  white-space: nowrap;
  animation: epaper-ticker-scroll 30s linear infinite;
}

.epaper-display .ep-ticker-inner:hover {
  animation-play-state: paused;
}

@keyframes epaper-ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.epaper-display .ep-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  padding: 0 24px;
  white-space: nowrap;
}

.epaper-display .ep-ticker-item:hover {
  color: #ffd700;
}

.epaper-display .ep-ticker-num {
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* --- Error state --- */
.epaper-display .epaper-error {
  color: #dc3545;
  font-size: 0.85rem;
  padding: 0.5rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
}
