/* ========================================
   CalcWise Pro - Complete Design System
   Light, Clean, AdSense-Friendly Design
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #0ea5e9;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --bg-white: #ffffff;
  --bg-light: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.10);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --transition: 0.2s ease;
  --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-main);
  background: var(--bg-light);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

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

/* ========== HEADER ========== */
.site-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

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

.main-nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-light);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 6px 16px;
  gap: 8px;
  transition: border-color var(--transition);
}

.search-box:focus-within { border-color: var(--primary); }

.search-box input {
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-main);
  font-size: 0.88rem;
  color: var(--text-primary);
  width: 180px;
}

.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  box-shadow: var(--shadow-md);
}

.mobile-menu.open { display: block; }

.mobile-menu .nav-link {
  display: block;
  padding: 10px 14px;
  margin-bottom: 4px;
}

/* ========== BREADCRUMB ========== */
.breadcrumb {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  padding: 10px 0;
}

.breadcrumb-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.breadcrumb-inner a { color: var(--text-secondary); }
.breadcrumb-inner a:hover { color: var(--primary); }
.breadcrumb-inner span { color: var(--text-primary); font-weight: 500; }

/* ========== HERO ========== */
.hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 50%, #ecfdf5 100%);
  padding: 64px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(37,99,235,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner { max-width: 760px; margin: 0 auto; position: relative; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.hero-search {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
  background: var(--bg-white);
  border: 2px solid var(--border);
  border-radius: 50px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition);
}

.hero-search:focus-within { border-color: var(--primary); }

.hero-search input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  outline: none;
  font-family: var(--font-main);
  font-size: 0.95rem;
  background: none;
  color: var(--text-primary);
}

.hero-search button {
  padding: 10px 24px;
  margin: 6px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.hero-search button:hover { background: var(--primary-dark); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.stat-item { text-align: center; }

.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ========== AD SPACES ========== */
.ad-space {
  background: var(--bg-white);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  overflow: hidden;
}

.ad-banner { width: 100%; min-height: 90px; margin: 24px 0; }
.ad-rectangle { width: 100%; min-height: 280px; }
.ad-leaderboard { width: 100%; min-height: 90px; }

/* ========== MAIN LAYOUT ========== */
.main-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px;
}

.content-sidebar-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}

.main-content { min-width: 0; }

.sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========== SECTION TITLES ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
  border-radius: 2px;
  display: block;
}

.view-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

/* ========== CATEGORY TABS ========== */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  padding: 8px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.cat-tab:hover, .cat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ========== TOOL CARDS GRID ========== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.tool-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tool-card:hover::before { transform: scaleX(1); }

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.card-icon.blue { background: #dbeafe; }
.card-icon.green { background: #d1fae5; }
.card-icon.orange { background: #fef3c7; }
.card-icon.purple { background: #ede9fe; }
.card-icon.red { background: #fee2e2; }
.card-icon.teal { background: #ccfbf1; }

.card-content { flex: 1; }

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 50px;
  background: var(--primary-light);
  color: var(--primary);
}

.card-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}

.tool-card:hover .card-arrow {
  background: var(--primary);
  color: white;
}

/* ========== CALCULATOR TOOL PAGE ========== */
.tool-page-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
}

.tool-page-hero .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.tool-hero-top {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}

.tool-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}

.tool-hero-info h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.tool-hero-info p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 600px;
}

.tool-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.meta-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ========== CALCULATOR WIDGET ========== */
.calculator-wrapper {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 28px;
}

.calc-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-header h2 {
  color: white;
  font-size: 1rem;
  font-weight: 700;
}

.calc-header .calc-header-actions {
  display: flex;
  gap: 8px;
}

.calc-action-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  color: white;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.calc-action-btn:hover { background: rgba(255,255,255,0.3); }

.calc-body { padding: 28px; }

/* Input Groups */
.input-group {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-light);
  transition: border-color var(--transition);
  outline: none;
}

.input-field:focus { border-color: var(--primary); background: var(--bg-white); }

.input-field.mono { font-family: var(--font-mono); font-size: 1.1rem; }

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.select-field {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-light);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.select-field:focus { border-color: var(--primary); }

/* Calc Buttons */
.calc-btn {
  padding: 13px 28px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.calc-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.calc-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37,99,235,0.4);
}

.calc-btn-secondary {
  background: var(--bg-light);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.calc-btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Result Box */
.result-box {
  background: linear-gradient(135deg, #f0f9ff 0%, #eff6ff 100%);
  border: 1.5px solid var(--primary-light);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
  display: none;
}

.result-box.show { display: block; }

.result-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.result-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 12px;
}

.result-breakdown {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.85rem;
}

.result-table th {
  background: rgba(37,99,235,0.08);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
}

.result-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.result-table tr:last-child td { border-bottom: none; }

/* ========== BASIC CALCULATOR (SPECIAL) ========== */
.basic-calc-display {
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.display-expression {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #64748b;
  min-height: 20px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.display-value {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 500;
  color: white;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
}

.basic-calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.calc-key {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.calc-key:active { transform: scale(0.95); }

.key-num { background: #f8fafc; color: var(--text-primary); }
.key-num:hover { background: #e2e8f0; }
.key-op { background: #dbeafe; color: var(--primary); }
.key-op:hover { background: #bfdbfe; }
.key-fn { background: #f1f5f9; color: var(--text-secondary); }
.key-fn:hover { background: #e2e8f0; }
.key-eq { background: var(--primary); color: white; }
.key-eq:hover { background: var(--primary-dark); }
.key-clear { background: #fee2e2; color: var(--danger); }
.key-clear:hover { background: #fecaca; }

/* ========== CONTENT ARTICLE ========== */
.content-article {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}

.content-article h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.content-article h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 20px 0 12px;
}

.content-article p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 14px;
}

.content-article ul, .content-article ol {
  padding-left: 20px;
  margin-bottom: 16px;
}

.content-article li {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 6px;
}

.formula-box {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.info-card {
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--border-light);
}

.info-card .info-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.info-card .info-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== FAQ SECTION ========== */
.faq-section { margin-bottom: 24px; }

.faq-item {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  padding: 16px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  transition: background var(--transition);
}

.faq-question:hover { background: var(--bg-light); }

.faq-arrow {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition);
  font-size: 12px;
  color: var(--text-muted);
}

.faq-item.open .faq-arrow { transform: rotate(180deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer { max-height: 500px; }

.faq-answer-inner {
  padding: 0 20px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  border-top: 1px solid var(--border-light);
  padding-top: 14px;
}

/* ========== RELATED TOOLS ========== */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.related-tool-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
  text-decoration: none;
}

.related-tool-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateX(4px);
}

.related-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.related-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== SIDEBAR WIDGETS ========== */
.sidebar-widget {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.widget-body { padding: 16px 18px; }

.popular-list { list-style: none; }

.popular-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}

.popular-list li:last-child { border-bottom: none; }

.popular-rank {
  width: 22px;
  height: 22px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.popular-name {
  flex: 1;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--transition);
}

.popular-list li:hover .popular-name { color: var(--primary); }

/* ========== SOCIAL SHARE ========== */
.social-share {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 0;
}

.share-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.share-fb { background: #1877f2; color: white; }
.share-fb:hover { background: #0d65d9; color: white; }
.share-tw { background: #000; color: white; }
.share-tw:hover { background: #333; color: white; }
.share-wa { background: #25d366; color: white; }
.share-wa:hover { background: #20ba5a; color: white; }
.share-li { background: #0a66c2; color: white; }
.share-li:hover { background: #0956a5; color: white; }
.share-copy { background: var(--bg-light); color: var(--text-secondary); border: 1.5px solid var(--border); }
.share-copy:hover { border-color: var(--primary); color: var(--primary); }

/* ========== PAGES ========== */
.page-content {
  max-width: 800px;
  margin: 0 auto;
}

.page-hero {
  text-align: center;
  padding: 48px 0 32px;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.page-hero p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ========== FOOTER ========== */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  margin-top: 64px;
}

.footer-top {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 20px 40px;
  display: grid;
  grid-template-columns: 280px repeat(3, 1fr);
  gap: 48px;
}

.footer-brand .logo-text { color: white; }

.footer-brand p {
  font-size: 0.88rem;
  line-height: 1.7;
  margin: 12px 0 20px;
  color: #64748b;
}

.footer-social { display: flex; gap: 10px; }

.social-icon {
  width: 36px;
  height: 36px;
  background: #1e293b;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 16px;
  transition: all var(--transition);
  text-decoration: none;
}

.social-icon:hover { background: var(--primary); color: white; }

.footer-col h4 {
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.footer-col ul { list-style: none; }

.footer-col li { margin-bottom: 10px; }

.footer-col a {
  font-size: 0.85rem;
  color: #64748b;
  transition: color var(--transition);
}

.footer-col a:hover { color: #94a3b8; }

.footer-bottom {
  border-top: 1px solid #1e293b;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-bottom-links {
  display: flex;
  gap: 20px;
}

.footer-bottom-links a { color: #64748b; }
.footer-bottom-links a:hover { color: #94a3b8; }

/* ========== UTILITY ========== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }

/* ========== SEARCH RESULTS ========== */
#search-results {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

#search-results.show { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}

.search-result-item:hover { background: var(--bg-light); }

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

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .content-sidebar-layout {
    grid-template-columns: 1fr;
  }
  .sidebar { position: static; }
  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .main-nav, .header-search { display: none; }
  .hamburger { display: flex; align-items: center; }

  .hero { padding: 40px 20px; }
  .hero-stats { gap: 20px; }
  .stat-number { font-size: 1.3rem; }

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

  .input-row { grid-template-columns: 1fr; }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer-brand { grid-column: 1 / -1; }

  .content-article { padding: 20px; }
  .calc-body { padding: 20px; }

  .basic-calc-buttons { gap: 7px; }
  .calc-key { padding: 13px 8px; font-size: 1rem; }
  .display-value { font-size: 1.8rem; }

  #search-results { width: calc(100vw - 40px); }
}

@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .footer-top { grid-template-columns: 1fr; }

  .social-share { gap: 7px; }
  .share-btn { padding: 6px 10px; font-size: 0.74rem; }
  .related-tools { grid-template-columns: 1fr; }
}

/* ========== PRINT ========== */
@media print {
  .site-header, .site-footer, .sidebar, .ad-space, .social-share { display: none; }
  .content-sidebar-layout { display: block; }
}
