/* ============================================================
   style.css — Global Styles
   Tailwind is loaded via CDN in header.php.
   This file handles: CSS custom properties (theme), dark mode,
   Urdu RTL typography, and utility overrides.
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700&family=Noto+Nastaliq+Urdu:wght@400;700&display=swap');

/* ── CSS Custom Properties (Theme) ─────────────────────────── */
:root {
  --color-primary:      #2563EB;
  --color-primary-dark: #3B82F6;
  --color-accent:       #F59E0B;
  --color-bg:           #FFFFFF;
  --color-surface:      #F8FAFC;
  --color-border:       #E2E8F0;
  --color-text:         #0F172A;
  --color-text-muted:   #64748B;
  --color-shadow:       0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --color-shadow-md:    0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);

  --font-heading: 'Poppins', 'Inter', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-urdu:    'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;

  --radius:    0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --header-h: 64px;
}

/* Dark Mode Variables */
.dark {
  --color-primary:    #3B82F6;
  --color-accent:     #FBBF24;
  --color-bg:         #0F172A;
  --color-surface:    #1E293B;
  --color-border:     #334155;
  --color-text:       #F1F5F9;
  --color-text-muted: #94A3B8;
  --color-shadow:     0 1px 3px rgba(0,0,0,0.4);
  --color-shadow-md:  0 4px 6px -1px rgba(0,0,0,0.4);
}

/* ── Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ── Urdu / RTL ──────────────────────────────────────────────── */
.lang-ur,
[dir="rtl"],
.rtl {
  font-family: var(--font-urdu);
  direction: rtl;
  text-align: right;
  line-height: 2.2;
  letter-spacing: 0;
}

/* ── Header ─────────────────────────────────────────────────── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--color-shadow);
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* ── Cards ───────────────────────────────────────────────────── */
.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--color-shadow);
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease;
}

.post-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.4);
}

.dark .post-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  border-color: rgba(96, 165, 250, 0.4);
}

.post-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-card:hover img {
  transform: scale(1.05);
}

/* ── Category Badge ──────────────────────────────────────────── */
.cat-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--color-primary);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s ease, transform 0.15s ease;
}
.btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-accent  { background: var(--color-accent);  color: #fff; }
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text);
}

/* ── Search Input ────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}
.search-input:focus { border-color: var(--color-primary); }
.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--color-shadow-md);
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar-widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.sidebar-widget h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-text);
}

/* ── Toast Notifications ─────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--color-shadow-md);
  animation: slideInRight 0.3s ease, fadeOut 0.4s ease 2.6s forwards;
  max-width: 320px;
}
.toast-success { background: #10B981; }
.toast-error   { background: #EF4444; }
.toast-info    { background: var(--color-primary); }
.toast-warning { background: var(--color-accent); }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(120%); }
}

/* ── Skeleton Loader ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-border) 25%,
    var(--color-surface) 50%,
    var(--color-border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--color-surface);
  color: var(--color-text);
  transition: background 0.2s ease;
}
.pagination a:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); text-decoration: none; }
.pagination .active  { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ── Article Content ─────────────────────────────────────────── */
.article-body { max-width: 72ch; }
.article-body h1,
.article-body h2,
.article-body h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
  line-height: 1.3;
  color: var(--color-text);
}
.article-body h1 { font-size: 2rem; }
.article-body h2 { font-size: 1.5rem; }
.article-body h3 { font-size: 1.25rem; }
.article-body p  { margin-bottom: 1.25rem; }
.article-body ul,
.article-body ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.article-body li { margin-bottom: 0.4rem; }
.article-body blockquote {
  border-left: 4px solid var(--color-primary);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: var(--color-surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--color-text-muted);
}
.article-body pre {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}
.article-body img {
  border-radius: var(--radius-lg);
  margin: 1.5rem auto;
}
.article-body a { color: var(--color-primary); }
.article-body a:hover { text-decoration: underline; }

/* ── Dark Mode Toggle ─────────────────────────────────────────── */
#dark-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  font-size: 1.25rem;
  padding: 0.35rem;
  border-radius: var(--radius);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-primary); text-decoration: none; }
.breadcrumb .sep { color: var(--color-border); }

/* ── Social Share Buttons ────────────────────────────────────── */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}
.share-btn:hover { opacity: 0.85; }
.share-fb  { background: #1877F2; }
.share-tw  { background: #1DA1F2; }
.share-wa  { background: #25D366; }
.share-tg  { background: #0088CC; }
.share-li  { background: #0A66C2; }
.share-cp  { background: var(--color-text-muted); }

/* ── Comment Box ─────────────────────────────────────────────── */
.comment-item {
  border-left: 3px solid var(--color-border);
  padding-left: 1rem;
  margin-bottom: 1.25rem;
}
.comment-item.reply {
  margin-left: 2rem;
  border-left-color: var(--color-primary);
}

/* ── Ad Slot ─────────────────────────────────────────────────── */
.ad-slot {
  text-align: center;
  overflow: hidden;
}

/* ── Mobile Nav Overlay ──────────────────────────────────────── */
#mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
#mobile-menu.open { display: flex; }
#mobile-nav-panel {
  width: 280px;
  background: var(--color-bg);
  height: 100%;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

/* ── Utilities ───────────────────────────────────────────────── */
.text-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.text-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Focus Visible ───────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --header-h: 56px; }
  .post-card img { height: 180px; }
}
