/* ============================================
   NizTalks - Light Theme, Tight Spacing
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+Malayalam:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-sec: #555568;
  --text-muted: #8888a0;
  --accent: #0d9e6e;
  --accent-light: #e6f7f1;
  --accent-dark: #087a55;
  --border: #e2e4ea;
  --border-light: #eef0f4;
  --danger-bg: #fff0f0;
  --danger-border: #ffd0d0;
  --danger-text: #b33;
  --warning-bg: #fff8ee;
  --warning-border: #ffe0a8;
  --warning-text: #996600;
  --info-bg: #eef4ff;
  --info-border: #c8d8f0;
  --info-text: #336;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
  --max-width: 960px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans Malayalam', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body[data-lang="ml"] {
  font-family: 'Noto Sans Malayalam', 'Inter', sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; display: block; }

/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 52px;
}
.logo { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.logo span { color: var(--accent); }

.lang-toggle {
  display: flex; background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden;
}
.lang-btn {
  padding: 4px 14px; font-size: 0.8rem; font-weight: 600;
  background: transparent; color: var(--text-muted); border: none; cursor: pointer;
  transition: 0.2s;
}
.lang-btn.active { background: var(--accent); color: #fff; }
.lang-btn:hover:not(.active) { color: var(--text); }

/* ---- Container ---- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 16px; }

/* ---- Hero (Main Page) ---- */
.hero { text-align: center; padding: 36px 0 16px; }
.hero h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 6px; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 0.92rem; color: var(--text-sec); }

/* ---- Topics Grid ---- */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; padding: 20px 0 40px;
}
.topic-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: 0.25s; display: block; color: var(--text);
}
.topic-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}
.topic-card-img {
  width: 100%; height: 160px; object-fit: cover;
  border-bottom: 1px solid var(--border-light);
}
.topic-card-body { padding: 14px 16px; }
.topic-card-body h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.topic-card-body p { font-size: 0.82rem; color: var(--text-sec); line-height: 1.5; }
.topic-card-tag {
  display: inline-block; margin-top: 8px; padding: 2px 10px;
  background: var(--accent-light); color: var(--accent-dark);
  border-radius: 12px; font-size: 0.72rem; font-weight: 600;
}

/* ---- Detail Page ---- */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 12px 0 0; font-size: 0.82rem; color: var(--text-muted);
}
.back-link:hover { color: var(--accent); }

.detail-hero { text-align: center; padding: 20px 0 12px; }
.detail-hero h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.detail-hero .subtitle { font-size: 0.9rem; color: var(--text-sec); }

/* Image Gallery */
.image-gallery {
  display: flex; gap: 10px; overflow-x: auto; padding: 12px 0;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.image-gallery img {
  flex-shrink: 0; width: 220px; height: 150px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  scroll-snap-align: start;
}

/* Sections */
.section { padding: 20px 0; border-top: 1px solid var(--border-light); }
.section h2 {
  font-size: 1.15rem; font-weight: 600; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px; color: var(--text);
}
.section h2 .icon { font-size: 1.1rem; }
.section h3 { font-size: 0.95rem; font-weight: 600; margin: 12px 0 6px; }
.section p, .section li { color: var(--text-sec); font-size: 0.88rem; line-height: 1.65; }
.section ul, .section ol { padding-left: 20px; margin: 6px 0; }
.section li { margin-bottom: 4px; }

/* Feature List */
.feature-list { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.feature-list li {
  padding: 6px 0; display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--text-sec);
}
.feature-check { color: var(--accent); font-weight: 700; flex-shrink: 0; }

/* Spec Table */
.spec-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 0.85rem; }
.spec-table th, .spec-table td {
  padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border-light);
}
.spec-table th { color: var(--text-muted); font-weight: 500; width: 40%; background: var(--bg-alt); }
.spec-table td { color: var(--text-sec); }

/* Wiring Box */
.wiring-box {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin: 10px 0;
}
.wiring-box pre {
  font-family: 'Courier New', monospace; color: var(--accent-dark);
  font-size: 0.78rem; line-height: 1.5; overflow-x: auto;
}

/* Callouts */
.callout {
  border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0;
  display: flex; gap: 8px; align-items: flex-start; font-size: 0.85rem;
}
.callout-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.callout p { margin: 0; }
.callout-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); }
.callout-warning p { color: var(--warning-text); }
.callout-danger { background: var(--danger-bg); border: 1px solid var(--danger-border); }
.callout-danger p { color: var(--danger-text); }
.callout-info { background: var(--info-bg); border: 1px solid var(--info-border); }
.callout-info p { color: var(--info-text); }

/* App Buttons */
.app-buttons { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.app-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.88rem;
  font-weight: 500; transition: 0.2s;
}
.app-btn:hover { border-color: var(--accent); color: var(--accent); }
.app-btn-icon { font-size: 1.2rem; }

/* Numbered Steps */
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li {
  counter-increment: step; position: relative;
  padding: 10px 0 10px 48px; border-bottom: 1px solid var(--border-light);
}
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-light); border: 2px solid var(--accent);
  color: var(--accent-dark); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 0.8rem;
}
.steps li p { margin: 0; font-size: 0.88rem; }

/* Buy Section */
.buy-card {
  background: var(--accent-light); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 16px 20px; margin: 10px 0;
}
.buy-price { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.price-current { font-size: 1.4rem; font-weight: 700; color: var(--accent-dark); }
.price-original { font-size: 0.95rem; color: var(--text-muted); text-decoration: line-through; }
.price-badge {
  display: inline-block; padding: 2px 8px; background: #e74c3c; color: #fff;
  border-radius: 4px; font-size: 0.72rem; font-weight: 700;
}
.buy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; background: var(--accent); color: #fff;
  border-radius: var(--radius-sm); font-size: 0.92rem; font-weight: 600;
  transition: 0.2s; border: none;
}
.buy-btn:hover { background: var(--accent-dark); color: #fff; }
.buy-note { margin-top: 8px; font-size: 0.78rem; color: var(--text-muted); }

/* Compatibility Badges */
.compat-badges { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.compat-badges img { height: 40px; width: auto; object-fit: contain; }

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--border); padding: 20px 16px;
  text-align: center; color: var(--text-muted); font-size: 0.78rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.3rem; }
  .detail-hero h1 { font-size: 1.3rem; }
  .topics-grid { grid-template-columns: 1fr; }
  .feature-list { grid-template-columns: 1fr; }
  .image-gallery img { width: 180px; height: 120px; }
  .app-buttons { flex-direction: column; }
}

@media (max-width: 480px) {
  .navbar-inner { height: 46px; }
  .logo { font-size: 1.1rem; }
  .lang-btn { padding: 3px 10px; font-size: 0.75rem; }
  .hero { padding: 24px 0 10px; }
  .hero h1 { font-size: 1.15rem; }
  .hero p { font-size: 0.85rem; }
  .detail-hero h1 { font-size: 1.15rem; }
  .detail-hero .subtitle { font-size: 0.82rem; }
  .section h2 { font-size: 1rem; }
  .image-gallery img { width: 150px; height: 100px; }
  .topic-card-img { height: 140px; }
  .wiring-box pre { font-size: 0.68rem; }
  .steps li { padding-left: 42px; }
  .steps li::before { width: 28px; height: 28px; font-size: 0.75rem; }
}
