/* ===== SafeFBAR Revised Theme (Modern & Lightweight) ===== */

/* --- 1. Globals & Fonts --- */
/* Using a lightweight, highly readable font. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette (Green-centric) */
  --accent: #0f7f3a;          /* Original Excel Green */
  --accent-hover: #0c6b30;    /* Darker green for hover */
  --accent-light: #e7f3eb;    /* Very light green for backgrounds */
  --text-primary: #212529;    /* Almost black for primary text */
  --text-secondary: #6c757d; /* Grey for secondary text */
  --bg-body: #f8f9fa;         /* Light grey for the page background */
  --bg-card: #ffffff;         /* Pure white for cards/panels */
  --border-color: #dee2e6;    /* Subtle border color */

  /* Sizing & Spacing */
  --radius: 8px;
  --radius-lg: 12px;
  --gap: 1rem;
  --transition: 0.2s ease-in-out;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text-primary);
  background-color: var(--bg-body);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* Accessibility Skip Link (unchanged) */
.skip-link{ position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; }
.skip-link:focus{
  left: 12px; top: 8px; width: auto; height: auto; padding: .3rem .5rem;
  background: var(--bg-card); border: 2px solid var(--accent); border-radius: var(--radius);
  z-index: 1000;
}


/* --- 2. Layout (Preserved from original) --- */

.site-frame {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}
.site-frame.wide {
  max-width: 1440px;
}
@media (min-width: 1700px) {
  .site-frame.wide {
    max-width: 1280px;
  }
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .2px;
  text-decoration: none;
  color: var(--text-primary);
}

.site-header nav {
  display: flex; /* This will be adjusted for mobile */
}

.site-header nav a {
  padding: .5rem .8rem;
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--text-secondary);
  transition: background-color var(--transition), color var(--transition);
}
.site-header nav a:hover {
  color: var(--text-primary);
  text-decoration: none;
  background-color: #e9ecef;
}
.site-header nav a[aria-current="page"] {
  background: var(--accent-light);
  text-decoration: none;
  font-weight: 600;
  color: var(--accent);
}

.site-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.04);
}

.panel-title {
  position: static;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: normal;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.bar {
  display: block;
  margin: 1.5rem 0 .8rem 0;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.1rem;
  background: none;
}

.list {
  list-style: none;
  padding: 0;
  margin: .5rem 0 1rem;
}
.list li {
  padding: .5rem 0;
  border-bottom: 1px solid #f1f3f5;
}
.list li:last-child {
  border-bottom: none;
}

/* Grids (Preserved from original) */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.equal { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--gap); align-items: stretch; }
@media(max-width: 900px) { .grid-2, .equal { grid-template-columns: 1fr; grid-auto-flow: row; } }
.equal > div { display: grid; }
.equal > div .card { height: 100%; }

/* Calculator Grid (Preserved from original) */
.grid-calculator {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap, 1rem);
  align-items: end;
}
@media (max-width: 900px) {
  .grid-calculator {
    grid-template-columns: 1fr;
  }
}


/* --- 3. Components (Restyled) --- */

.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--bg-card);
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}
.ctas {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .6rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all var(--transition);
}
.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}
.btn:active {
  transform: translateY(0);
  box-shadow: none;
}
.btn-lg {
  font-size: 1.05rem;
  padding: .75rem 1.2rem;
}

.stat, .note, .muted {
  color: var(--text-secondary);
  font-size: .9rem;
}

.input, select {
  width: 100%;
  height: auto;
  padding: .6rem .8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: #fff;
  outline: none;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, select:focus {
  box-shadow: 0 0 0 3px var(--accent-light);
  border-color: var(--accent);
}
.input.tinted {
  background: var(--accent-light);
}
textarea.input {
  min-height: 140px;
}

/* Tables */
.table-wrap {
  margin-top: 1rem;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-card);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
thead th {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  text-align: left;
  padding: .75rem .8rem;
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
  font-size: .85rem;
  text-transform: uppercase;
  color: var(--text-secondary);
}
th, td {
  padding: .65rem .8rem;
  border-bottom: 1px solid #f1f3f5;
  white-space: nowrap;
}
tbody tr:last-child th, tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background-color: var(--accent-light);
}
.table-condensed thead th, .table-condensed td {
  padding: .5rem .6rem;
  font-size: 14px;
}

/* FAQ */
.faq {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin: .6rem 0;
  padding: 0;
  background: var(--bg-card);
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: .8rem 1rem;
  transition: background-color var(--transition);
}
.faq summary:hover {
  background-color: #f8f9fa;
}
.faq[open] summary {
  background-color: var(--accent-light);
  color: var(--accent);
}
.faq > *:not(summary) {
  margin: 0;
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  line-height: 1.7;
}

/* Blue link (for specific external links) */
.link-blue {
  color: #007bff;
  text-decoration: underline;
}
.link-blue:hover {
  color: #0056b3;
}

/* Footer */
.site-footer {
  padding: 2rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
  color: var(--text-secondary);
  font-size: .9rem;
}


/* --- 4. Forms & Guides (Preserved Layout) --- */

.field { margin: .75rem 0; }
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
  font-size: .9rem;
  color: var(--text-secondary);
}
label.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: .25rem;
  font-weight: 400;
  font-size: 1rem;
  color: var(--text-primary);
}
label.checkbox input { margin: 0; }
label.checkbox span { white-space: nowrap; }
@media (max-width: 420px){
  body.contact-page label.checkbox span{ white-space: normal; }
}

/* Calculator display boxes */
.display-box {
  background: #f1f3f5;
  padding: .6rem .7rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.2rem;
  border: 1px solid #ced4da;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}
.result-container {
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding-left: .7rem;
  padding-right: .3rem;
  min-height: 44px;
}
.result-container h3 {
  margin: 0;
  flex-grow: 1;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .4rem;
  border: none;
  background: #e9ecef;
  border-radius: 6px;
  cursor: pointer;
  opacity: .8;
  transition: opacity var(--transition), background-color var(--transition);
}
.btn-copy:hover {
  background: #dee2e6;
  opacity: 1;
}
.btn-copy svg {
  width: 16px;
  height: 16px;
  fill: #333;
}

/* Guides Pages */
.guides-root { max-width: 980px; margin: 0 auto; padding: 0; }
.guides-hero { margin: .6rem 0 1.5rem; }
.guides-hero h1 { margin: 0 0 .4rem; line-height: 1.25; font-size: 2rem; }
.guides-hero p { margin: .2rem 0 0; opacity: .9; font-size: 1.1rem; color: var(--text-secondary); }

.guides-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}
@media (max-width: 900px) { .guides-list { grid-template-columns: 1fr; } }

.guides-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 1rem 1.25rem;
  box-shadow: none;
  transition: all var(--transition);
}
.guides-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.07);
  border-color: var(--accent);
}
.guides-item a { text-decoration: none; font-weight: 600; display: inline-block; margin-bottom: .2rem; }
.guides-item .desc { font-size: .94rem; opacity: .9; color: var(--text-secondary); }

.guide-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .5rem;
  font-size: .92rem;
  opacity: .9;
  margin: .3rem 0 1rem;
}
.guide-breadcrumb a { text-decoration: underline; }

.guide-article { max-width: 820px; margin: 0 auto; padding: 0; }
.guide-article h1 { margin: 0 0 .6rem; line-height: 1.25; }
.guide-intro { margin: 0 0 1rem; opacity: .95; }

.guide-article article { font-size: 1rem; line-height: 1.7; }
.guide-article h2 { margin: 1.5rem 0 .5rem; }
.guide-article h3 { margin: 1.2rem 0 .4rem; }
.guide-article p { margin: .5rem 0; }
.guide-article ul, .guide-article ol { padding-left: 1.25rem; margin: .5rem 0 .7rem; }
.guide-article blockquote {
  margin: .8rem 0;
  padding: .8rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  border-radius: 6px;
}

.guide-related {
  margin-top: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: #f8f9fa;
}
.guide-related h3 { margin: 0 0 .5rem; }
.guide-related ul { margin: 0; padding-left: 1.1rem; }
.guide-related li { margin: .25rem 0; }

.guide-actions { margin-top: 1.5rem; display: flex; gap: .6rem; flex-wrap: wrap; }

/* 下拉选择框：灰色背景 */
select {
  background-color: #f0f0f0;  /* 浅灰 */
  border: 1px solid #ccc;
  padding: 6px 8px;
  border-radius: 4px;
}

.panel-title {
  font-size: 1.4rem; /* 主标题 */
  font-weight: 600;
}
.panel-title small {
  font-size: 0.9rem; /* 副标题小一些 */
  color: #555;       /* 用次要色 */
  font-weight: 400;
  margin-left: .3rem;
}

/* --- 5. Responsive Navigation (NEW) --- */

/* Hamburger Menu Button (hidden on desktop) */
.nav-toggle {
  display: none;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  width: 25px;
  height: 20px;
  z-index: 1010; /* Ensure it's above other header elements */
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  background-color: var(--text-primary);
  height: 3px;
  width: 25px;
  border-radius: 3px;
  position: relative;
  transition: all var(--transition);
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  position: absolute;
}

.nav-toggle span::before {
  top: -8px;
}

.nav-toggle span::after {
  top: 8px;
}

/* Mobile Navigation Styles */
@media (max-width: 900px) {
  .site-header {
    position: relative; /* Needed for absolute positioning of nav */
  }

  .site-header nav {
    display: none; /* Hide nav by default */
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    align-items: flex-start;
    padding: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  }

  .site-header nav.active {
    display: flex; /* Show nav when active */
  }

  .site-header nav a {
    width: 100%;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
  }
  
  .site-header nav a:last-child {
    border-bottom: none;
  }

  .nav-toggle {
    display: block; /* Show hamburger button */
  }

  /* Animation for hamburger button when menu is open */
  .nav-open .nav-toggle span {
    background-color: transparent; /* Middle bar disappears */
  }

  .nav-open .nav-toggle span::before {
    transform: rotate(45deg);
    top: 0;
  }

  .nav-open .nav-toggle span::after {
    transform: rotate(-45deg);
    top: 0;
  }
}
