/* ===== VARIABLES & RESET ===== */
:root {
  --bg-gradient: linear-gradient(135deg, #1a0533 0%, #0a1628 30%, #0d2137 60%, #0a2a1a 100%);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --text-primary: #f0f0f0;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --accent: #7c5cfc;
  --accent-light: #a78bfa;
  --card-radius: 16px;
  --blur: blur(16px);
  --transition: 0.3s ease;
}

[data-theme="light"] {
  --bg-gradient: linear-gradient(135deg, #e8dff5 0%, #d4e7f7 30%, #d0eadf 60%, #f0e6f6 100%);
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --text-primary: #1a1a2e;
  --text-secondary: rgba(26, 26, 46, 0.7);
  --text-muted: rgba(26, 26, 46, 0.5);
  --accent: #6c3ce0;
  --accent-light: #8b5cf6;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

/* ===== ANIMATIONS ===== */
@keyframes bgShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-gradient);
  background-size: 300% 300%;
  animation: bgShift 20s ease infinite;
  z-index: -1;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-hidden {
  opacity: 0;
  transform: translateY(30px);
}

/* ===== GLASS CARD ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  box-shadow: var(--glass-shadow);
}

/* ===== LAYOUT ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== HEADER / NAV ===== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 0;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-light);
  text-decoration: none;
}

nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color var(--transition);
}

nav a:hover, nav a.active {
  color: var(--accent-light);
}

#theme-toggle {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

#theme-toggle:hover {
  background: rgba(124, 92, 252, 0.2);
}

/* ===== HERO ===== */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--accent-light), #38bdf8, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  font-size: 1.05rem;
}

/* ===== TEXTAREA ===== */
.textarea-wrap {
  position: relative;
  margin-bottom: 24px;
}

#text-input {
  width: 100%;
  min-height: 200px;
  padding: 20px;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#text-input::placeholder {
  color: var(--text-muted);
}

#text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.2);
}

/* ===== ACTION BUTTONS ===== */
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.btn {
  padding: 10px 24px;
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  background: rgba(124, 92, 252, 0.2);
  border-color: var(--accent);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 20px 16px;
  text-align: center;
  transition: transform var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-light);
  display: block;
}

.stat-card .label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== DENSITY BAR ===== */
.density-section {
  margin-bottom: 48px;
}

.density-section h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: var(--text-secondary);
  text-align: center;
}

.density-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.density-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.density-word {
  min-width: 100px;
  text-align: right;
  font-weight: 600;
  font-size: 0.95rem;
}

.density-bar-bg {
  flex: 1;
  height: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
}

[data-theme="light"] .density-bar-bg {
  background: rgba(0, 0, 0, 0.06);
}

.density-bar-fill {
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  transition: width 0.5s ease;
}

.density-pct {
  min-width: 48px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.density-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
  font-style: italic;
}

/* ===== SEO CONTENT SECTIONS ===== */
.seo-section {
  padding: 48px 0;
}

.seo-section h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-bottom: 16px;
  color: var(--accent-light);
}

.seo-section h3 {
  font-size: 1.15rem;
  margin: 24px 0 8px;
  color: var(--text-primary);
}

.seo-section p, .seo-section li {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.seo-section ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.seo-card {
  padding: 32px;
  margin-bottom: 24px;
}

/* ===== TABLE ===== */
.table-wrap {
  overflow-x: auto;
  margin: 24px 0;
}

.styled-table {
  width: 100%;
  border-collapse: collapse;
}

.styled-table th,
.styled-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.styled-table th {
  color: var(--accent-light);
  font-weight: 600;
}

.styled-table td {
  color: var(--text-secondary);
}

.styled-table tr:hover td {
  background: rgba(124, 92, 252, 0.05);
}

/* ===== TIPS GRID ===== */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.tip-card {
  padding: 24px;
}

.tip-card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.tip-card p {
  margin: 0;
  font-size: 0.9rem;
}

/* ===== BLOG PAGE ===== */
.blog-header {
  padding: 60px 0 32px;
  text-align: center;
}

.blog-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  background: linear-gradient(135deg, var(--accent-light), #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.blog-header p {
  color: var(--text-secondary);
  max-width: 550px;
  margin: 0 auto;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  padding-bottom: 48px;
}

.blog-card {
  padding: 28px;
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-6px);
}

.blog-card .card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.blog-card h2 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  color: var(--text-primary);
  line-height: 1.4;
}

.blog-card h2 a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

.blog-card h2 a:hover {
  color: var(--accent-light);
}

.blog-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  flex: 1;
  margin-bottom: 16px;
}

.blog-card .read-more {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: color var(--transition);
}

.blog-card .read-more:hover {
  color: var(--accent);
}

/* ===== ARTICLE PAGE ===== */
.article-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 20px 60px;
}

.article-wrap .glass {
  padding: 40px;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.article-wrap h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  margin-bottom: 8px;
  color: var(--accent-light);
  line-height: 1.3;
}

.article-wrap h2 {
  font-size: 1.35rem;
  margin: 32px 0 12px;
  color: var(--accent-light);
}

.article-wrap h3 {
  font-size: 1.1rem;
  margin: 24px 0 8px;
}

.article-wrap p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.article-wrap ul, .article-wrap ol {
  padding-left: 24px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.article-wrap li {
  margin-bottom: 6px;
}

.article-wrap a {
  color: var(--accent-light);
  text-decoration: underline;
  text-decoration-color: rgba(124, 92, 252, 0.3);
  transition: text-decoration-color var(--transition);
}

.article-wrap a:hover {
  text-decoration-color: var(--accent-light);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.article-nav a {
  text-decoration: none;
}

/* ===== CTA BOX ===== */
.cta-box {
  text-align: center;
  padding: 32px;
  margin: 32px 0;
}

.cta-box p {
  margin-bottom: 16px;
  font-size: 1.05rem;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0 48px;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.pagination-link:hover {
  background: rgba(124, 92, 252, 0.2);
  border-color: var(--accent);
  color: var(--text-primary);
}

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

.pagination-active:hover {
  background: var(--accent-light);
  color: #fff;
}

/* ===== FOOTER ===== */
footer {
  padding: 32px 0;
  text-align: center;
  border-top: 1px solid var(--glass-border);
  margin-top: 48px;
}

footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  margin: 0 10px;
  font-size: 0.85rem;
  transition: color var(--transition);
}

footer a:hover {
  color: var(--accent-light);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero { padding: 40px 0 24px; }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .stat-card { padding: 14px 10px; }
  .stat-card .value { font-size: 1.5rem; }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  .article-wrap .glass {
    padding: 24px;
  }

  nav { gap: 14px; }
  nav a { font-size: 0.85rem; }

  .density-word { min-width: 70px; font-size: 0.85rem; }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .actions { gap: 8px; }
  .btn { padding: 8px 16px; font-size: 0.85rem; }

  .tips-grid { grid-template-columns: 1fr; }
}
