/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --dark: #1f2937;
  --gray: #6b7280;
  --light-gray: #f3f4f6;
  --white: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--light-gray);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== Header ===== */
.header {
  background: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  color: var(--dark);
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 2.5rem 0.6rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 999px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
}

.search-box button {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  padding: 0.3rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-weight: 500;
  color: var(--gray);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--dark);
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  color: var(--white);
  padding: 3rem 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.hero p {
  opacity: 0.9;
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== Category Section ===== */
.category-section {
  margin-bottom: 2.5rem;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.category-header h2 {
  font-size: 1.3rem;
  color: var(--dark);
}

.category-header .icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.bg-blue { background: #dbeafe; color: #1d4ed8; }
.bg-green { background: #d1fae5; color: #047857; }
.bg-orange { background: #ffedd5; color: #c2410c; }
.bg-purple { background: #f3e8ff; color: #7c3aed; }
.bg-red { background: #fee2e2; color: #b91c1c; }

/* ===== Tool Grid ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.tool-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  overflow-wrap: break-word;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.tool-card h3 {
  font-size: 1rem;
  color: var(--dark);
}

.tool-card p {
  font-size: 0.85rem;
  color: var(--gray);
  line-height: 1.5;
  flex: 1;
}

.tool-card .tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--light-gray);
  color: var(--gray);
  width: fit-content;
}

/* ===== Tool Page ===== */
.tool-page {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
}

.tool-page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.tool-page-header h1 {
  font-size: 1.6rem;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.tool-page-header p {
  color: var(--gray);
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 0.75rem;
}

.breadcrumb a {
  color: var(--primary);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 2px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--light-gray);
  color: var(--dark);
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ===== Result Box ===== */
.result-box {
  background: #f0f9ff;
  border-left: 4px solid var(--primary);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  margin-top: 1.5rem;
  display: none;
}

.result-box.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.result-box h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--dark);
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #cbd5e1;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item .label {
  color: var(--gray);
}

.result-item .value {
  font-weight: 700;
  color: var(--dark);
}

.result-highlight {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

/* ===== Tables ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.data-table th {
  background: var(--light-gray);
  font-weight: 600;
  color: var(--dark);
}

.data-table tr:hover td {
  background: #f9fafb;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-weight: 600;
  color: var(--gray);
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--gray);
  font-size: 0.9rem;
  border-top: 1px solid #e5e7eb;
  margin-top: 2rem;
  background: var(--white);
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .mobile-menu-btn {
    display: block;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .tool-grid {
    grid-template-columns: 1fr;
  }
  .tool-page {
    margin: 1rem;
    padding: 1.25rem;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Calculator Styles ===== */
.calc-display {
  background: var(--dark);
  color: var(--white);
  padding: 1rem;
  border-radius: var(--radius-sm);
  text-align: right;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  min-height: 60px;
  word-break: break-all;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.calc-btn {
  padding: 1rem;
  font-size: 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--light-gray);
  transition: all 0.15s;
}

.calc-btn:hover {
  background: #e5e7eb;
}

.calc-btn.operator {
  background: #dbeafe;
  color: var(--primary);
}

.calc-btn.operator:hover {
  background: #bfdbfe;
}

.calc-btn.equals {
  background: var(--primary);
  color: var(--white);
  grid-column: span 2;
}

.calc-btn.equals:hover {
  background: var(--primary-dark);
}

.calc-btn.clear {
  background: #fee2e2;
  color: var(--danger);
}

.calc-btn.clear:hover {
  background: #fecaca;
}

/* ===== Progress / Gauge ===== */
.gauge-container {
  position: relative;
  width: 200px;
  height: 100px;
  margin: 1rem auto;
}

.gauge-bg {
  fill: none;
  stroke: #e5e7eb;
  stroke-width: 20;
}

.gauge-fill {
  fill: none;
  stroke-width: 20;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

/* ===== Finance tool compatibility ===== */
.result-card {
  background: #f0f9ff;
  border-left: 4px solid var(--primary);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  margin-top: 1.5rem;
  display: none;
}

.result-card.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.result-grid .result-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.6rem 0;
  border-bottom: 1px dashed #cbd5e1;
}

.result-grid .result-item:last-child {
  border-bottom: none;
}

.result-label {
  font-size: 0.85rem;
  color: var(--gray);
}

.result-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ===== SEO Content Sections ===== */
.seo-content {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}
.seo-content h2 {
  font-size: 1.25rem;
  color: var(--dark);
  margin: 1.5rem 0 0.75rem;
}
.seo-content h3 {
  font-size: 1.05rem;
  color: var(--dark);
  margin: 1.25rem 0 0.5rem;
}
.seo-content p {
  color: var(--gray);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.seo-content ol,
.seo-content ul {
  margin-left: 1.25rem;
  color: var(--gray);
  line-height: 1.8;
}
.seo-content details {
  background: var(--light-gray);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}
.seo-content summary {
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
}
.seo-content details[open] summary {
  margin-bottom: 0.5rem;
}

/* ===== Related Tools ===== */
.related-tools {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}
.related-tools h3 {
  font-size: 1.1rem;
  color: var(--dark);
  margin-bottom: 1rem;
}
.related-tools .tool-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.related-tools .tool-card {
  padding: 1rem;
}
.related-tools .tool-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}
.related-tools .tool-card p {
  font-size: 0.8rem;
}

/* ===== Breadcrumb microdata styling ===== */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 0.75rem;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0;
}
.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.breadcrumb li:not(:last-child)::after {
  content: ">";
  margin-left: 0.25rem;
  color: #cbd5e1;
}
.breadcrumb a {
  color: var(--primary);
}
.breadcrumb a:hover {
  text-decoration: underline;
}

/* ===== Inline validation ===== */
.input-error {
  border-color: var(--danger) !important;
}
.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ===== Strength meter ===== */
.strength-meter {
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
  overflow: hidden;
  margin-top: 0.5rem;
}
.strength-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background 0.3s ease;
}
.strength-weak { background: var(--danger); }
.strength-fair { background: #f97316; }
.strength-good { background: #eab308; }
.strength-strong { background: var(--secondary); }

