/* His perspective — zamonaviy, chiroyli dizayn */
/* Font: link tag orqali yuklanadi (templates) */

:root {
  --bg: #f8f9fc;
  --bg-card: #ffffff;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.08);
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --radius: 16px;
  --radius-sm: 12px;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Night mode (tun rejimi) */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.15);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .featured-image-wrap,
[data-theme="dark"] .post-card-image-wrap,
[data-theme="dark"] .related-card-image {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

[data-theme="dark"] .post-card-image-placeholder,
[data-theme="dark"] .featured-image-placeholder,
[data-theme="dark"] .related-card-placeholder {
  color: #475569;
}

[data-theme="dark"] .search-input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .search-input::placeholder {
  color: #64748b;
}

[data-theme="dark"] .empty {
  color: var(--text-muted);
}

* {
  box-sizing: border-box;
}

/* Widgets bar — yuqorida */
.widgets-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
  font-size: 0.8125rem;
}

.widgets-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.widget-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.widget-name {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
}

.widget-value {
  color: var(--text);
  font-weight: 600;
}

.widget-divider {
  width: 1px;
  height: 1rem;
  background: var(--border);
}

.widget-select {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}

.widget-select:focus {
  outline: none;
  border-color: var(--accent);
}

[data-theme="dark"] .widgets-bar {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .widget-select {
  background: #1e293b;
  border-color: #334155;
}

@media (max-width: 768px) {
  .widgets-bar {
    padding: 0.5rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .widgets-bar::-webkit-scrollbar {
    height: 4px;
  }
  .widgets-bar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
  }
  .widgets-inner {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem 1rem;
    padding: 0 1rem;
    justify-content: flex-start;
    min-width: min-content;
    max-width: none;
  }
  .widget-group {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .widget-name {
    font-size: 0.7rem;
  }
  .widget-value {
    font-size: 0.75rem;
  }
  .widget-weather .widget-select {
    max-width: 120px;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--bg-card);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s;
}

.logo:hover {
  color: var(--accent-hover);
}

.tagline {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-right: 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.theme-toggle:hover {
  background: var(--accent);
  color: white;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 0.5rem;
}

.channel-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  transition: background 0.2s, color 0.2s;
}

.channel-link:hover {
  background: var(--accent);
  color: white;
}

/* Main */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.post-main {
  max-width: 1180px;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 950px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  position: sticky;
  top: 5rem;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1rem;
}

.related-posts {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.related-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.related-card:hover {
  box-shadow: var(--shadow);
}

.related-card-image {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--border);
}

.related-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.related-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.related-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: block;
  word-wrap: break-word;
}

.related-card-meta {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Main header + search */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.02em;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.search-input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 0.9375rem;
  font-family: inherit;
  width: 220px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-btn {
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background 0.2s;
}

.search-btn:hover {
  background: var(--accent-hover);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem;
}

.pagination-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  color: var(--accent);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.pagination-btn:hover {
  background: var(--accent);
  color: white;
}

.pagination-info {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.all-link-wrap {
  margin-top: 1.5rem;
  text-align: center;
}

.all-link-wrap.hidden {
  display: none;
}

.all-link {
  display: inline-block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  transition: background 0.2s, color 0.2s;
}

.all-link:hover {
  background: var(--accent);
  color: white;
}

.back-link {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  transition: background 0.2s, color 0.2s;
}

.back-link:hover {
  background: var(--accent);
  color: white;
}

/* Muharrir tanlovi — uzunchoq banner tepada */
.featured-banner {
  margin-bottom: 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg-card);
}

.featured-banner.hidden {
  display: none;
}

.featured-link {
  display: grid;
  grid-template-columns: 42% 1fr;
  min-height: 220px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.25s ease;
}

.featured-link:hover {
  box-shadow: var(--shadow-hover);
}

.featured-image-wrap {
  width: 100%;
  min-height: 220px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  overflow: hidden;
}

.featured-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.featured-link:hover .featured-image {
  transform: scale(1.03);
}

.featured-image-placeholder {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--text-light);
}

.featured-body {
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.featured-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  line-height: 1.3;
  color: var(--text);
}

.featured-excerpt {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.featured-time {
  font-size: 0.875rem;
  color: var(--text-light);
}

.featured-read-more {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.featured-link:hover .featured-read-more {
  color: var(--accent-hover);
}

@media (max-width: 768px) {
  .featured-link {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .featured-image-wrap,
  .featured-image-placeholder {
    min-height: 180px;
  }
  .featured-body {
    padding: 1.25rem 1.5rem;
  }
  .featured-title {
    font-size: 1.25rem;
  }
}

/* News grid — zamonaviy kartochkalar, bir xil balandlik */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.post-card-image-wrap {
  width: 100%;
  flex-shrink: 0;
  aspect-ratio: 16 / 10;
  min-height: 0;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  overflow: hidden;
}

.post-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card-image {
  transform: scale(1.03);
}

.post-card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 2.5rem;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.post-card-body {
  padding: 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.post-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.01em;
}

.post-card-excerpt {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  line-height: 1.5;
  flex: 1;
  min-height: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-light);
}

.post-card-time {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.post-card-time::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

.post-card-views-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  font-weight: 500;
}

.post-card-views-badge .views-icon-sm {
  opacity: 0.85;
}

.read-more {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: auto;
  padding-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: gap 0.2s;
}

.post-card:hover .read-more {
  gap: 0.5rem;
}

/* Loading, empty, error */
.loading, .empty, .error {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.error {
  color: #dc2626;
  background: #fef2f2;
  border-radius: var(--radius);
}

.hidden {
  display: none !important;
}

/* Maqola sahifasi */
.article {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.article-header {
  padding: 2rem 2rem 1.5rem;
}

.article-title {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.02em;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.article-date {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.article-date::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.article-views-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}

.article-views-badge .views-icon {
  opacity: 0.85;
}

.article-image-wrap {
  margin: 0;
  line-height: 0;
}

.article-image-wrap img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

.article-video-wrap {
  margin: 0;
  line-height: 0;
}

.article-video {
  width: 100%;
  max-height: 480px;
  display: block;
  background: #000;
}

.article-image-wrap .image-credit {
  margin: 0;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

.article-body-wrap {
  padding: 2rem;
}

.article-body {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
}

.article-body p {
  margin: 0 0 1.25rem;
}

.article-body p:last-child {
  margin-bottom: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 0.75rem 1.25rem;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}

.back-link:hover {
  background: var(--accent);
  color: white;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer p {
  margin: 0;
}

.footer-telegram {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0 !important;
}

.footer-telegram .telegram-icon {
  flex-shrink: 0;
  color: #0088cc;
}

.footer-telegram a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-telegram a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }
  .header-inner {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }
  .header-brand {
    flex: 1;
    min-width: 0;
  }
  .header-actions {
    margin-left: 0;
    flex-shrink: 0;
  }
  .logo {
    font-size: 1.25rem;
  }
  .tagline {
    font-size: 0.8rem;
  }
  .theme-toggle {
    width: 36px;
    height: 36px;
  }
  .theme-toggle svg {
    width: 18px;
    height: 18px;
  }
  .channel-link {
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
  }

  .main {
    padding: 1.5rem 1rem;
  }

  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .article-header,
  .article-body-wrap {
    padding: 1.5rem 1.25rem;
  }

  .article-title {
    font-size: 1.5rem;
  }

  .article-body {
    font-size: 1rem;
  }
}
