/* CalcGpt - Static Calculator Pages */
:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-focus: #111827;
  --text: #111827;
  --text-2: #4B5563;
  --text-3: #9CA3AF;
  --accent: #F59E0B;
  --accent-bg: #FFFBEB;
  --accent-hover: #D97706;
  --success: #059669;
  --success-bg: #ECFDF5;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

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

/* ===== HEADER ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.25rem;
}
.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  color: var(--text);
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.header-nav a {
  padding: 0.5rem 0.875rem;
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.header-nav a:hover {
  background: var(--bg);
  color: var(--text);
}
.header-search {
  position: relative;
  width: 280px;
}
.header-search input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.header-search input:focus {
  border-color: var(--border-focus);
}
.header-search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-bottom: 0.75rem;
}
.breadcrumb a {
  color: var(--text-3);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}
.breadcrumb span { margin: 0 0.375rem; }

/* ===== LAYOUT ===== */
.page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}
.calc-main { min-width: 0; }

/* ===== CATEGORY TAG ===== */
.cat-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cat-finance { background: #FEF3C7; color: #92400E; }
.cat-health { background: #FCE7F3; color: #9D174D; }
.cat-math { background: #E0E7FF; color: #3730A3; }
.cat-everyday { background: #F3E8FF; color: #6B21A8; }
.cat-conversion { background: #DBEAFE; color: #1E40AF; }
.cat-physics { background: #CFFAFE; color: #155E75; }
.cat-statistics { background: #FFE4E6; color: #9F1239; }

/* ===== CALCULATOR TITLE ===== */
.calc-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.375rem;
  letter-spacing: -0.02em;
}
.calc-subtitle {
  font-size: 0.9375rem;
  color: var(--text-2);
  margin-bottom: 1.5rem;
}

/* ===== CALCULATOR CARD ===== */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

/* ===== FORM ELEMENTS ===== */
.field-group {
  margin-bottom: 1.125rem;
}
.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}
.field-label .unit {
  font-weight: 400;
  color: var(--text-3);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.field-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}
.field-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(17,24,39,0.06);
}
.field-input::placeholder {
  color: var(--text-3);
}
.field-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color 0.15s;
}
.field-select:focus {
  border-color: var(--border-focus);
}
.field-hint {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.25rem;
}

/* ===== CALCULATE BUTTON ===== */
.btn-calculate {
  width: 100%;
  padding: 0.75rem;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: 0.5rem;
}
.btn-calculate:hover {
  background: #374151;
}
.btn-calculate:active {
  transform: scale(0.99);
}

/* ===== RESULT ===== */
.result-panel {
  margin-top: 1.25rem;
  background: var(--success-bg);
  border: 1px solid #A7F3D0;
  border-radius: var(--radius);
  padding: 1.25rem;
  display: none;
}
.result-panel.visible {
  display: block;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}
.result-row + .result-row {
  border-top: 1px solid #D1FAE5;
}
.result-label {
  font-size: 0.875rem;
  color: var(--text-2);
}
.result-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--success);
  font-family: var(--mono);
}
.result-primary .result-value {
  font-size: 1.5rem;
}

/* ===== FORMULA DISPLAY ===== */
.formula-box {
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.8;
}
.formula-box strong {
  color: var(--text);
  font-family: var(--font);
}

/* ===== CONTENT SECTION ===== */
.content-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.content-section h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}
.content-section h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.content-section p {
  color: var(--text-2);
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
}
.content-section ul, .content-section ol {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
  color: var(--text-2);
  font-size: 0.9375rem;
}
.content-section li {
  margin-bottom: 0.375rem;
}
.content-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}
.content-section th, .content-section td {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  text-align: left;
}
.content-section th {
  background: #F9FAFB;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-2);
}

/* ===== SIDEBAR ===== */
.sidebar { position: sticky; top: 80px; }

.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.sidebar-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}
.sidebar-links {
  list-style: none;
}
.sidebar-links li {
  margin-bottom: 0.125rem;
}
.sidebar-links a {
  display: block;
  padding: 0.5rem 0.625rem;
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.875rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-links a:hover {
  background: var(--bg);
  color: var(--text);
}
.sidebar-links a.active {
  background: var(--accent-bg);
  color: var(--accent-hover);
  font-weight: 600;
}
.sidebar-ad {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-3);
  font-size: 0.8125rem;
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 3rem;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-links {
  display: flex;
  gap: 1.5rem;
}
.footer-links a {
  font-size: 0.8125rem;
  color: var(--text-3);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--text);
}
.footer-copy {
  font-size: 0.8125rem;
  color: var(--text-3);
}

/* ===== MOBILE NAV TOGGLE ===== */
.mobile-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 0.375rem; cursor: pointer; color: var(--text); }

/* ===== SEARCH DROPDOWN ===== */
.header-search { position: relative; }
.search-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); max-height: 360px; overflow-y: auto; z-index: 200;
}
.search-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.625rem 0.875rem; text-decoration: none; color: var(--text);
  border-bottom: 1px solid #F3F4F6; font-size: 0.875rem; transition: background 0.1s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg); }
.search-name { font-weight: 500; }
.search-cat { font-size: 0.75rem; color: var(--text-3); text-transform: capitalize; }
.search-empty { padding: 1rem; text-align: center; color: var(--text-3); font-size: 0.875rem; }

/* ===== HOMEPAGE HERO ===== */
.hero {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 3.5rem 1.5rem 3rem; text-align: center;
}
.hero-inner { max-width: 680px; margin: 0 auto; }
.hero h1 { font-size: 2.5rem; font-weight: 900; letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 0.75rem; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.0625rem; color: var(--text-2); margin-bottom: 1.5rem; }
.hero-search { position: relative; max-width: 520px; margin: 0 auto; }
.hero-search input {
  width: 100%; padding: 0.875rem 1rem 0.875rem 2.75rem;
  border: 2px solid var(--border); border-radius: 12px; font-size: 1rem;
  font-family: var(--font); outline: none; transition: border-color 0.15s;
}
.hero-search input:focus { border-color: var(--text); }
.hero-search svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.hero-search .search-dropdown { top: calc(100% + 4px); border-radius: 12px; }
.hero-stats { display: flex; justify-content: center; gap: 2rem; margin-top: 1.25rem; font-size: 0.8125rem; color: var(--text-3); }
.hero-stats strong { color: var(--text); font-weight: 700; }

/* ===== CATEGORY GRID ===== */
.section { max-width: 1280px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.section-title { font-size: 1.375rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 1.25rem; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.cat-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; text-decoration: none;
  color: var(--text); transition: box-shadow 0.15s, transform 0.15s;
}
.cat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cat-card-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 0.75rem; font-size: 1.25rem; }
.cat-card-name { font-weight: 700; font-size: 0.9375rem; margin-bottom: 0.25rem; }
.cat-card-count { font-size: 0.8125rem; color: var(--text-3); }
.cat-card-desc { font-size: 0.8125rem; color: var(--text-2); margin-top: 0.375rem; }

/* ===== CALCULATOR GRID ===== */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.875rem; }
.calc-link {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; text-decoration: none;
  color: var(--text); transition: box-shadow 0.15s, border-color 0.15s;
}
.calc-link:hover { box-shadow: var(--shadow); border-color: #D1D5DB; }
.calc-link-name { font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.25rem; }
.calc-link-desc { font-size: 0.8125rem; color: var(--text-2); line-height: 1.4; }
.calc-link .coming-soon { font-size: 0.6875rem; color: var(--text-3); font-style: italic; }

/* ===== CATEGORY PAGE ===== */
.cat-hero { padding: 2rem 0 0.5rem; }
.cat-hero h1 { font-size: 1.75rem; font-weight: 800; }
.cat-hero p { color: var(--text-2); font-size: 0.9375rem; }

/* ===== ADMIN ===== */
.admin-wrap { max-width: 900px; margin: 2rem auto; padding: 0 1.5rem; }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem; }
.admin-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.admin-field { margin-bottom: 1rem; }
.admin-field label { display: block; font-size: 0.8125rem; font-weight: 600; margin-bottom: 0.375rem; color: var(--text-2); }
.admin-field input, .admin-field textarea {
  width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.875rem; font-family: var(--font); outline: none;
}
.admin-field textarea { font-family: var(--mono); font-size: 0.8125rem; min-height: 100px; resize: vertical; }
.admin-field input:focus, .admin-field textarea:focus { border-color: var(--border-focus); }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.25rem; border: none; border-radius: 8px; font-size: 0.875rem; font-weight: 600; font-family: var(--font); cursor: pointer; transition: background 0.15s; }
.btn-primary { background: var(--text); color: #fff; }
.btn-primary:hover { background: #374151; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }

/* ===== 404 ===== */
.page-404 { text-align: center; padding: 4rem 1.5rem; }
.page-404 h1 { font-size: 4rem; font-weight: 900; color: var(--text-3); }
.page-404 p { color: var(--text-2); margin: 0.5rem 0 1.5rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .calc-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 768px) {
  .header-search { display: none; }
  .header-nav { display: none; position: fixed; top: 64px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.75rem; flex-direction: column; z-index: 90; box-shadow: var(--shadow-md); }
  .header-nav.open { display: flex; }
  .header-nav a { padding: 0.75rem 1rem; }
  .mobile-toggle { display: block; }
  .hero h1 { font-size: 1.75rem; }
  .hero-stats { gap: 1rem; flex-wrap: wrap; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .calc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .page-wrapper { padding: 1.25rem 1rem; }
  .calc-title { font-size: 1.5rem; }
  .calc-card { padding: 1.25rem; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .header-inner { height: 56px; }
  .content-section { padding: 1.25rem; }
  .result-primary .result-value { font-size: 1.25rem; }
  .hero { padding: 2rem 1rem; }
  .cat-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
}
