
/* ── Base for all library cards ── */
.lib-card { position: relative; overflow: hidden; border-radius: var(--nui-radius-lg,8px); background: var(--nui-surface,#fff); }
.lib-card .card-img { position: relative; overflow: hidden; background: #ddd; }
.lib-card .card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.lib-card:hover .card-img img { transform: scale(1.06); }
.lib-card .card-body { padding: 20px; }
.lib-card .card-cat {
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase; font-weight: 700;
  color: var(--nui-brand,#d6173a); margin-bottom: 10px; display: block;
}
.lib-card .card-title { font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--nui-text,#111); margin: 0 0 10px; }
.lib-card .card-meta { font-size: 12px; color: var(--nui-text-muted,#888); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── 1. Standard Vertical ── */
.lib-card--vertical .card-img { aspect-ratio: 16/9; }

/* ── 2. Horizontal Compact ── */
.lib-card--horizontal { display: flex; align-items: stretch; }
.lib-card--horizontal .card-img { width: 130px; flex-shrink: 0; aspect-ratio: auto; }
.lib-card--horizontal .card-img img { height: 100%; }
.lib-card--horizontal .card-body { flex: 1; padding: 16px; }
.lib-card--horizontal .card-title { font-size: 14px; -webkit-line-clamp: 3; }

/* ── 3. Overlay / Full-bleed ── */
.lib-card--overlay {
  aspect-ratio: 4/5; color: #fff;
}
.lib-card--overlay .card-img { position: absolute; inset: 0; aspect-ratio: auto; }
.lib-card--overlay::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(transparent 35%, rgba(0,0,0,.9) 100%);
  pointer-events: none;
}
.lib-card--overlay .card-body { position: absolute; bottom: 0; left: 0; right: 0; z-index: 2; }
.lib-card--overlay .card-cat { color: rgba(255,255,255,.7); }
.lib-card--overlay .card-title { color: #fff; font-size: 17px; }
.lib-card--overlay .card-meta { color: rgba(255,255,255,.55); }

/* ── 4. Breaking / Urgent ── */
.lib-card--breaking {
  border-left: 4px solid #d6173a; background: #fff8f8;
  animation: breaking-flash 3s ease-in-out infinite;
}
@keyframes breaking-flash {
  0%, 100% { border-color: #d6173a; }
  50% { border-color: #ff6b6b; }
}
.lib-card--breaking .card-img { aspect-ratio: 16/9; }
.lib-card--breaking .card-body { padding: 16px 20px; }
.lib-card--breaking .breaking-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #d6173a; color: #fff; font-size: 10px; font-weight: 800;
  letter-spacing: 2px; text-transform: uppercase; padding: 3px 10px; border-radius: 2px;
  margin-bottom: 10px;
}
.lib-card--breaking .breaking-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff;
  animation: break-dot 1s ease-in-out infinite;
}
@keyframes break-dot { 50% { opacity: 0; } }
.lib-card--breaking .card-title { color: #8b0000; }

/* ── 5. Video Card ── */
.lib-card--video .card-img { aspect-ratio: 16/9; cursor: pointer; }
.lib-card--video .play-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, background .2s; z-index: 2;
}
.lib-card--video .play-btn::after { content: '▶'; font-size: 18px; color: #fff; margin-left: 3px; }
.lib-card--video:hover .play-btn { background: #d6173a; transform: translate(-50%,-50%) scale(1.1); }
.lib-card--video .video-dur {
  position: absolute; bottom: 10px; right: 10px; z-index: 2;
  background: rgba(0,0,0,.75); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 3px; font-weight: 700;
}

/* ── 6. Opinion / Column ── */
.lib-card--opinion { border-top: 4px solid var(--nui-brand,#d6173a); padding: 24px; }
.lib-card--opinion .opinion-author {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.lib-card--opinion .opinion-author img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.lib-card--opinion .opinion-author-info .name { font-size: 15px; font-weight: 700; color: var(--nui-text,#111); }
.lib-card--opinion .opinion-author-info .role { font-size: 12px; color: var(--nui-text-muted,#888); }
.lib-card--opinion .opinion-quote {
  font-family: Tajawal, Georgia, serif;
  font-size: 17px; line-height: 1.7; color: var(--nui-text,#111);
  font-style: italic; margin-bottom: 16px;
  padding-left: 16px; border-left: 3px solid rgba(214,23,58,.3);
}
.lib-card--opinion .opinion-title { font-size: 16px; font-weight: 700; color: var(--nui-text,#111); }
[dir="rtl"] .lib-card--opinion .opinion-quote { padding-left: 0; padding-right: 16px; border-left: none; border-right: 3px solid rgba(214,23,58,.3); }

/* ── 7. Podcast / Audio ── */
.lib-card--podcast { background: linear-gradient(135deg, #1a1a2e, #16213e); color: #fff; }
.lib-card--podcast .card-body { padding: 24px; }
.lib-card--podcast .pod-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.lib-card--podcast .pod-art {
  width: 70px; height: 70px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
}
.lib-card--podcast .pod-art img { width: 100%; height: 100%; object-fit: cover; }
.lib-card--podcast .pod-ep { font-size: 10px; letter-spacing: 3px; text-transform: uppercase; color: rgba(255,255,255,.4); margin-bottom: 6px; }
.lib-card--podcast .pod-title { font-size: 15px; font-weight: 700; color: #fff; }
.lib-card--podcast .waveform {
  display: flex; align-items: center; gap: 3px; height: 36px; margin-bottom: 16px;
}
.lib-card--podcast .waveform span {
  flex: 1; border-radius: 2px; background: rgba(255,255,255,.3);
  animation: wave-bar 1.2s ease-in-out infinite;
}
.lib-card--podcast .waveform span:nth-child(odd) { animation-delay: .2s; }
.lib-card--podcast .waveform span:nth-child(3n) { animation-delay: .4s; }
.lib-card--podcast .waveform span:nth-child(4n) { animation-delay: .6s; }
@keyframes wave-bar {
  0%, 100% { height: 30%; }
  50% { height: 100%; }
}
.lib-card--podcast .pod-controls {
  display: flex; align-items: center; justify-content: space-between;
}
.lib-card--podcast .pod-play {
  width: 44px; height: 44px; border-radius: 50%; background: #d6173a;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; cursor: pointer; border: none; transition: transform .2s;
}
.lib-card--podcast .pod-play:hover { transform: scale(1.1); }
.lib-card--podcast .pod-dur { font-size: 12px; color: rgba(255,255,255,.4); }

/* ── 8. Infographic / Data ── */
.lib-card--data { border-top: 3px solid #1e6cf0; }
.lib-card--data .data-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lib-card--data .data-chart {
  display: flex; align-items: flex-end; gap: 4px; height: 60px;
}
.lib-card--data .data-chart .bar { width: 12px; background: #e8f0fe; border-radius: 3px 3px 0 0; transition: background .2s; }
.lib-card--data .data-chart .bar.accent { background: #1e6cf0; }
.lib-card--data .data-stats {
  display: flex; gap: 20px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--nui-border,#eee);
}
.lib-card--data .stat-item { text-align: center; }
.lib-card--data .stat-val { font-size: 22px; font-weight: 900; color: #1e6cf0; line-height: 1; display: block; }
.lib-card--data .stat-label { font-size: 10px; color: var(--nui-text-muted,#888); letter-spacing: 1px; text-transform: uppercase; }

/* ── 9. Live Event / Countdown ── */
.lib-card--event { background: linear-gradient(135deg, #0f2027, #203a43, #2c5364); color: #fff; }
.lib-card--event .event-badge {
  display: inline-flex; align-items: center; gap: 6px; background: #d6173a;
  color: #fff; font-size: 10px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
  padding: 4px 12px; border-radius: 2px; margin-bottom: 14px;
}
.lib-card--event .event-title { font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 16px; }
.lib-card--event .countdown {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px;
}
.lib-card--event .cd-unit { background: rgba(255,255,255,.08); border-radius: 6px; padding: 10px 6px; text-align: center; }
.lib-card--event .cd-num { font-size: 26px; font-weight: 900; color: #fff; line-height: 1; display: block; }
.lib-card--event .cd-label { font-size: 9px; color: rgba(255,255,255,.45); letter-spacing: 1px; text-transform: uppercase; }
.lib-card--event .event-date { font-size: 12px; color: rgba(255,255,255,.5); }

/* ── 10. Photo Gallery Card ── */
.lib-card--gallery .gallery-grid {
  display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px;
  aspect-ratio: 4/3;
}
.lib-card--gallery .gallery-cell { overflow: hidden; background: #ddd; }
.lib-card--gallery .gallery-cell:first-child { grid-row: 1 / 3; }
.lib-card--gallery .gallery-cell img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.lib-card--gallery:hover .gallery-cell img { transform: scale(1.05); }
.lib-card--gallery .gallery-count {
  position: absolute; right: 3px; bottom: 3px;
  background: rgba(0,0,0,.7); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 10px; display: flex; align-items: center; gap: 5px;
}
.lib-card--gallery .card-body { padding: 16px 20px; }
.lib-card--gallery .card-title { font-size: 15px; }

/* ── 11. Sponsored / Branded ── */
.lib-card--sponsored { border: 1px solid var(--nui-border,#eee); }
.lib-card--sponsored .sponsor-label {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  background: rgba(0,0,0,.5); color: rgba(255,255,255,.8); font-size: 10px;
  letter-spacing: 1px; text-transform: uppercase; padding: 3px 8px; border-radius: 3px;
}
.lib-card--sponsored .card-img { aspect-ratio: 16/9; }
.lib-card--sponsored .sponsor-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-top: 1px solid var(--nui-border,#eee);
  font-size: 11px; color: var(--nui-text-muted,#888);
}
.lib-card--sponsored .sponsor-logo { height: 20px; width: auto; opacity: .6; }

/* ── 12. Poll / Interactive ── */
.lib-card--poll { border-top: 3px solid #7b8cde; }
.lib-card--poll .poll-question { font-size: 17px; font-weight: 700; color: var(--nui-text,#111); margin-bottom: 20px; line-height: 1.4; }
.lib-card--poll .poll-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.lib-card--poll .poll-option { cursor: pointer; }
.lib-card--poll .poll-option label {
  display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--nui-text,#333);
}
.lib-card--poll .poll-bar-wrap { position: relative; background: var(--nui-surface-alt,#f5f5f5); border-radius: 6px; height: 36px; overflow: hidden; }
.lib-card--poll .poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(123,140,222,.2); border-radius: 6px; transition: width .8s ease; }
.lib-card--poll .poll-bar-wrap .poll-text { position: relative; z-index: 1; padding: 0 14px; line-height: 36px; font-size: 13px; display: flex; justify-content: space-between; }
.lib-card--poll .poll-footer { font-size: 12px; color: var(--nui-text-muted,#888); display: flex; justify-content: space-between; }

/* ── 13. Author Feature ── */
.lib-card--author-feature {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 32px 24px;
  background: linear-gradient(160deg, var(--nui-surface,#fff) 60%, #f8f0f0 100%);
  border-bottom: 3px solid var(--nui-brand,#d6173a);
}
.lib-card--author-feature .af-avatar {
  width: 88px; height: 88px; border-radius: 50%; overflow: hidden;
  border: 4px solid #fff; box-shadow: 0 4px 20px rgba(0,0,0,.1); margin-bottom: 16px;
}
.lib-card--author-feature .af-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lib-card--author-feature .af-name { font-size: 18px; font-weight: 800; color: var(--nui-text,#111); margin-bottom: 4px; }
.lib-card--author-feature .af-role { font-size: 12px; color: var(--nui-brand,#d6173a); font-weight: 600; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 12px; }
.lib-card--author-feature .af-bio { font-size: 13px; color: var(--nui-text-muted,#666); line-height: 1.7; margin-bottom: 20px; }
.lib-card--author-feature .af-stats { display: flex; gap: 24px; }
.lib-card--author-feature .af-stat { text-align: center; }
.lib-card--author-feature .af-stat-num { font-size: 20px; font-weight: 900; color: var(--nui-text,#111); line-height: 1; display: block; }
.lib-card--author-feature .af-stat-label { font-size: 10px; color: var(--nui-text-muted,#888); text-transform: uppercase; letter-spacing: 1px; }

/* ── Card row grid (used by PHP card templates) ── */
.nui-cards-row {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}
/* Desktop column counts (2–5) */
@media (min-width: 1024px) {
  .nui-cards-row.nui-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .nui-cards-row.nui-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .nui-cards-row.nui-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .nui-cards-row.nui-cols-5 { grid-template-columns: repeat(5, 1fr); }
}
/* Tablet: cap at 2 columns */
@media (min-width: 640px) and (max-width: 1023px) {
  .nui-cards-row.nui-cols-2,
  .nui-cards-row.nui-cols-3,
  .nui-cards-row.nui-cols-4,
  .nui-cards-row.nui-cols-5 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Dark mode overrides ── */
[data-theme="dark"] .lib-card { background: var(--nui-surface,#1e1e1e); }
[data-theme="dark"] .lib-card .card-title { color: var(--nui-text,#f0f0f0); }
[data-theme="dark"] .lib-card--breaking { background: rgba(214,23,58,.08); }
[data-theme="dark"] .lib-card--breaking .card-title { color: #ff8080; }
[data-theme="dark"] .lib-card--data .data-chart .bar { background: rgba(30,108,240,.2); }
[data-theme="dark"] .lib-card--poll .poll-bar-wrap { background: rgba(255,255,255,.08); }
[data-theme="dark"] .lib-card--poll .poll-bar { background: rgba(123,140,222,.25); }
[data-theme="dark"] .lib-card--author-feature { background: linear-gradient(160deg, var(--nui-surface,#1e1e1e) 60%, rgba(214,23,58,.05) 100%); }
[data-theme="dark"] .lib-card--sponsored { border-color: rgba(255,255,255,.1); }
