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

:root {
  --bg: #0a0e14;
  --bg-card: #131a24;
  --bg-card-hover: #1a2332;
  --border: #1e2a3a;
  --primary: #00b4d8;
  --primary-dark: #0077b6;
  --secondary: #0077b6;
  --success: #00ff88;
  --warning: #ffc107;
  --danger: #ff4444;
  --text: #e8e8e8;
  --text-secondary: #8892a4;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --max-width: 1200px;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--success); }

img { max-width: 100%; height: auto; }

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

/* Navigation */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(10,14,20,0.95); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px; height: 64px;
  display: flex; align-items: center;
}
.nav-inner {
  max-width: var(--max-width); margin: 0 auto; width: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-size: 1.4rem; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.nav-logo span { color: var(--primary); }
.nav-links { display: flex; gap: 24px; list-style: none; }
.nav-links a { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }
.nav-links a:hover { color: var(--primary); }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* Hero */
.hero {
  padding: 120px 20px 80px; text-align: center;
  background: linear-gradient(180deg, rgba(0,180,216,0.08) 0%, transparent 60%);
}
.hero h1 { font-size: 3.5rem; font-weight: 900; line-height: 1.1; margin-bottom: 16px; }
.hero h1 .accent { color: var(--primary); }
.hero p { font-size: 1.25rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto 32px; }
.hero-search {
  max-width: 560px; margin: 0 auto 40px; position: relative;
}
.hero-search input {
  width: 100%; padding: 16px 24px; padding-right: 56px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 50px;
  color: var(--text); font-size: 1rem; font-family: var(--font); outline: none;
  transition: border-color 0.2s;
}
.hero-search input:focus { border-color: var(--primary); }
.hero-search button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--primary); border: none; border-radius: 50%; width: 44px; height: 44px;
  color: #fff; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: 0.95rem; border: none; cursor: pointer; transition: all 0.2s;
  font-family: var(--font); text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #00c8ef; color: #fff; transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-secondary:hover { background: rgba(0,180,216,0.1); color: var(--primary); }
.btn-success { background: var(--success); color: #000; }
.btn-success:hover { background: #33ff9f; color: #000; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1.1rem; }

/* Cards */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: all 0.2s;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }

/* Section */
.section { padding: 80px 0; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-header h2 { font-size: 2.2rem; font-weight: 800; margin-bottom: 12px; }
.section-header p { color: var(--text-secondary); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

/* Badge */
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: 20px; font-size: 0.75rem; font-weight: 600;
  background: rgba(0,180,216,0.15); color: var(--primary);
}
.badge-success { background: rgba(0,255,136,0.15); color: var(--success); }
.badge-warning { background: rgba(255,193,7,0.15); color: var(--warning); }
.badge-danger { background: rgba(255,68,68,0.15); color: var(--danger); }

/* Grid */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg-card); padding: 14px 16px; text-align: left; font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
tr:hover td { background: rgba(0,180,216,0.03); }

/* Filter Bar */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; align-items: center;
}
.filter-bar select, .filter-bar input {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 10px 14px; font-size: 0.9rem; font-family: var(--font);
  outline: none; transition: border-color 0.2s;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); }
.filter-bar input { flex: 1; min-width: 200px; }
.result-count { color: var(--text-secondary); font-size: 0.9rem; margin-left: auto; }

/* Protocol/Ecosystem Badges */
.proto-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600; margin: 1px; font-family: var(--mono);
}
.proto-matter { background: rgba(0,180,216,0.2); color: #00b4d8; }
.proto-thread { background: rgba(0,255,136,0.2); color: #00ff88; }
.proto-zigbee { background: rgba(255,193,7,0.2); color: #ffc107; }
.proto-zwave { background: rgba(255,68,68,0.2); color: #ff4444; }
.proto-wifi { background: rgba(139,92,246,0.2); color: #8b5cf6; }
.proto-bluetooth { background: rgba(59,130,246,0.2); color: #3b82f6; }

.eco-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600; margin: 1px;
}
.eco-apple { background: rgba(255,255,255,0.1); color: #fff; }
.eco-google { background: rgba(66,133,244,0.2); color: #4285f4; }
.eco-alexa { background: rgba(0,200,255,0.2); color: #00c8ff; }
.eco-smartthings { background: rgba(21,188,219,0.2); color: #15bcdb; }

/* Footer */
.footer {
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 60px 20px 30px;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; max-width: var(--max-width); margin: 0 auto; }
.footer-col h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); margin-bottom: 16px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--text-secondary); font-size: 0.9rem; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  max-width: var(--max-width); margin: 40px auto 0; padding-top: 20px;
  border-top: 1px solid var(--border); text-align: center;
  color: var(--text-secondary); font-size: 0.85rem;
}
.footer-brand { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; }
.footer-brand span { color: var(--primary); }
.footer-desc { color: var(--text-secondary); font-size: 0.9rem; max-width: 300px; }

/* Quiz/Finder */
.quiz-step { display: none; text-align: center; padding: 40px 0; }
.quiz-step.active { display: block; }
.quiz-step h2 { font-size: 1.8rem; margin-bottom: 8px; }
.quiz-step p { color: var(--text-secondary); margin-bottom: 32px; }
.quiz-options { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; max-width: 700px; margin: 0 auto; }
.quiz-option {
  background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 20px 28px; cursor: pointer; transition: all 0.2s; min-width: 140px;
  font-size: 1rem; font-weight: 600; color: var(--text); font-family: var(--font);
}
.quiz-option:hover { border-color: var(--primary); background: var(--bg-card-hover); }
.quiz-option.selected { border-color: var(--primary); background: rgba(0,180,216,0.1); }
.quiz-option .icon { font-size: 2rem; margin-bottom: 8px; display: block; }
.quiz-progress { display: flex; gap: 8px; justify-content: center; margin-bottom: 32px; }
.quiz-dot { width: 40px; height: 4px; border-radius: 2px; background: var(--border); }
.quiz-dot.active { background: var(--primary); }
.quiz-dot.done { background: var(--success); }

/* Product Result Card */
.product-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; gap: 20px; align-items: flex-start;
}
.product-card-img {
  width: 120px; height: 120px; background: var(--bg); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; color: var(--text-secondary);
  font-size: 2.5rem; flex-shrink: 0;
}
.product-card-info { flex: 1; }
.product-card-info h3 { font-size: 1.1rem; margin-bottom: 4px; }
.product-card-price { color: var(--success); font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.product-card-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.product-card-pros { margin-bottom: 16px; }
.product-card-pros li { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 4px; list-style: none; }
.product-card-pros li::before { content: '✓ '; color: var(--success); font-weight: 700; }
.product-card-cons li { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 4px; list-style: none; }
.product-card-cons li::before { content: '✗ '; color: var(--danger); font-weight: 700; }

/* Calculator */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.calc-form label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.9rem; }
.calc-form input, .calc-form select {
  width: 100%; padding: 12px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 1rem; font-family: var(--font);
  margin-bottom: 20px; outline: none;
}
.calc-form input:focus, .calc-form select:focus { border-color: var(--primary); }
.calc-result {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center;
}
.calc-big { font-size: 3rem; font-weight: 900; color: var(--success); }
.calc-label { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

/* Privacy Score */
.score-circle {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 1.1rem; flex-shrink: 0;
}
.score-a { background: rgba(0,255,136,0.15); color: var(--success); border: 2px solid var(--success); }
.score-b { background: rgba(0,180,216,0.15); color: var(--primary); border: 2px solid var(--primary); }
.score-c { background: rgba(255,193,7,0.15); color: var(--warning); border: 2px solid var(--warning); }
.score-d { background: rgba(255,136,0,0.15); color: #ff8800; border: 2px solid #ff8800; }
.score-f { background: rgba(255,68,68,0.15); color: var(--danger); border: 2px solid var(--danger); }

/* Article / Guide */
.article-layout { display: grid; grid-template-columns: 1fr 280px; gap: 40px; }
.article-content { min-width: 0; }
.article-content h1 { font-size: 2.4rem; font-weight: 800; margin-bottom: 16px; line-height: 1.2; }
.article-meta { display: flex; gap: 16px; align-items: center; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 32px; flex-wrap: wrap; }
.article-content h2 { font-size: 1.6rem; font-weight: 700; margin: 40px 0 16px; padding-top: 20px; border-top: 1px solid var(--border); }
.article-content h3 { font-size: 1.2rem; font-weight: 600; margin: 24px 0 12px; }
.article-content p { margin-bottom: 16px; color: var(--text); line-height: 1.8; }
.article-content ul, .article-content ol { margin-bottom: 16px; padding-left: 24px; }
.article-content li { margin-bottom: 8px; line-height: 1.7; }
.article-sidebar { position: sticky; top: 80px; }
.toc { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.toc h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); margin-bottom: 12px; }
.toc ul { list-style: none; }
.toc li { margin-bottom: 8px; }
.toc a { color: var(--text-secondary); font-size: 0.85rem; }
.toc a:hover { color: var(--primary); }
.breadcrumb { display: flex; gap: 8px; align-items: center; color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 24px; padding-top: 80px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb span { color: var(--text-secondary); }

/* Product Rec Box (in articles) */
.rec-box {
  background: var(--bg-card); border: 1px solid var(--primary); border-radius: var(--radius);
  padding: 24px; margin: 24px 0; display: flex; gap: 20px; align-items: center;
}
.rec-box-img {
  width: 100px; height: 100px; background: var(--bg); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 2rem; flex-shrink: 0;
}
.rec-box h4 { margin-bottom: 4px; }
.rec-box .price { color: var(--success); font-weight: 700; margin-bottom: 8px; }

/* FAQ */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  padding: 16px 0; font-weight: 600; cursor: pointer; display: flex;
  justify-content: space-between; align-items: center;
}
.faq-q::after { content: '+'; font-size: 1.4rem; color: var(--primary); transition: transform 0.2s; }
.faq-q.open::after { content: '−'; }
.faq-a { padding: 0 0 16px; color: var(--text-secondary); display: none; line-height: 1.7; }
.faq-a.open { display: block; }

/* Newsletter */
.newsletter {
  background: linear-gradient(135deg, rgba(0,180,216,0.1), rgba(0,119,182,0.1));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 48px; text-align: center; margin: 40px 0;
}
.newsletter h3 { font-size: 1.6rem; margin-bottom: 8px; }
.newsletter p { color: var(--text-secondary); margin-bottom: 24px; }
.newsletter-form { display: flex; gap: 12px; max-width: 460px; margin: 0 auto; }
.newsletter-form input {
  flex: 1; padding: 14px 20px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 1rem; font-family: var(--font);
  outline: none;
}
.newsletter-form button { white-space: nowrap; }

/* Feature Grid (landing) */
.feature-card { text-align: center; padding: 32px 24px; }
.feature-icon { font-size: 2.5rem; margin-bottom: 16px; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* Guide Card */
.guide-card { overflow: hidden; padding: 0; }
.guide-card-img {
  height: 180px; background: linear-gradient(135deg, var(--primary-dark), var(--bg));
  display: flex; align-items: center; justify-content: center; font-size: 3rem;
}
.guide-card-body { padding: 20px; }
.guide-card-body h3 { font-size: 1rem; margin-bottom: 8px; line-height: 1.4; }
.guide-card-meta { display: flex; gap: 12px; font-size: 0.8rem; color: var(--text-secondary); }

/* Score Bar */
.score-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }

/* Mobile */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.2rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .nav-links { display: none; position: fixed; top: 64px; left: 0; right: 0; background: var(--bg); flex-direction: column; padding: 20px; gap: 16px; border-bottom: 1px solid var(--border); }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; }
  .calc-grid { grid-template-columns: 1fr; }
  .product-card { flex-direction: column; }
  .rec-box { flex-direction: column; text-align: center; }
  .newsletter { padding: 32px 20px; }
  .newsletter-form { flex-direction: column; }
  .filter-bar { flex-direction: column; }
  .filter-bar select, .filter-bar input { width: 100%; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.8rem; }
  .section { padding: 48px 0; }
  .quiz-options { flex-direction: column; align-items: center; }
}

/* Utility */
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 32px; }
.hidden { display: none !important; }
