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

:root {
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --blue-dark: #1d4ed8;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --yellow: #f59e0b;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --gray-50: #0f172a;
  --gray-100: #1e293b;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #64748b;
  --gray-500: #94a3b8;
  --gray-600: #cbd5e1;
  --gray-700: #e2e8f0;
  --gray-800: #f1f5f9;
  --gray-900: #f8fafc;
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --blue-dark: #2563eb;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; }
.main { flex: 1; }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 60px;
  gap: 32px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  text-decoration: none;
  white-space: nowrap;
}

.logo span { color: var(--blue); }

.nav-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: all var(--transition);
}

.nav-link:hover { color: var(--gray-900); background: var(--gray-100); }
.nav-link-admin { color: var(--orange); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-user {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-weight: 500;
  text-decoration: none;
}

.nav-user:hover { color: var(--blue); }

/* ===== USER DROPDOWN ===== */
.nav-user-dropdown { position: relative; }

.nav-user-btn {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-user-btn:hover { border-color: var(--blue); color: var(--blue); }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 200;
  padding: 6px 0;
}

.nav-dropdown-menu.open { display: block; }

.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  font-size: 0.88rem;
  color: var(--gray-700);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition);
}

.dropdown-item:hover { background: var(--gray-100); color: var(--blue); }

.dropdown-divider { border: none; border-top: 1px solid var(--gray-200); margin: 4px 0; }

.dropdown-logout { color: var(--red); }

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}

.mobile-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gray-700);
  border-radius: 1px;
  transition: all var(--transition);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--gray-500);
  transition: all var(--transition);
  line-height: 1;
}

.theme-toggle:hover { border-color: var(--blue); color: var(--blue); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  gap: 6px;
}

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }

.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: #c2410c; color: #fff; }

.inline-form { display: inline; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--blue) 0%, #4f46e5 100%);
  color: #fff;
  padding: 72px 0;
  text-align: center;
}

.hero-title { font-size: 2.5rem; font-weight: 700; margin-bottom: 12px; letter-spacing: -0.5px; }
.hero-subtitle { font-size: 1.15rem; opacity: 0.85; margin-bottom: 32px; max-width: 500px; margin-left: auto; margin-right: auto; }

.search-form { display: flex; gap: 8px; max-width: 520px; margin: 0 auto; }
.search-input { flex: 1; padding: 12px 16px; border: none; border-radius: 8px; font-size: 1rem; font-family: inherit; outline: none; box-shadow: var(--shadow-md); }
.search-input:focus { box-shadow: 0 0 0 3px rgba(37,99,235,0.3), var(--shadow-md); }
.search-form .btn { border-radius: 8px; padding: 12px 24px; }

/* ===== TOOLBAR & FILTER ===== */
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-tag {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  transition: all var(--transition);
  text-decoration: none;
}

.filter-tag:hover { border-color: var(--blue); color: var(--blue); }
.filter-tag.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.sort-select { display: flex; align-items: center; gap: 8px; }
.sort-select label { font-size: 0.85rem; color: var(--gray-500); white-space: nowrap; }
.sort-select select {
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--gray-700);
  background: var(--gray-50);
  cursor: pointer;
  outline: none;
}
.sort-select select:focus { border-color: var(--blue); }

/* ===== ARTICLE CARDS ===== */
.section { padding: 40px 0 60px; }

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.article-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--gray-300);
  transform: translateY(-2px);
}

.article-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.article-card-category {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue);
  background: rgba(37,99,235,0.08);
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.article-card-date { font-size: 0.8rem; color: var(--gray-400); }
.article-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; line-height: 1.3; }
.article-card h3 a { color: var(--gray-900); }
.article-card h3 a:hover { color: var(--blue); }
.article-card-preview { font-size: 0.9rem; color: var(--gray-500); line-height: 1.5; flex: 1; margin-bottom: 16px; }

.article-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--gray-400);
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap;
}

.article-card-rating { font-weight: 600; color: var(--yellow); }
.article-card-views { }

/* ===== ARTICLE TAGS ===== */
.article-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }

.tag {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  text-decoration: none;
  transition: all var(--transition);
}

.tag:hover { border-color: var(--blue); color: var(--blue); }

/* ===== AUTH PAGES ===== */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 200px); padding: 40px 20px; }

.auth-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-card h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { color: var(--gray-500); margin-bottom: 24px; font-size: 0.9rem; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--gray-500); }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--gray-700); }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group textarea { resize: vertical; min-height: 120px; }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 16px; }
.alert-error { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }

/* ===== DASHBOARD ===== */
.dashboard { padding: 32px 20px 60px; }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.dashboard-header h1 { font-size: 1.5rem; font-weight: 700; }
.create-form-wrapper { margin-bottom: 24px; }

.card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 20px; }
.article-form { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 8px; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 16px; font-size: 0.9rem; border-bottom: 1px solid var(--gray-100); }
.table th { font-weight: 600; color: var(--gray-500); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.table td { color: var(--gray-700); }
.table tbody tr:hover { background: var(--gray-100); }

/* ===== STATUS BADGES ===== */
.status { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 600; gap: 4px; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-rejected { background: #fee2e2; color: #991b1b; }

/* ===== ADMIN ===== */
.admin-page { padding: 32px 20px 60px; }
.admin-page > h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 24px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 32px; }

.stat-card { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }

.tab {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.tab:hover { color: var(--gray-700); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== ADMIN ARTICLE CARD ===== */
.admin-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  transition: border-color var(--transition);
}

.admin-card:hover { border-color: var(--gray-300); }
.admin-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.admin-card-title { font-size: 1.05rem; font-weight: 600; color: var(--gray-900); }
.admin-card-meta { font-size: 0.82rem; color: var(--gray-400); margin-bottom: 8px; }
.admin-card-preview { font-size: 0.88rem; color: var(--gray-500); margin-bottom: 12px; line-height: 1.5; }
.admin-card-actions { display: flex; gap: 8px; align-items: center; }

.admin-comment-input {
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  flex: 1;
  max-width: 300px;
  outline: none;
  background: var(--gray-50);
}

.admin-comment-input:focus { border-color: var(--blue); }

/* ===== ARTICLE PAGE ===== */
.article-page { padding: 32px 0 60px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.9rem; color: var(--gray-500); margin-bottom: 24px; }
.back-link:hover { color: var(--blue); }

.article-meta { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.article-category-tag { font-size: 0.78rem; font-weight: 600; color: var(--blue); background: rgba(37,99,235,0.08); padding: 3px 10px; border-radius: 12px; }
.article-date, .article-author, .article-views, .article-read-time { font-size: 0.85rem; color: var(--gray-400); }
.article-author { text-decoration: none; }
.article-author:hover { color: var(--blue); }

.article-title { font-size: 2rem; font-weight: 700; line-height: 1.25; margin-bottom: 32px; color: var(--gray-900); }

.article-body { font-size: 1.05rem; line-height: 1.8; color: var(--gray-700); }
.article-body h2 { font-size: 1.4rem; font-weight: 600; margin: 32px 0 12px; color: var(--gray-900); }
.article-body h3 { font-size: 1.15rem; font-weight: 600; margin: 24px 0 8px; color: var(--gray-900); }
.article-body p { margin: 12px 0; }
.article-body ul, .article-body ol { margin: 12px 0; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body a { color: var(--blue); text-decoration: underline; }
.article-body a:hover { text-decoration: none; }
.article-body strong { font-weight: 600; color: var(--gray-900); }
.article-body code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.article-body pre { background: var(--gray-100); padding: 16px; border-radius: 8px; overflow-x: auto; margin: 16px 0; }
.article-body pre code { background: none; padding: 0; }
.article-body blockquote { border-left: 3px solid var(--blue); padding-left: 16px; margin: 16px 0; color: var(--gray-600); font-style: italic; }
.article-body img { max-width: 100%; border-radius: 8px; margin: 16px 0; }
.article-body table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.article-body th, .article-body td { padding: 8px 12px; border: 1px solid var(--gray-200); text-align: left; }
.article-body th { background: var(--gray-100); font-weight: 600; }

/* ===== BOOKMARK BUTTON ===== */
.bookmark-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gray-400);
  padding: 2px 4px;
  transition: all var(--transition);
}

.bookmark-btn:hover, .bookmark-btn.active { color: var(--red); }

/* ===== RATING BLOCK ===== */
.rating-block {
  margin-top: 40px;
  padding: 24px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

.rating-summary { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.rating-value { font-size: 1.8rem; font-weight: 700; color: var(--gray-900); }
.rating-star-static { font-size: 1.4rem; color: var(--yellow); }
.rating-count { font-size: 0.85rem; color: var(--gray-500); }

.rating-stars { display: flex; align-items: center; gap: 4px; }
.rating-label { font-size: 0.85rem; color: var(--gray-500); margin-right: 8px; }
.rating-stars .star { background: none; border: none; font-size: 1.5rem; color: var(--gray-300); cursor: pointer; padding: 2px; transition: color 0.15s; }
.rating-stars .star:hover, .rating-stars .star.active { color: var(--yellow); }

/* ===== COMMENTS ===== */
.comments-section { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--gray-200); }
.comments-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 20px; }

.comment-form { margin-bottom: 24px; }
.comment-form textarea { width: 100%; min-height: 80px; }

.comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
}

.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.comment-meta { flex: 1; }
.comment-author { font-weight: 600; font-size: 0.9rem; color: var(--gray-900); }
.comment-author:hover { color: var(--blue); }
.comment-date { font-size: 0.8rem; color: var(--gray-400); margin-left: 8px; }
.comment-delete { font-size: 0.8rem; color: var(--gray-400); cursor: pointer; background: none; border: none; }
.comment-delete:hover { color: var(--red); }
.comment-body { font-size: 0.95rem; color: var(--gray-700); line-height: 1.6; }

.comment-actions { margin-top: 6px; }

.comment-reply-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.comment-reply-btn:hover { color: var(--blue); }

.comment-reply { border-left: 2px solid var(--gray-200); padding-left: 12px; margin-top: 8px; }

.comment-reply-form { margin-top: 10px; }
.comment-reply-form textarea,
.comment-form textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  resize: vertical;
  outline: none;
}

.comment-reply-form textarea:focus,
.comment-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

[data-theme="dark"] .comment-reply { border-color: var(--gray-200); }
[data-theme="dark"] .comment-body { color: var(--gray-600); }
[data-theme="dark"] .comment-form textarea,
[data-theme="dark"] .comment-reply-form textarea {
  background: var(--gray-100);
  color: var(--gray-800);
  border-color: var(--gray-200);
}
[data-theme="dark"] .comment-form textarea::placeholder,
[data-theme="dark"] .comment-reply-form textarea::placeholder {
  color: var(--gray-400);
}

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 32px 0; }

.pagination-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  text-decoration: none;
  transition: all var(--transition);
}

.pagination-btn:hover { border-color: var(--blue); color: var(--blue); }
.pagination-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ===== PROFILE ===== */
.profile-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 32px;
}

.profile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.profile-name { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-bottom: 2px; }
.profile-joined { font-size: 0.85rem; color: var(--gray-400); margin-bottom: 2px; }
.profile-bio { font-size: 0.95rem; color: var(--gray-600); margin-top: 8px; }

.profile-stats { display: flex; gap: 32px; padding-top: 16px; border-top: 1px solid var(--gray-100); }
.profile-stat-value { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.profile-stat-label { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.3px; }

.profile-articles-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.profile-articles-header h2 { font-size: 1.2rem; font-weight: 600; }

/* ===== ERROR PAGE ===== */
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50vh; text-align: center; padding: 60px 20px; }
.error-code { font-size: 5rem; font-weight: 700; color: var(--gray-200); line-height: 1; margin-bottom: 16px; }
.error-page h2 { font-size: 1.3rem; color: var(--gray-600); margin-bottom: 24px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.1rem; color: var(--gray-600); margin-bottom: 4px; }

/* ===== FOOTER ===== */
.footer { border-top: 1px solid var(--gray-200); padding: 24px 0; text-align: center; font-size: 0.85rem; color: var(--gray-400); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav-center, .nav-right { display: none; }
  .nav-center.active, .nav-right.active {
    display: flex;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--gray-50);
    flex-direction: column;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    z-index: 99;
  }
  .mobile-toggle { display: flex; }
  .hero { padding: 48px 0; }
  .hero-title { font-size: 1.7rem; }
  .hero-subtitle { font-size: 1rem; }
  .search-form { flex-direction: column; }
  .articles-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .dashboard-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-card-header { flex-direction: column; }
  .admin-card-actions { flex-wrap: wrap; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .toolbar { flex-direction: column; align-items: flex-start; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.article-card { animation: fadeIn 0.3s ease both; }
.article-card:nth-child(2) { animation-delay: 0.05s; }
.article-card:nth-child(3) { animation-delay: 0.1s; }
.article-card:nth-child(4) { animation-delay: 0.15s; }
.article-card:nth-child(5) { animation-delay: 0.2s; }
.article-card:nth-child(6) { animation-delay: 0.25s; }
.stat-card { animation: fadeIn 0.3s ease both; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card:nth-child(5) { animation-delay: 0.2s; }
.admin-card { animation: fadeIn 0.25s ease both; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 20px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500; color: #fff; box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards; max-width: 400px; word-break: break-word; cursor: pointer; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--blue); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ===== LOADING BUTTON ===== */
.btn-loading { position: relative; pointer-events: none; opacity: 0.7; }
.btn-loading::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid transparent; border-top-color: #fff; border-radius: 50%; animation: btnSpin 0.6s linear infinite; top: 50%; left: 50%; margin: -8px 0 0 -8px; }
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* ===== AI CHAT WIDGET ===== */
.ai-chat-widget { margin-top:2rem; border:1px solid var(--gray-200); border-radius:var(--radius); overflow:hidden; background:var(--gray-50); }
.ai-chat-header { padding:12px 16px; background:linear-gradient(135deg, var(--blue) 0%, #7c3aed 100%); color:#fff; display:flex; align-items:center; gap:8px; font-weight:600; font-size:0.95rem; }
.ai-chat-icon { font-size:1.1rem; }
.ai-chat-hint { font-weight:400; font-size:0.8rem; opacity:0.8; margin-left:auto; }
.ai-chat-messages { max-height:400px; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:12px; }
.ai-msg { display:flex; gap:10px; max-width:90%; animation:fadeIn 0.3s ease; }
.ai-msg-user { align-self:flex-end; flex-direction:row-reverse; }
.ai-msg-avatar { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:0.75rem; font-weight:700; flex-shrink:0; }
.ai-msg-user .ai-msg-avatar { background:var(--blue); color:#fff; }
.ai-msg-assistant .ai-msg-avatar { background:linear-gradient(135deg, #7c3aed, var(--blue)); color:#fff; }
.ai-msg-body { padding:10px 14px; border-radius:12px; font-size:0.9rem; line-height:1.5; }
.ai-msg-user .ai-msg-body { background:var(--blue); color:#fff; border-bottom-right-radius:4px; }
.ai-msg-assistant .ai-msg-body { background:var(--gray-100); color:var(--gray-800); border-bottom-left-radius:4px; border:1px solid var(--gray-200); }
.ai-msg-body p { margin:0 0 8px; }
.ai-msg-body p:last-child { margin-bottom:0; }
.ai-msg-body pre { background:var(--gray-800); color:#e2e8f0; padding:10px 12px; border-radius:8px; overflow-x:auto; font-size:0.82rem; margin:8px 0; }
.ai-msg-body code { font-size:0.85em; background:var(--gray-200); padding:1px 4px; border-radius:4px; }
.ai-msg-body pre code { background:none; padding:0; }
.ai-msg-body ul, .ai-msg-body ol { margin:6px 0; padding-left:20px; }
.ai-msg-body li { margin:2px 0; }
.ai-msg-body h1, .ai-msg-body h2, .ai-msg-body h3 { margin:8px 0 4px; font-size:0.95rem; }
.ai-chat-typing { padding:8px 16px; display:flex; align-items:center; gap:8px; color:var(--gray-400); font-size:0.85rem; }
.ai-typing-dots { display:flex; gap:3px; }
.ai-typing-dots span { width:6px; height:6px; background:var(--gray-400); border-radius:50%; animation:typingBounce 1.2s ease infinite; }
.ai-typing-dots span:nth-child(2) { animation-delay:0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay:0.4s; }
@keyframes typingBounce { 0%,60%,100% { transform:translateY(0); } 30% { transform:translateY(-4px); } }
.ai-chat-input-wrap { display:flex; gap:0; border-top:1px solid var(--gray-200); }
.ai-chat-input { flex:1; padding:12px 16px; border:none; background:var(--gray-50); color:var(--gray-800); font-size:0.9rem; font-family:inherit; outline:none; }
.ai-chat-input::placeholder { color:var(--gray-400); }
.ai-chat-send { padding:12px 16px; border:none; background:var(--blue); color:#fff; font-size:1.1rem; cursor:pointer; transition:background 0.2s; }
.ai-chat-send:hover { background:var(--blue-dark); }
.ai-chat-send:disabled { opacity:0.5; cursor:not-allowed; }

/* AI Search badge */
.ai-search-badge { display:none; position:absolute; top:50%; right:80px; transform:translateY(-50%); background:linear-gradient(135deg, #7c3aed, var(--blue)); color:#fff; font-size:0.65rem; font-weight:700; padding:2px 8px; border-radius:10px; pointer-events:none; letter-spacing:0.5px; }
@keyframes aiPulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

[data-theme="dark"] .ai-chat-widget { border-color:var(--gray-200); background:var(--gray-100); }
[data-theme="dark"] .ai-msg-assistant .ai-msg-body { background:var(--gray-200); border-color:var(--gray-300); color:var(--gray-800); }
[data-theme="dark"] .ai-msg-body pre { background:#1a1a2e; color:#e2e8f0; }

/* Link preview cards */
.link-preview-card { display:flex; border:1px solid var(--gray-200); border-radius:12px; overflow:hidden; margin:1.2rem 0; background:var(--gray-50); transition:border-color 0.2s,box-shadow 0.2s; text-decoration:none; color:inherit; }
.link-preview-card:hover { border-color:var(--blue-light); box-shadow:0 4px 16px rgba(37,99,235,0.1); }
.link-preview-image { flex-shrink:0; width:180px; min-height:120px; overflow:hidden; background:var(--gray-200); }
.link-preview-image img { width:100%; height:100%; object-fit:cover; display:block; }
.link-preview-content { flex:1; padding:12px 16px; min-width:0; display:flex; flex-direction:column; gap:4px; }
.link-preview-favicon { width:16px; height:16px; border-radius:3px; display:inline-block; vertical-align:middle; margin-right:4px; }
.link-preview-site { font-size:0.75rem; color:var(--gray-400); text-transform:uppercase; letter-spacing:0.5px; font-weight:600; }
.link-preview-title { font-size:0.95rem; font-weight:600; color:var(--gray-800); line-height:1.3; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.link-preview-desc { font-size:0.82rem; color:var(--gray-500); line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.link-preview-url { font-size:0.72rem; color:var(--gray-400); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:auto; }
[data-theme="dark"] .link-preview-card { background:var(--gray-100); border-color:var(--gray-300); }
[data-theme="dark"] .link-preview-title { color:var(--gray-100); }
@media(max-width:640px) { .link-preview-image { display:none; } .link-preview-card { flex-direction:column; } }

/* Attachments */
.attachments-list { display:flex; flex-wrap:wrap; gap:10px; }
.attachment-item { display:flex; align-items:center; gap:10px; padding:10px 14px; border:1px solid var(--gray-200); border-radius:10px; background:var(--gray-50); transition:border-color 0.2s; min-width:200px; }
.attachment-item:hover { border-color:var(--blue-light); }
.attachment-icon { font-size:1.5rem; flex-shrink:0; }
.attachment-info { flex:1; min-width:0; }
.attachment-name { font-size:0.85rem; font-weight:600; color:var(--gray-800); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.attachment-meta { font-size:0.72rem; color:var(--gray-400); display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.attachment-download { color:var(--blue); text-decoration:none; font-weight:600; font-size:0.8rem; white-space:nowrap; }
.attachment-download:hover { text-decoration:underline; }
.scan-badge { display:inline-flex; align-items:center; gap:3px; padding:2px 8px; border-radius:8px; font-size:0.7rem; font-weight:600; }
.badge-clean { background:#d1fae5; color:#065f46; }
.badge-danger { background:#fee2e2; color:#991b1b; }
.badge-unknown { background:var(--gray-200); color:var(--gray-500); }
.badge-pending { background:#fef3c7; color:#92400e; }
[data-theme="dark"] .badge-clean { background:#064e3b; color:#a7f3d0; }
[data-theme="dark"] .badge-danger { background:#7f1d1d; color:#fecaca; }
[data-theme="dark"] .badge-unknown { background:var(--gray-300); color:var(--gray-100); }
[data-theme="dark"] .attachment-item { background:var(--gray-100); border-color:var(--gray-300); }

/* File upload area */
.file-upload-area { border:2px dashed var(--gray-300); border-radius:10px; padding:16px; text-align:center; cursor:pointer; transition:border-color 0.2s,background 0.2s; margin-top:8px; }
.file-upload-area:hover { border-color:var(--blue); background:rgba(37,99,235,0.03); }
.file-upload-area.dragover { border-color:var(--blue); background:rgba(37,99,235,0.06); }
.file-upload-text { font-size:0.85rem; color:var(--gray-400); }
.file-upload-input { display:none; }

/* Dark theme — alerts, statuses, buttons */
[data-theme="dark"] .alert-error { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .alert-success { background: #052e16; color: #86efac; border-color: #14532d; }
[data-theme="dark"] .status-pending { background: #451a03; color: #fcd34d; }
[data-theme="dark"] .status-approved { background: #052e16; color: #86efac; }
[data-theme="dark"] .status-rejected { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .comment-delete { color: var(--gray-500); }
[data-theme="dark"] .comment-delete:hover { color: #fca5a5; }
[data-theme="dark"] .comment-reply-btn { color: var(--gray-400); }
[data-theme="dark"] .comment-reply-btn:hover { color: #60a5fa; }
[data-theme="dark"] .hero { background: linear-gradient(135deg, var(--gray-100), var(--gray-200)); }
[data-theme="dark"] .hero-title { color: var(--gray-100); }
[data-theme="dark"] .badge-pending { background:#451a03; color:#fcd34d; }
[data-theme="dark"] .badge-approved { background:#052e16; color:#86efac; }
[data-theme="dark"] .badge-rejected { background:#450a0a; color:#fca5a5; }
