/*
 * Qudra Knowledge Hub – Front-end Styles (LTR base)
 * Font: Cairo (Google Fonts)
 * RTL overrides live in frontend-rtl.css (auto-loaded by WordPress in RTL mode).
 */

/* ── Cairo font ────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&display=swap');

/* ── Reset theme link decoration inside widget ─────────────────────────────── */
.qkh-wrapper a { text-decoration: none !important; }

/* ── CSS Custom Properties ─────────────────────────────────────────────────── */
.qkh-wrapper {
  --qkh-teal:        #166164;
  --qkh-teal-dark:   #0f4749;
  --qkh-teal-mid:    #1d7a7e;
  --qkh-teal-light:  rgba(22, 97, 100, .08);
  --qkh-gold:        #85724d;
  --qkh-gold-hover:  #70603f;
  --qkh-cream:       #f3efe6;
  --qkh-white:       #ffffff;
  --qkh-text:        #4a4a4a;
  --qkh-muted:       #888888;
  --qkh-border:      #e0e0e0;

  box-sizing: border-box;
  font-family: 'Cairo', sans-serif;
  color: var(--qkh-text);
  unicode-bidi: embed;
}

.qkh-wrapper *,
.qkh-wrapper *::before,
.qkh-wrapper *::after {
  box-sizing: inherit;
  font-family: 'Cairo', sans-serif;
}

/* ── Featured Paper ─────────────────────────────────────────────────────────── */
.qkh-featured-paper {
  display: grid;
  grid-template-columns: 420px 1fr;
  background: var(--qkh-cream);
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 64px;
  box-shadow: 0 8px 40px rgba(22, 97, 100, .10);
  transition: transform .3s, box-shadow .3s;
}
.qkh-featured-paper:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 56px rgba(22, 97, 100, .15);
}

/* Thumbnail column */
.qkh-fp-thumb {
  position: relative;
  background: linear-gradient(145deg, var(--qkh-teal) 0%, var(--qkh-teal-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  overflow: hidden;
}
.qkh-fp-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Featured badge */
.qkh-fp-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  right: auto;
  z-index: 2;
  background: var(--qkh-gold);
  color: #fff;
  border-radius: 100px;
  padding: 5px 16px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: 'Cairo', sans-serif;
}

/* Body column */
.qkh-fp-body {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.qkh-fp-category {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--qkh-gold);
  margin-bottom: 12px;
}

.qkh-fp-title {
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 900;
  color: var(--qkh-teal);
  line-height: 1.35;
  margin: 0 0 16px;
}

.qkh-fp-desc {
  font-size: 14px;
  color: var(--qkh-text);
  line-height: 1.85;
  margin: 0 0 24px;
}

.qkh-fp-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.qkh-fp-meta-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--qkh-muted);
}
.qkh-fp-meta-item svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.qkh-btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--qkh-teal);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 28px;
  height: 48px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  text-decoration: none;
  align-self: flex-start;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.qkh-btn-pdf:hover,
.qkh-btn-pdf:focus-visible {
  background: var(--qkh-teal-dark);
  transform: translateY(-1px);
  color: #fff;
  outline: none;
}
.qkh-btn-pdf svg {
  width: 17px;
  height: 17px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Featured doc-mock placeholder ────────────────────────────────────────── */
.qkh-fp-doc-mock {
  width: 160px;
  background: #fff;
  border-radius: 8px;
  padding: 20px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .20);
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Category Tabs ──────────────────────────────────────────────────────────── */
.qkh-cat-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.qkh-cat-tab {
  padding: 7px 18px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  border: 1.5px solid var(--qkh-border);
  color: var(--qkh-muted);
  background: var(--qkh-white);
  cursor: pointer;
  min-height: 36px;
  line-height: 1.4;
  transition: color .2s, background .2s, border-color .2s;
}
.qkh-cat-tab:hover,
.qkh-cat-tab.active,
.qkh-cat-tab:focus-visible {
  color: var(--qkh-teal);
  border-color: var(--qkh-teal);
  background: var(--qkh-teal-light);
  outline: none;
}

/* ── Papers Grid ────────────────────────────────────────────────────────────── */
.qkh-papers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

/* ── Paper Card ─────────────────────────────────────────────────────────────── */
.qkh-paper-card {
  background: var(--qkh-white);
  border: 1.5px solid var(--qkh-border);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-decoration: none !important;
  color: inherit;
  transition: transform .28s, box-shadow .28s, border-color .28s;
}
.qkh-paper-card:hover,
.qkh-paper-card:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(22, 97, 100, .12);
  border-color: rgba(22, 97, 100, .3);
  outline: none;
}

/* Thumbnail */
.qkh-paper-thumb {
  position: relative;
  height: 210px;
  background: linear-gradient(145deg, var(--qkh-teal) 0%, var(--qkh-teal-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.qkh-paper-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Per-card colour variations */
.qkh-paper-card:nth-child(2)  .qkh-paper-thumb { background: linear-gradient(145deg, #0f4749 0%, #166164 100%); }
.qkh-paper-card:nth-child(3)  .qkh-paper-thumb { background: linear-gradient(145deg, #2c1f0e 0%, #85724d 100%); }
.qkh-paper-card:nth-child(4)  .qkh-paper-thumb { background: linear-gradient(145deg, #1d7a7e 0%, #166164 100%); }
.qkh-paper-card:nth-child(5)  .qkh-paper-thumb { background: linear-gradient(145deg, #4a3820 0%, #85724d 100%); }
.qkh-paper-card:nth-child(6)  .qkh-paper-thumb { background: linear-gradient(145deg, #0a3739 0%, #1d7a7e 100%); }
.qkh-paper-card:nth-child(7)  .qkh-paper-thumb { background: linear-gradient(145deg, #166164 0%, #0f4749 100%); }
.qkh-paper-card:nth-child(8)  .qkh-paper-thumb { background: linear-gradient(145deg, #85724d 0%, #4a3820 100%); }
.qkh-paper-card:nth-child(9)  .qkh-paper-thumb { background: linear-gradient(145deg, #0a3739 0%, #1d7a7e 100%); }
.qkh-paper-card:nth-child(10) .qkh-paper-thumb { background: linear-gradient(145deg, var(--qkh-teal) 0%, var(--qkh-teal-mid) 100%); }
.qkh-paper-card:nth-child(11) .qkh-paper-thumb { background: linear-gradient(145deg, #0f4749 0%, #166164 100%); }
.qkh-paper-card:nth-child(12) .qkh-paper-thumb { background: linear-gradient(145deg, #2c1f0e 0%, #85724d 100%); }

/* Hover overlay */
.qkh-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(22, 97, 100, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .25s;
  z-index: 2;
}
.qkh-paper-card:hover .qkh-thumb-overlay,
.qkh-paper-card:focus-visible .qkh-thumb-overlay { opacity: 1; }
.qkh-thumb-overlay svg {
  width: 44px;
  height: 44px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Category chip – LTR: top-left */
.qkh-cat-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  right: auto;
  z-index: 3;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 100px;
  padding: 3px 12px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Card body */
.qkh-paper-body {
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.qkh-paper-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--qkh-teal);
  line-height: 1.45;
  margin-bottom: auto;
  padding-bottom: 16px;
}

.qkh-paper-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--qkh-border);
  padding-top: 14px;
  margin-top: auto;
  gap: 10px;
}

.qkh-paper-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--qkh-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.qkh-paper-date svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qkh-btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--qkh-teal-light);
  color: var(--qkh-teal);
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  height: 32px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none !important;
  transition: background .2s, color .2s;
}
.qkh-paper-card:hover .qkh-btn-dl {
  background: var(--qkh-teal);
  color: #fff;
}
.qkh-btn-dl svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Shared doc-mock (card size) ───────────────────────────────────────────── */
.qkh-card-doc-mock {
  width: 90px;
  background: #fff;
  border-radius: 6px;
  padding: 12px 10px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ── Doc-mock inner elements ───────────────────────────────────────────────── */
.qkh-dm-top {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}
.qkh-dm-logo {
  width: 18px;
  height: 18px;
  background: var(--qkh-teal);
  border-radius: 4px;
  flex-shrink: 0;
}
.qkh-fp-doc-mock .qkh-dm-logo { width: 28px; height: 28px; border-radius: 6px; }

.qkh-dm-t {
  height: 5px;
  background: var(--qkh-teal);
  border-radius: 3px;
  flex: 1;
}
.qkh-fp-doc-mock .qkh-dm-t { height: 8px; }

.qkh-dm-line {
  height: 4px;
  background: #e8e8e8;
  border-radius: 3px;
}
.qkh-fp-doc-mock .qkh-dm-line { height: 5px; }
.qkh-dm-line.qkh-s { width: 55%; }
.qkh-dm-line.qkh-m { width: 80%; }
.qkh-dm-line.qkh-f { width: 100%; }

.qkh-dm-img {
  height: 34px;
  background: var(--qkh-teal-light);
  border-radius: 3px;
  margin: 4px 0;
}
.qkh-fp-doc-mock .qkh-dm-img { height: 52px; }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.qkh-no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--qkh-muted);
  padding: 48px 0;
  font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  .qkh-featured-paper { grid-template-columns: 360px 1fr; }
}

@media (max-width: 1024px) {
  .qkh-featured-paper { grid-template-columns: 300px 1fr; }
  .qkh-fp-body        { padding: 36px 32px; }
  .qkh-papers-grid    { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

@media (max-width: 860px) {
  .qkh-featured-paper { grid-template-columns: 1fr; }
  .qkh-fp-thumb       { min-height: 260px; max-height: 300px; }
  .qkh-fp-body        { padding: 32px 28px; }
  .qkh-fp-doc-mock    { width: 120px; }
}

@media (max-width: 768px) {
  .qkh-papers-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .qkh-paper-thumb { height: 180px; }
  .qkh-cat-tabs    { gap: 6px; margin-bottom: 28px; }
  .qkh-cat-tab     { font-size: 12px; padding: 6px 14px; }
}

@media (max-width: 600px) {
  .qkh-papers-grid    { grid-template-columns: 1fr; gap: 16px; }
  .qkh-paper-thumb    { height: 200px; }
  .qkh-featured-paper { border-radius: 16px; margin-bottom: 40px; }
  .qkh-fp-thumb       { min-height: 220px; max-height: 240px; }
  .qkh-fp-body        { padding: 24px 20px; }
  .qkh-fp-title       { font-size: 20px; }
  .qkh-fp-desc        { font-size: 13px; }
  .qkh-btn-pdf        { width: 100%; justify-content: center; height: 50px; }
  .qkh-paper-card     { border-radius: 16px; }
}

@media (max-width: 400px) {
  .qkh-fp-thumb    { min-height: 180px; }
  .qkh-fp-meta     { gap: 12px; }
  .qkh-fp-meta-item { font-size: 12px; }
  .qkh-cat-tab     { font-size: 11px; padding: 5px 10px; }
}
