/* =============================================
   Nexus Calculator — style.css
   Aesthetic: Refined Utility / Financial-Grade
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&family=Playfair+Display:wght@600&display=swap');

/* ── Variables ─────────────────────────────── */
:root {
  --navy:        #0f1e36;
  --navy-mid:    #162844;
  --navy-light:  #1e3a5f;
  --accent:      #2563eb;
  --accent-soft: #3b82f6;
  --accent-glow: rgba(37, 99, 235, 0.15);
  --gold:        #c9a84c;
  --surface:     #ffffff;
  --surface-2:   #f6f8fb;
  --surface-3:   #eef2f8;
  --border:      #dde3ee;
  --text-primary:   #0f1e36;
  --text-secondary: #4a5568;
  --text-muted:     #8896ab;
  --sidebar-w: 260px;
  --topbar-h:  56px;
  --header-h:  68px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15,30,54,.07), 0 1px 2px rgba(15,30,54,.05);
  --shadow:    0 4px 16px rgba(15,30,54,.09), 0 1px 4px rgba(15,30,54,.06);
  --shadow-lg: 0 8px 32px rgba(15,30,54,.12), 0 2px 8px rgba(15,30,54,.07);
  --transition: 0.18s ease;
}

/* ── Reset / Base ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }


body {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-soft); }

h1, h2, h3, h4 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

/* ── Header ────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--navy);
  height: var(--header-h);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.site-header .container-fluid {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #fff;
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.brand-name span {
  color: var(--gold);
}

/* Search bar in header */
.header-search {
  flex: 1;
  max-width: 440px;
  margin: 0 auto;
  position: relative;
}

.header-search input {
  width: 100%;
  height: 38px;
  padding: 0 1rem 0 2.6rem;
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}

.header-search input::placeholder { color: rgba(255,255,255,.45); }
.header-search input:focus {
  border-color: var(--accent-soft);
  background: rgba(255,255,255,.12);
}

.header-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%; transform: translateY(-50%);
  color: rgba(255,255,255,.45);
  font-size: 0.85rem;
  pointer-events: none;
}

/* search dropdown */
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 2000;
  display: none;
}

.search-results-dropdown.open { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--surface-3);
  transition: background var(--transition);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-2); }

.search-result-item .result-category {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-result-item .result-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: 1.1rem;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}

.btn-sidebar-toggle:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

/* ── Category Top Bar ──────────────────────── */
.category-topbar {
  background: var(--navy-mid);
  border-bottom: 1px solid rgba(255,255,255,.08);
  overflow-x: auto;
  scrollbar-width: none;
}

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

.category-topbar .container-fluid {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 1.5rem;
  white-space: nowrap;
}

.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1rem;
  height: var(--topbar-h);
  color: rgba(255,255,255,.65);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.02em;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.cat-tab:hover {
  color: #fff;
  border-bottom-color: rgba(255,255,255,.3);
}

.cat-tab.active {
  color: #fff;
  border-bottom-color: var(--gold);
}

.cat-tab i { font-size: 0.78rem; opacity: 0.7; }

/* ── Layout ────────────────────────────────── */
.page-layout {
  display: flex;
  min-height: calc(100vh - var(--header-h) - var(--topbar-h) - 64px);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
}

/* ── Sidebar ───────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: calc(var(--header-h) + var(--topbar-h));
  height: calc(100vh - var(--header-h) - var(--topbar-h));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 1.25rem 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 1.25rem;
  font-size: 0.86rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all var(--transition);
}

.sidebar-link:hover {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
}

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-link i {
  font-size: 0.78rem;
  width: 14px;
  text-align: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-link:hover i,
.sidebar-link.active i { color: var(--accent); }

.sidebar-link .badge-new {
  margin-left: auto;
  font-size: 0.62rem;
  background: var(--accent);
  color: #fff;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Main Content Area ─────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2rem 3rem;
}

/* ── Cards ─────────────────────────────────── */
.calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.calc-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: #c8d5e8;
}

.calc-card .card-body {
  padding: 1.25rem 1.25rem 0.75rem;
  flex: 1;
}

.calc-card .card-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.calc-card .card-title a {
  color: var(--text-primary);
  transition: color var(--transition);
}

.calc-card .card-title a:hover { color: var(--accent); }

.calc-card .card-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.calc-card .card-footer {
  padding: 0.75rem 1.25rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* ── Calculator Detail ─────────────────────── */
.calc-detail-header {
  margin-bottom: 2rem;
}

.calc-detail-header h1 {
  font-size: 1.65rem;
  margin-bottom: 0.4rem;
}

.breadcrumb {
  font-size: 0.82rem;
  background: none;
  padding: 0;
  margin-bottom: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: var(--text-muted);
}

.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item a:hover { color: var(--accent); }
.breadcrumb-item.active { color: var(--text-secondary); }

.calc-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
}

.calc-widget-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* ── Calculator Widget Inputs (from html_content) */
.calculator-container label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.calculator-container input[type="number"],
.calculator-container input[type="text"],
.calculator-container select {
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  padding: 0 0.85rem;
  width: 100%;
  background: var(--surface-2);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.calculator-container input:focus,
.calculator-container select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}

.calculator-container button,
.calculator-container input[type="submit"],
.calculator-container input[type="button"] {
  height: 40px;
  padding: 0 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
}

.calculator-container button:hover,
.calculator-container input[type="submit"]:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

.calculator-container .result,
.calculator-container #result,
.calculator-container .output,
.calculator-container [id*="result"] {
  background: var(--navy);
  color: #e8f0ff;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.92rem;
  margin-top: 1rem;
  min-height: 48px;
}

/* ── Hero (Home) ───────────────────────────── */
.home-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2.5rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(37,99,235,.25) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  color: #fff;
  margin-bottom: 0.75rem;
}

.home-hero p {
  color: rgba(255,255,255,.7);
  font-size: 1rem;
  max-width: 520px;
  margin-bottom: 1.75rem;
}

.home-hero .btn-hero {
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.75rem;
  border-radius: 8px;
  border: none;
  text-decoration: none;
  transition: opacity var(--transition), transform var(--transition);
  display: inline-block;
}

.home-hero .btn-hero:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  color: var(--navy);
}

/* stat chips */
.stat-chips {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

.stat-chip {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: rgba(255,255,255,.9);
  font-size: 0.82rem;
}

.stat-chip strong { color: #fff; display: block; font-size: 1.15rem; }

/* category cards on home */
.category-grid { margin-bottom: 2rem; }

.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.cat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.cat-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--accent-glow);
  color: var(--accent);
}

.cat-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.cat-card-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Section Titles ────────────────────────── */
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

/* ── Buttons ───────────────────────────────── */
.btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  border-radius: 7px;
  transition: background var(--transition), box-shadow var(--transition);
}

.btn-primary:hover {
  background: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

/* ── Footer ────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.6);
  padding: 2.5rem 0 1.5rem;
  margin-top: auto;
}

.site-footer .footer-brand {
  font-family: 'Playfair Display', serif;
  color: #fff;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.site-footer .footer-tagline {
  font-size: 0.8rem;
  color: rgba(255,255,255,.45);
}

.site-footer .footer-links a {
  color: rgba(255,255,255,.55);
  font-size: 0.82rem;
  margin-right: 1rem;
  transition: color var(--transition);
}

.site-footer .footer-links a:hover { color: #fff; }

.footer-divider {
  border-color: rgba(255,255,255,.1);
  margin: 1.5rem 0 1rem;
}

.footer-copy {
  font-size: 0.78rem;
  color: rgba(255,255,255,.35);
  text-align: center;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    top: 0; left: -100%;
    height: 100vh;
    z-index: 1025;
    transition: left 0.28s ease;
    padding-top: 1rem;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { left: 0; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1024;
  }

  .sidebar-overlay.open { display: block; }

  .btn-sidebar-toggle { display: inline-flex; }

  .main-content { padding: 1.25rem 1rem 2rem; }
}

@media (max-width: 768px) {
  .home-hero { padding: 2rem 1.5rem; }
  .home-hero h1 { font-size: 1.65rem; }
  .header-search { max-width: none; }
  .brand-name { font-size: 1rem; }
}

@media (max-width: 576px) {
  .calc-widget-wrapper { padding: 1.25rem; }
  .calc-intro { padding: 1rem 1.1rem; }
}

/* ── Utilities ─────────────────────────────── */
.text-mono { font-family: 'DM Mono', monospace; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
  opacity: .35;
}

/* Page enter animation */
.main-content { animation: fadeUp 0.22s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
