/* =============================================
   Nokko RSS Aggregator v2.0 – Frontend Styles
   Uses CSS variables set by PHP from settings
   ============================================= */

:root {
  --nokko-accent: #1D9E75;
  --nokko-accent-rgb: 29,158,117;
  --nokko-bg: #f9fafb;
  --nokko-card-bg: #ffffff;
  --nokko-text: #111827;
  --nokko-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --nokko-muted: #6b7280;
  --nokko-border: #e5e7eb;
  --nokko-radius: 12px;
  --nokko-shadow: 0 1px 8px rgba(0,0,0,.07);
  --nokko-shadow-hover: 0 6px 24px rgba(0,0,0,.12);
}

.nokko-wrap * { box-sizing: border-box; }
.nokko-wrap { font-family: var(--nokko-font); background: var(--nokko-bg); padding: 20px 0; }

/* ── Toolbar ── */
.nokko-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px;
}
.nokko-search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.nokko-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--nokko-muted); pointer-events: none; width: 16px; height: 16px;
}
.nokko-search {
  width: 100%; padding: 8px 10px 8px 34px;
  border: 1px solid var(--nokko-border); border-radius: 99px;
  font-size: 14px; font-family: var(--nokko-font);
  background: var(--nokko-card-bg); color: var(--nokko-text);
  outline: none; transition: border-color .15s;
}
.nokko-search:focus { border-color: var(--nokko-accent); }

.nokko-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.nokko-filter-btn {
  padding: 6px 14px; border-radius: 99px;
  border: 1px solid var(--nokko-border);
  background: var(--nokko-card-bg); font-size: 13px;
  font-family: var(--nokko-font); color: var(--nokko-muted);
  cursor: pointer; transition: all .15s;
}
.nokko-filter-btn.active,
.nokko-filter-btn:hover { background: var(--nokko-accent); color: #fff; border-color: var(--nokko-accent); }

.nokko-layout-switcher { display: flex; gap: 4px; margin-left: auto; }
.nokko-layout-btn {
  width: 32px; height: 32px; border: 1px solid var(--nokko-border);
  background: var(--nokko-card-bg); border-radius: 6px;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: all .15s; color: var(--nokko-muted);
}
.nokko-layout-btn.active, .nokko-layout-btn:hover {
  background: var(--nokko-accent); border-color: var(--nokko-accent); color: #fff;
}

/* ── Shared card elements ── */
.nokko-item { position: relative; }
.nokko-item a.nokko-item-link {
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; height: 100%;
  background: var(--nokko-card-bg);
  border: 1px solid var(--nokko-border);
  border-radius: var(--nokko-radius);
  overflow: hidden;
  box-shadow: var(--nokko-shadow);
  transition: box-shadow .2s, transform .2s;
}
.nokko-item:hover a.nokko-item-link {
  box-shadow: var(--nokko-shadow-hover); transform: translateY(-2px);
}
.nokko-item-thumb {
  position: relative; overflow: hidden;
  background: rgba(var(--nokko-accent-rgb),.1);
}
.nokko-item-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s;
}
.nokko-item:hover .nokko-item-thumb img { transform: scale(1.04); }
.nokko-item-thumb.nokko-no-img { background: rgba(var(--nokko-accent-rgb),.08); }
.nokko-img-placeholder {
  width: 100%; height: 100%; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; color: var(--nokko-accent); opacity: .5;
}
.nokko-cat-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--nokko-accent); color: #fff;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 99px;
  letter-spacing: .3px; font-family: var(--nokko-font);
}
.nokko-item-body { padding: 14px 14px 6px; flex: 1; }
.nokko-item-source {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--nokko-accent); margin-bottom: 6px;
}
.nokko-item-title {
  font-size: 15px; font-weight: 600; line-height: 1.35;
  color: var(--nokko-text); margin: 0 0 6px;
  font-family: var(--nokko-font);
}
.nokko-item-desc {
  font-size: 13px; color: var(--nokko-muted);
  line-height: 1.5; margin: 0;
}
.nokko-item-foot {
  padding: 10px 14px; display: flex; align-items: center;
  justify-content: space-between; border-top: 1px solid var(--nokko-border); margin-top: 8px;
}
.nokko-item-date { font-size: 12px; color: var(--nokko-muted); }
.nokko-item-read { font-size: 12px; color: var(--nokko-accent); font-weight: 500; }

/* Block button (admin only) */
.nokko-block-btn {
  position: absolute; top: 8px; right: 8px; z-index: 10;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none;
  font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.nokko-item:hover .nokko-block-btn { opacity: 1; }
.nokko-block-btn:hover { background: #dc2626; }

/* ── FEATURED layout ── */
.nokko-featured-wrap {}
.nokko-hero { margin-bottom: 18px; }
.nokko-item-hero a.nokko-item-link { flex-direction: row; }
.nokko-item-hero .nokko-item-thumb { width: 55%; flex-shrink: 0; height: auto; }
.nokko-item-hero .nokko-item-thumb img { height: 100%; min-height: 260px; }
.nokko-item-hero .nokko-img-placeholder { min-height: 260px; }
.nokko-item-hero .nokko-item-title { font-size: 22px; }
.nokko-item-hero .nokko-item-desc { display: block; -webkit-line-clamp: unset; }
.nokko-item-hero .nokko-item-body { padding: 20px; justify-content: center; display: flex; flex-direction: column; }

.nokko-subfeatured {
  display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; margin-bottom: 18px;
}
.nokko-item-sub .nokko-item-thumb { height: 130px; }
.nokko-item-sub .nokko-item-title { font-size: 14px; }
.nokko-item-sub .nokko-item-desc { display: none; }

.nokko-rest { margin-top: 0 !important; }

@media (max-width: 680px) {
  .nokko-item-hero a.nokko-item-link { flex-direction: column; }
  .nokko-item-hero .nokko-item-thumb { width: 100%; height: 200px; }
  .nokko-subfeatured { grid-template-columns: 1fr; }
}

/* ── GRID layout ── */
.nokko-layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; }
.nokko-item-grid .nokko-item-thumb { height: 160px; }
.nokko-item-grid .nokko-item-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── LIST layout ── */
.nokko-layout-list { display: flex; flex-direction: column; gap: 12px; }
.nokko-item-list a.nokko-item-link { flex-direction: row; }
.nokko-item-list .nokko-item-thumb { width: 160px; min-width: 160px; height: auto; flex-shrink: 0; }
.nokko-item-list .nokko-item-thumb img { height: 100%; }
.nokko-item-list .nokko-img-placeholder { min-height: 100px; }
.nokko-item-list .nokko-item-body { padding: 16px; display: flex; flex-direction: column; justify-content: center; }
.nokko-item-list .nokko-item-title { font-size: 16px; }
.nokko-item-list .nokko-item-foot { border-top: none; padding: 0 16px 14px; margin-top: 0; }
@media (max-width: 520px) {
  .nokko-item-list a.nokko-item-link { flex-direction: column; }
  .nokko-item-list .nokko-item-thumb { width: 100%; height: 140px; }
}

/* ── NEWSPAPER layout ── */
.nokko-layout-newspaper { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.nokko-item-newspaper .nokko-item-thumb { height: 150px; }
.nokko-layout-newspaper .nokko-item-newspaper:first-child { grid-column: 1 / -1; }
.nokko-layout-newspaper .nokko-item-newspaper:first-child a.nokko-item-link { flex-direction: row; }
.nokko-layout-newspaper .nokko-item-newspaper:first-child .nokko-item-thumb { width: 50%; flex-shrink: 0; height: auto; }
.nokko-layout-newspaper .nokko-item-newspaper:first-child .nokko-item-thumb img { height: 100%; min-height: 220px; }
.nokko-layout-newspaper .nokko-item-newspaper:first-child .nokko-item-title { font-size: 20px; }
@media (max-width: 600px) {
  .nokko-layout-newspaper { grid-template-columns: 1fr; }
  .nokko-layout-newspaper .nokko-item-newspaper:first-child a.nokko-item-link { flex-direction: column; }
  .nokko-layout-newspaper .nokko-item-newspaper:first-child .nokko-item-thumb { width: 100%; height: 180px; }
}

/* ── MASONRY layout ── */
.nokko-layout-masonry { columns: 3; column-gap: 16px; }
.nokko-item-masonry { break-inside: avoid; margin-bottom: 16px; }
.nokko-item-masonry a.nokko-item-link { display: block; height: auto; }
.nokko-item-masonry:nth-child(3n+1) .nokko-item-thumb { height: 140px; }
.nokko-item-masonry:nth-child(3n+2) .nokko-item-thumb { height: 190px; }
.nokko-item-masonry:nth-child(3n)   .nokko-item-thumb { height: 160px; }
@media (max-width: 780px) { .nokko-layout-masonry { columns: 2; } }
@media (max-width: 480px) { .nokko-layout-masonry { columns: 1; } }

/* ── Footer ── */
.nokko-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--nokko-border);
  font-size: 12px; color: var(--nokko-muted); font-family: var(--nokko-font);
}
.nokko-update { display: flex; align-items: center; gap: 5px; }

/* ── States ── */
.nokko-empty {
  padding: 40px 20px; text-align: center; color: var(--nokko-muted);
  font-size: 15px; background: var(--nokko-card-bg);
  border-radius: var(--nokko-radius); border: 1px dashed var(--nokko-border);
  font-family: var(--nokko-font);
}
.nokko-loading { text-align: center; padding: 40px; color: var(--nokko-muted); font-family: var(--nokko-font); }
.nokko-spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 3px solid rgba(var(--nokko-accent-rgb),.2);
  border-top-color: var(--nokko-accent);
  border-radius: 50%; animation: nokko-spin .65s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes nokko-spin { to { transform: rotate(360deg); } }
