/* ============================================================
   DohoaVIP Demo v3 - CSS Design System
   Sidebar Collapse + Floating Buttons + No Header
   ============================================================ */

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

/* ======================== CSS VARIABLES ======================== */
:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;
  --transition-fast: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.15);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --vip-gradient: linear-gradient(135deg, #f59e0b, #ea580c);
  --free-gradient: linear-gradient(135deg, #10b981, #0d9488);
  --download-vip: linear-gradient(135deg, #ec4899, #8b5cf6);
  --download-free: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* ======================== DARK THEME ======================== */
[data-theme="dark"] {
  --bg-body: #0d1117;
  --bg-sidebar: #161b22;
  --bg-card: #1a1f2e;
  --bg-card-hover: #222838;
  --bg-surface: #21262d;
  --bg-surface-2: #2d333b;
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --border-color: #30363d;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 8px 30px rgba(124, 58, 237, 0.2);
  --search-bg: #21262d;
  --search-border: #30363d;
  --badge-bg: rgba(255, 255, 255, 0.08);
  --scrollbar-track: #161b22;
  --scrollbar-thumb: #30363d;
}

/* ======================== LIGHT THEME ======================== */
[data-theme="light"] {
  --bg-body: #f0f2f5;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fa;
  --bg-surface: #f3f4f6;
  --bg-surface-2: #e5e7eb;
  --bg-overlay: rgba(0, 0, 0, 0.3);
  --border-color: #e5e7eb;
  --border-subtle: rgba(0, 0, 0, 0.06);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 8px 30px rgba(99, 102, 241, 0.15);
  --search-bg: #f3f4f6;
  --search-border: #e5e7eb;
  --badge-bg: rgba(0, 0, 0, 0.05);
  --scrollbar-track: #f3f4f6;
  --scrollbar-thumb: #d1d5db;
}

/* ======================== RESET ======================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-family);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: color var(--transition-fast); }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ======================== LAYOUT ======================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  transition: margin-left var(--transition-smooth);
}

/* Sidebar collapsed state */
body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* ======================== SIDEBAR ======================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow: hidden;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-smooth);
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  min-height: 52px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo .logo-dot {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: linear-gradient(135deg, var(--accent), #ec4899);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

body.sidebar-collapsed .sidebar-logo span:not(.logo-dot) {
  display: none;
}

/* Sidebar toggle button */
.sidebar-toggle {
  position: absolute;
  top: 12px;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  z-index: 201;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

body.sidebar-collapsed .sidebar-toggle {
  right: -14px;
}

body.sidebar-collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

.sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  font-size: 14px;
}

/* Sidebar nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}

.sidebar-section-label {
  padding: 12px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-section-label {
  text-align: center;
  padding: 8px 4px;
  font-size: 8px;
  letter-spacing: 0;
}

/* Nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover { background: var(--accent-soft); color: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

body.sidebar-collapsed .nav-item {
  padding: 10px 0;
  justify-content: center;
  border-left: none;
}

body.sidebar-collapsed .nav-item-name,
body.sidebar-collapsed .nav-item-count,
body.sidebar-collapsed .nav-item-arrow {
  display: none;
}

.nav-item-icon {
  width: 18px;
  min-width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-arrow {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.nav-item.open .nav-item-arrow { transform: rotate(90deg); color: var(--accent); }

/* Children */
.nav-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  background: var(--bg-body);
}

.nav-children.show { max-height: 600px; }

body.sidebar-collapsed .nav-children { display: none; }

.nav-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 6px 44px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-child:hover { color: var(--accent); background: var(--accent-soft); padding-left: 48px; }
.nav-child.active { color: var(--accent); font-weight: 600; }

.nav-child-count {
  font-size: 10px;
  color: var(--text-tertiary);
  min-width: 20px;
  text-align: right;
}

/* Software icon badge */
.sw-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 4px;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}

/* ============= USER PANEL ============= */
.sidebar-user-panel {
  border-top: 1px solid var(--border-color);
  padding: 10px 12px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-user-panel {
  padding: 8px 4px;
  align-items: center;
}

body.sidebar-collapsed .user-balance-row,
body.sidebar-collapsed .user-topup-btn,
body.sidebar-collapsed .user-name,
body.sidebar-collapsed .user-arrow {
  display: none;
}

.user-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.user-balance-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-balance-label i { color: var(--accent); }

.user-balance-value {
  font-weight: 700;
  color: #ef4444;
  font-size: 13px;
}

.user-topup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  border: none;
  white-space: nowrap;
}

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

.user-info-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 0;
  cursor: pointer;
}

.user-avatar {
  font-size: 22px;
  color: var(--text-secondary);
  line-height: 1;
  min-width: 22px;
}

.user-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-arrow {
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.user-info-row:hover .user-arrow { transform: translateX(2px); }

/* Hover popup menu */
.user-hover-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.25s ease;
  z-index: 300;
}

.user-info-row:hover .user-hover-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-hover-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.user-hover-menu a:hover { background: var(--accent-soft); color: var(--accent); }
.user-hover-menu a i { width: 16px; text-align: center; color: var(--text-tertiary); }
.user-hover-menu a:hover i { color: var(--accent); }
.user-hover-menu a .fa-crown { color: #f59e0b; }
.user-hover-menu-divider { height: 1px; background: var(--border-color); margin: 4px 0; }
.user-logout-link:hover { color: var(--danger) !important; }
.user-logout-link:hover i { color: var(--danger) !important; }

/* ======================== FLOATING BUTTONS ======================== */
.floating-actions {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}

.fab-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  position: relative;
}

.fab-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.1);
}

.fab-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ======================== PAGE CONTENT ======================== */
.page-content {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 40px 20px 32px;
}

.hero-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-search {
  max-width: 640px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 4px;
  transition: all var(--transition-fast);
}

.hero-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-category-select {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px 8px 16px;
  cursor: pointer;
  outline: none;
  border-right: 1px solid var(--border-color);
  font-family: var(--font-family);
  min-width: 140px;
}

.search-category-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  padding: 10px 16px;
  outline: none;
  font-family: var(--font-family);
}

.search-input::placeholder { color: var(--text-tertiary); }

.search-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

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

/* Tabs */
.explore-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.explore-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.explore-tab:hover, .explore-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ======================== CATEGORY GRID ======================== */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .st-icon { font-size: 20px; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 40px;
}

.category-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-smooth);
  aspect-ratio: 1;
  background: var(--bg-card);
}

.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }
.category-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.category-card:hover img { transform: scale(1.1); }

.category-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
  pointer-events: none;
}

.category-card-name {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ======================== POSTS GRID ======================== */
.posts-grid {
  columns: 5;
  column-gap: 14px;
}

.post-card-wrap {
  break-inside: avoid;
  margin-bottom: 14px;
}

.post-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-smooth);
  cursor: pointer;
  display: block;
}

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

.post-card-img-wrap {
  position: relative;
  overflow: hidden;
}

.post-card-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.6s ease;
}

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

.post-card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.25) 50%, transparent 100%);
  opacity: 0.8;
  transition: opacity 0.3s;
  pointer-events: none;
}

.post-card:hover .post-card-gradient { opacity: 1; }

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.badge-vip {
  background: var(--vip-gradient);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.badge-free {
  background: var(--free-gradient);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.post-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  z-index: 2;
}

.post-card-title {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: color var(--transition-fast);
}

.post-card:hover .post-card-title { color: #c4b5fd; }

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.post-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #d1d5db;
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* ======================== DETAIL PAGE ======================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 24px 0;
  font-size: 13px;
  color: var(--text-tertiary);
  max-width: 1400px;
  margin: 0 auto;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.detail-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.detail-hero {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 24px;
  padding: 20px;
}

.detail-featured-img {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.detail-featured-img img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-category-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-cat-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.detail-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-primary);
}

/* Meta grid */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.meta-item { display: flex; flex-direction: column; gap: 4px; }

.meta-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}

.meta-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.meta-badge {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 600;
}

/* Download buttons */
.download-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-download:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.3); }
.btn-vip { background: var(--download-vip); }
.btn-free { background: var(--download-free); }

/* Tags (below downloads) */
.detail-tags-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.detail-tag:hover { background: var(--accent-soft); color: var(--accent); transform: translateY(-1px); }

/* VIP message */
.vip-message {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(234,88,12,0.1));
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--warning);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Related Posts */
.related-section { padding: 20px; }

.related-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.related-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.related-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.related-card img { width: 100%; height: 100px; object-fit: cover; }

.related-card-title {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Content section */
.detail-content { padding: 20px; }

.detail-content img {
  border-radius: var(--radius-md);
  margin: 8px 0;
}

/* ======================== DETAIL SIDEBAR ======================== */
.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-widget {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.widget-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-header i { color: var(--accent); }

.widget-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  transition: background var(--transition-fast);
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
}

.widget-list-item:last-child { border-bottom: none; }
.widget-list-item:hover { background: var(--accent-soft); }

.widget-list-thumb {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.widget-list-thumb img { width: 100%; height: 100%; object-fit: cover; }

.widget-list-info { flex: 1; min-width: 0; }

.widget-list-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.widget-list-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Shortcode placeholder widgets */
.shortcode-placeholder {
  padding: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
}

.shortcode-placeholder code {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  margin-top: 6px;
}

/* Leaderboard widget */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-item:last-child { border-bottom: none; }

.leaderboard-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.leaderboard-rank.top1 { background: #f59e0b; color: #fff; }
.leaderboard-rank.top2 { background: #94a3b8; color: #fff; }
.leaderboard-rank.top3 { background: #b45309; color: #fff; }

.leaderboard-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ======================== FOOTER ======================== */
.footer {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  padding: 32px 24px;
  margin-top: 40px;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.footer-text { font-size: 12px; color: var(--text-tertiary); }

.footer-payments { display: flex; align-items: center; gap: 8px; }

.payment-icon {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ======================== INFINITE SCROLL ======================== */
.loadmore-sentinel { height: 1px; width: 100%; }

.loadmore-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
}

.loadmore-spinner i { font-size: 16px; color: var(--accent); }

/* ======================== OVERLAY ======================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-overlay.visible { opacity: 1; }

/* Mobile hamburger (floating) */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

/* ======================== RESPONSIVE ======================== */
@media (max-width: 1280px) {
  .posts-grid { columns: 4; }
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .related-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1024px) {
  .posts-grid { columns: 3; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { display: none; }
  .meta-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); width: var(--sidebar-width) !important; }
  .sidebar-close { display: flex; }
  .sidebar-overlay.active { display: block; }
  .sidebar-toggle { display: none; }
  .main-content { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .posts-grid { columns: 2; }
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .hero-title { font-size: 22px; }
  .page-content { padding: 16px; }
  .detail-layout { padding: 16px; }
  .detail-hero { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { flex-direction: column; text-align: center; }
  .download-actions { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .posts-grid { columns: 2; column-gap: 8px; }
  .post-card-wrap { margin-bottom: 8px; }
}

/* ======================== ANIMATIONS ======================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeInUp 0.4s ease forwards; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-surface-2) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
