/* =====================================================================
   AutoCAD 2024 Scaling & Units — Shared Stylesheet
   Loaded by all 26 pages via <link rel="stylesheet" href="shared.css">
   Page-specific styles remain inline in each HTML file.
   ===================================================================== */

/* ── SITE NAV ── */
.site-nav {
  background: #112444;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.snav-link {
  color: #B8D4F0;
  text-decoration: none;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  border-right: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.15s;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
.snav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.snav-link.active { background: var(--orange); color: #fff; }

/* ── BACK TO TOP ── */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 48px;
  height: 48px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(0,0,0,0.30);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: background 0.15s, transform 0.15s;
  line-height: 1;
}
.back-to-top:hover { background: #c96a1a; transform: translateY(-3px); }
.back-to-top.visible { display: flex; }

/* ── DARK MODE ── */
body.dark {
  --dark-blue:   #0a1f38;
  --mid-blue:    #163d6e;
  --accent-blue: #2E7DC8;
  --light-blue:  #1a2d45;
  --xlight-blue: #162336;
  --orange:      #E07B2A;
  --dark-grey:   #e0e6ef;
  --mid-grey:    #a0aec0;
  --grid-line:   #2a4060;
  --white:       #1e2d42;
  --bg:          #111c2b;
  --card-bg:     #182334;
  --text:        #d0dff0;
  --label-color: #7baed6;
  --input-bg:    #1a2d42;
  --input-border:#2a4060;
  background: #111c2b !important;
  color: #d0dff0 !important;
}
body.dark .page { background: #182334 !important; color: #d0dff0 !important; }
body.dark thead th { background: #0a1f38; }
body.dark tbody tr:nth-child(even) td { background: #1a2a3d; }
body.dark tbody tr:hover td { background: #1f3450; }
body { transition: background 0.2s, color 0.2s; }
.dark-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: #B8D4F0;
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.dark-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ====== MOBILE OPTIMIZATION (iPhone / Android) ====== */
/* MOBILE-GLOBAL-OPT */
@media (max-width: 768px) {
  /* Layout foundation */
  body { padding: 0 !important; font-size: 13px; -webkit-text-size-adjust: 100%; }
  .page { border-radius: 0 !important; box-shadow: none !important; min-height: 100dvh; }

  /* Header */
  .page-header {
    padding: 10px 14px !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
  .page-header > div:first-child { flex: 0 0 100% !important; text-align: center !important; min-width: 0; }
  .page-header h1 { font-size: 15px !important; white-space: normal !important; overflow: visible !important; text-overflow: unset !important; }
  .page-header .sub { font-size: 10px !important; }
  .page-header .tag { display: none !important; }
  .page-header .dark-toggle { margin-left: 0 !important; }
  .page-header .pdf-btn { display: inline-flex !important; }
  .page-header > div:first-child > div { justify-content: center !important; }

  /* Compact dark/install buttons */
  .dark-toggle {
    padding: 7px 10px !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* Hamburger button (injected by JS) */
  .nav-hamburger {
    background: none;
    border: 1px solid rgba(255,255,255,0.4);
    color: #B8D4F0;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    font-family: inherit;
    min-width: 44px;
    min-height: 36px;
  }

  /* Nav rows: hidden by default, full-width stacked when open */
  .site-nav:not(.mobile-open) { display: none !important; }
  .site-nav.mobile-open {
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
  }
  .snav-link {
    padding: 14px 18px !important;
    font-size: 15px !important;
    white-space: normal !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    min-height: 50px;
    text-align: left !important;
    justify-content: flex-start !important;
    display: flex !important;
    align-items: center !important;
    width: 100%;
  }


  /* Tables — horizontal scroll wrapper */
  .tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; display: block; }
  table { min-width: 460px; }
  tbody td, thead th { padding: 6px 8px !important; }

  /* Grid layouts → single column */
  .body-grid, .two-col, .method-compare,
  .result-grid, .cols, .controls,
  .compare-wrap, .col-2, .grid-2 {
    grid-template-columns: 1fr !important;
  }

  /* Inputs/selects: ≥16px prevents iOS auto-zoom */
  input, select, textarea {
    font-size: 16px !important;
    padding: 10px 12px !important;
    min-height: 44px !important;
    border-radius: 6px !important;
  }
  button:not(.nav-hamburger):not(.dark-toggle):not(.back-to-top):not(.snav-link) {
    min-height: 44px !important;
  }

  /* Tab buttons */
  .tab-btn { padding: 10px 14px !important; font-size: 13px !important; }

  /* Section / card padding */
  .section-head, .secbar { padding: 8px 14px !important; font-size: 12px !important; }
  .col-pad, .card-body { padding: 12px 14px !important; }

  /* Result bands */
  .result-band, .rb-row { flex-wrap: wrap !important; gap: 10px !important; }
  .rb-val, .result-num { font-size: 20px !important; }

  /* Comment / form rows */
  .comment-row { flex-direction: column !important; }
  .comment-row input { min-width: unset !important; }

  /* Back-to-top */
  .back-to-top { bottom: 16px !important; right: 14px !important; width: 44px !important; height: 44px !important; font-size: 20px !important; }
}

@media (max-width: 480px) {
  .page-header h1 { font-size: 13px !important; }
  table { min-width: 400px; font-size: 11px !important; }
  .dark-toggle { padding: 6px 8px !important; font-size: 10px !important; }
}

/* ── PDF / DOWNLOAD BUTTON ── */
.pdf-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #E07B2A; color: #fff; font-size: 11px; font-weight: 700;
  text-decoration: none; padding: 6px 12px; border-radius: 3px;
  white-space: nowrap; transition: background 0.15s; margin-top: 6px;
}
.pdf-btn:hover { background: #c96a1a; color: #fff; text-decoration: none; }
.pdf-btn svg { flex-shrink: 0; }

/* ── UTILITY BAR (Search + Help) ── */
.util-bar {
  background: #0a1c35;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 7px 18px;
  border-bottom: 2px solid var(--orange);
}
.util-bar-label {
  font-size: 10px;
  color: #6a90b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: auto;
}
.util-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 18px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.util-btn-search {
  background: #1A4F8A;
  color: #fff;
  border: 1px solid #2E7DC8;
}
.util-btn-search:hover { background: #2E7DC8; transform: translateY(-1px); }
.util-btn-help {
  background: var(--orange);
  color: #fff;
  border: 1px solid #c96a1a;
}
.util-btn-help:hover { background: #c96a1a; transform: translateY(-1px); }
@media print { .util-bar { display: none !important; } }
@media (max-width: 768px) {
  .util-bar { justify-content: center; gap: 8px; padding: 8px 12px; }
  .util-bar-label { display: none; }
  .util-btn { padding: 9px 16px; font-size: 13px; }
}

/* ── CTRL+K SHORTCUT HINT ── */
.ctrlk-hint {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--dark-blue);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  border: 1px solid var(--orange);
  opacity: 0;
  transition: opacity 0.15s;
}
.ctrlk-hint.show { display: block; opacity: 1; }

/* ── COPY BUTTON ── */
.fmlbox, .notebox { position: relative; }
.copy-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(46,125,200,0.15);
  border: 1px solid rgba(46,125,200,0.4);
  color: #2E7DC8;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  font-family: inherit;
  line-height: 1.4;
}
.fmlbox:hover .copy-btn,
.notebox:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(46,125,200,0.35); }
.copy-btn.copied {
  background: rgba(34,139,34,0.2);
  border-color: #228b22;
  color: #228b22;
  opacity: 1;
}
/* Table cell copy */
td.copyable { cursor: pointer; position: relative; }
td.copyable::after {
  content: "⧉";
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  color: #aac8e8;
  opacity: 0;
  transition: opacity 0.1s;
}
td.copyable:hover::after { opacity: 1; }
td.copyable.flash { background: #d4edda !important; }
body.dark td.copyable.flash { background: #1a3a2a !important; }

/* ── FAVORITES BAR ── */
.fav-bar {
  display: none;
  background: #071526;
  align-items: center;
  gap: 6px;
  padding: 5px 18px;
  border-bottom: 1px solid rgba(224,123,42,0.3);
  flex-wrap: wrap;
  min-height: 36px;
}
.fav-bar.has-favs { display: flex; }
.fav-bar-title {
  font-size: 9px;
  color: #6a90b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  margin-right: 4px;
}
.fav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(26,79,138,0.5);
  color: #B8D4F0;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px 3px 10px;
  border-radius: 3px;
  border: 1px solid rgba(46,125,200,0.3);
  transition: background 0.15s;
  white-space: nowrap;
}
.fav-link:hover { background: rgba(46,125,200,0.4); color: #fff; }
.fav-link.active { background: var(--orange); border-color: #c96a1a; color: #fff; }
.fav-rm {
  background: none;
  border: none;
  color: #6a90b8;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 0 0 2px;
  font-family: inherit;
  transition: color 0.1s;
}
.fav-rm:hover { color: #ff6b6b; }
/* Star on nav buttons */
.nav-star {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s;
  color: #6a90b8;
  line-height: 1;
  z-index: 2;
}
.snav-link:hover .nav-star { opacity: 1; }
.nav-star.starred { opacity: 1 !important; color: #E07B2A; }
@media (max-width: 768px) { .fav-bar { display: none !important; } .nav-star { display: none; } }
@media print { .fav-bar { display: none !important; } }

/* ── SYNC BUTTON (in fav bar) ── */
.fav-sync-btn {
  background: none;
  border: none;
  color: #7ec8a0;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 3px;
  margin-left: auto;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.fav-sync-btn:hover { background: rgba(255,255,255,0.08); }

/* ── SYNC MODAL ── */
.sync-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}
.sync-modal.open { display: flex; }
.sync-modal-inner {
  background: #0D2B4E;
  border: 1px solid rgba(46,125,200,0.4);
  border-top: 3px solid #E07B2A;
  border-radius: 6px;
  padding: 20px 22px 18px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  color: #d0dff0;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.sync-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.sync-modal-close {
  background: none;
  border: none;
  color: #6a90b8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
.sync-modal-close:hover { color: #fff; }
.sync-modal-desc {
  font-size: 12px;
  color: #90b8d8;
  line-height: 1.5;
  margin-bottom: 14px;
}
.sync-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(46,125,200,0.3);
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 14px;
}
.sync-code {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  flex: 1;
}
.sync-copy-btn {
  background: #E07B2A;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s;
}
.sync-copy-btn:hover { background: #c96a1a; }
.sync-enter-row { margin-bottom: 14px; }
.sync-label {
  font-size: 11px;
  color: #6a90b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.sync-input {
  flex: 1;
  padding: 7px 10px;
  background: #091e36;
  border: 1px solid rgba(46,125,200,0.4);
  border-radius: 3px;
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 1px;
  outline: none;
  min-width: 0;
}
.sync-input:focus { border-color: #2E7DC8; }
.sync-apply-btn {
  background: #1A4F8A;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s;
}
.sync-apply-btn:hover { background: #2E7DC8; }
.sync-feedback {
  font-size: 11px;
  margin-top: 6px;
  min-height: 16px;
  color: #7ec8a0;
}
.sync-new-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: #6a90b8;
  border-radius: 3px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
  display: block;
  width: 100%;
}
.sync-new-btn:hover { color: #ff6b6b; border-color: #ff6b6b; }

/* ── NAV DROPDOWN (Utility Industry + sub-pages) ── */
.snav-dropdown {
  display: flex;
}
.snav-dropdown > .snav-link {
  flex: 1;
}
.snav-has-dropdown::after {
  content: ' ▾';
  font-size: 9px;
  opacity: 0.65;
  margin-left: 2px;
}
/* Menu uses position:fixed so overflow:hidden on .page cannot clip it */
.snav-dropdown-menu {
  display: none;
  position: fixed;
  min-width: 160px;
  background: #0d1c33;
  border: 1px solid rgba(255,255,255,0.12);
  border-top: 2px solid var(--orange);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  z-index: 9999;
}
.snav-dropdown-menu.dd-open { display: block; }
.snav-dropdown-item {
  display: block;
  color: #B8D4F0;
  text-decoration: none;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background 0.15s;
  white-space: nowrap;
}
.snav-dropdown-item:last-child { border-bottom: none; }
.snav-dropdown-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.snav-dropdown-item.active { background: var(--orange); color: #fff; }
.snav-dropdown-divider { height:1px; background:rgba(255,255,255,0.18); margin:4px 0; }
.snav-dropdown-label { padding:5px 16px 3px; font-size:9px; font-weight:800; text-transform:uppercase; letter-spacing:1px; color:var(--orange); }
/* Mobile: show inline inside hamburger menu (no fixed positioning) */
@media (max-width: 768px) {
  .snav-dropdown { flex-direction: column; }
  .snav-dropdown-menu {
    position: static !important;
    display: none;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: none;
    background: #071526;
    min-width: unset;
    width: 100%;
  }
  .snav-dropdown-menu.dd-open { display: block; }
  .snav-dropdown-item {
    padding: 12px 18px 12px 32px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .snav-has-dropdown::after { content: ' ▾'; }
}
@media print { .snav-dropdown-menu { display: none !important; } }


/* ── PAGE FOOTER (shared — pages that define it inline keep their own) ── */
.page-footer {
  background: var(--dark-blue, #0D2B4E);
  color: #90B8E0;
  font-size: 11px;
  padding: 10px 20px 14px;
  border-top: 2px solid var(--orange, #E07B2A);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
}
.page-footer a { color: #B8D4F0; text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .page-footer {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 4px !important;
    padding: 10px 14px 14px !important;
  }
  .page-footer span { width: 100%; text-align: center; }
}

/* ── DISCLAIMER FOOTER ── */
.footer-disclaimer {
  width: 100%;                        /* force onto its own row */
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 6px;
  padding-top: 7px;
  font-size: 10px;
  color: #607a96;
  line-height: 1.6;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.footer-disclaimer strong { color: #7a95b0; font-weight: 700; }
