/* Scientific Calculator Stylesheet - Calculator Archive
   Exact clone of CASIO Natural Display fx-991EX / ClassWiz scientific calculator,
   plus dual fraction arithmetic suite, SVG pie charts, bar comparison, number line,
   print modal, saved drawer, and multi-language support. */

:root {
  --sci-bg-dark: #16191f;
  --sci-chassis: #1e232d;
  --sci-chassis-border: #2c3240;
  --sci-key-dark: #2a313d;
  --sci-key-hover: #353e4d;
  --sci-key-active: #1f242d;
  --sci-key-num: #1b2029;
  --sci-key-num-hover: #262d3a;
  --sci-key-del: #e63946;
  --sci-key-del-hover: #d62839;
  --sci-key-ac: #e63946;
  --sci-key-ac-hover: #d62839;
  --sci-key-eq: #2ecc71;
  --sci-key-eq-hover: #27ae60;
  --sci-shift-gold: #f5a623;
  --sci-alpha-green: #2ecc71;
  --sci-lcd-bg: #edf3e0;
  --sci-lcd-bezel: #111419;
  --sci-lcd-text: #19241b;
  --sci-lcd-dim: #738069;
  --sci-primary-blue: #2b5a88;
  --sci-link-blue: #0044aa;
  --sci-font: Arial, Helvetica, sans-serif;
}

/* Base Page Layout */
.sci-page-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px 48px;
  font-family: var(--sci-font);
  color: #333333;
}

/* Top Utility & Breadcrumbs */
.sci-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.sci-breadcrumbs {
  font-size: 13px;
  color: #666;
}

.sci-breadcrumbs a {
  color: var(--sci-link-blue);
  text-decoration: none;
}

.sci-breadcrumbs a:hover {
  text-decoration: underline;
}

.sci-breadcrumbs .sep {
  margin: 0 4px;
  color: #999;
}

.sci-breadcrumbs .current {
  color: #333;
  font-weight: 500;
}

.sci-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sci-action-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.sci-action-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.sci-print-link {
  color: var(--sci-link-blue);
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 6px;
}

.sci-print-link:hover {
  color: #002277;
}

/* Page Header */
.sci-page-title {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.sci-lead-text {
  font-size: 13.5px;
  color: #4b5563;
  line-height: 1.5;
  margin: 0 0 20px 0;
  max-width: 960px;
}

/* Main 2-Column Layout */
.sci-main-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.sci-content-col {
  flex: 1;
  min-width: 0;
}

.sci-sidebar-col {
  width: 290px;
  flex-shrink: 0;
}

/* ==========================================================================
   CASIO SCIENTIFIC CALCULATOR CHASSIS & HARDWARE CLONE
   ========================================================================== */
.sci-calc-device-wrapper {
  margin-bottom: 28px;
}

.sci-calc-chassis {
  max-width: 440px;
  margin: 0 auto;
  background: linear-gradient(180deg, #242934 0%, #171b22 100%);
  border: 2px solid #333a49;
  border-radius: 26px;
  padding: 16px 14px 20px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  user-select: none;
}

/* Branding Bar */
.sci-device-brand-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
}

.sci-brand-name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #d1d5db;
  text-transform: uppercase;
}

.sci-model-badge {
  font-size: 10px;
  font-weight: 700;
  background-color: #2b3547;
  color: #93c5fd;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #3b82f6;
  letter-spacing: 0.05em;
}

/* LCD Screen Container */
.sci-lcd-screen-container {
  background-color: #111419;
  border-radius: 12px;
  padding: 6px;
  border: 1px solid #3a4253;
  margin-bottom: 8px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
}

.sci-lcd-screen {
  background-color: var(--sci-lcd-bg);
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 140px;
  border: 1px solid #9ca3af;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--sci-lcd-text);
  font-family: "Courier New", Courier, monospace, monospace;
}

/* Top LCD Line (Equation & 3-dots Menu) */
.sci-lcd-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 13px;
  color: var(--sci-lcd-dim);
  border-bottom: 1px dashed rgba(115, 128, 105, 0.35);
  padding-bottom: 4px;
}

.sci-lcd-placeholder {
  font-size: 12.5px;
  color: #637059;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
}

.sci-lcd-dots-menu {
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #4b5563;
}

.sci-lcd-dots-menu:hover {
  color: #111827;
}

/* Main LCD Expression Area */
.sci-lcd-math-display {
  flex: 1;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 20px;
  line-height: 1.35;
  color: var(--sci-lcd-text);
  font-weight: 700;
  overflow-x: auto;
  white-space: nowrap;
}

/* Natural Fraction Representation in LCD */
.sci-natural-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  font-size: 0.85em;
  line-height: 1;
  margin: 0 3px;
}

.sci-natural-frac-num {
  padding: 1px 4px;
  border-bottom: 1.5px solid var(--sci-lcd-text);
}

.sci-natural-frac-den {
  padding: 1px 4px;
}

.sci-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background-color: var(--sci-lcd-text);
  vertical-align: middle;
  animation: sciBlink 1s infinite;
  margin-left: 1px;
}

@keyframes sciBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Bottom LCD Result Area */
.sci-lcd-result-bar {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  border-top: 1px dashed rgba(115, 128, 105, 0.35);
  padding-top: 4px;
  font-size: 22px;
  font-weight: 800;
  color: #141f16;
  text-align: right;
  min-height: 28px;
}

.sci-lcd-result-bar .eq-sign {
  font-size: 18px;
  margin-right: 6px;
  color: #55624d;
}

/* Status Pill Bar Below LCD */
.sci-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 6px 8px;
}

.sci-status-left {
  display: flex;
  gap: 5px;
  align-items: center;
}

.sci-status-tag {
  font-size: 9.5px;
  font-weight: 700;
  background-color: #11141a;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #323a49;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sci-status-tag.active {
  background-color: #1e293b;
  color: #ffffff;
  border-color: #60a5fa;
}

.sci-status-tag.active-shift {
  background-color: #451a03;
  color: var(--sci-shift-gold);
  border-color: var(--sci-shift-gold);
}

.sci-status-tag.active-alpha {
  background-color: #064e3b;
  color: var(--sci-alpha-green);
  border-color: var(--sci-alpha-green);
}

.sci-status-right {
  display: flex;
  gap: 4px;
  align-items: center;
}

.sci-tool-icon-btn {
  background: #191e27;
  border: 1px solid #2f3747;
  color: #cbd5e1;
  border-radius: 4px;
  width: 26px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sci-tool-icon-btn:hover {
  background: #2a3344;
  color: #ffffff;
}

/* Keypad Grid & Styling */
.sci-keypad-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Top 2x2 + D-Pad + 2x2 Control Matrix (Exact Reference Clone) */
.sci-top-control-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.sci-top-key-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  row-gap: 5px;
}

.sci-top-key-group .sci-btn {
  height: 30px;
  font-size: 11px;
}

.sci-dpad-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 2px;
}

/* 4-Way D-Pad */
.sci-dpad-circle {
  width: 82px;
  height: 82px;
  margin: 0 auto;
  background: radial-gradient(circle, #252d3d 0%, #131720 100%);
  border: 2px solid #3c4659;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sci-dpad-center-disc {
  width: 28px;
  height: 28px;
  background: #0f1218;
  border-radius: 50%;
  border: 1px solid #2a3344;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.6);
}

.sci-dpad-btn {
  position: absolute;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.1s ease;
}

.sci-dpad-btn:hover {
  color: #60a5fa;
}

.sci-dpad-btn.up { top: 4px; left: 50%; transform: translateX(-50%); width: 26px; height: 18px; }
.sci-dpad-btn.down { bottom: 4px; left: 50%; transform: translateX(-50%); width: 26px; height: 18px; }
.sci-dpad-btn.left { left: 4px; top: 50%; transform: translateY(-50%); width: 18px; height: 26px; }
.sci-dpad-btn.right { right: 4px; top: 50%; transform: translateY(-50%); width: 18px; height: 26px; }

/* Legacy Fallback Classes */
.sci-dpad-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sci-ctrl-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Function Key Grid */
.sci-fn-grid-4col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 2px;
}

.sci-fn-grid-6col {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 2px;
}

.sci-num-grid-5col {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

/* Individual Key Slot with Secondary Legends Above */
.sci-key-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sci-secondary-legends {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 2px;
  font-size: 8px;
  font-weight: 700;
  min-height: 12px;
  line-height: 12px;
}

.sci-legend-shift {
  color: var(--sci-shift-gold);
  font-family: Arial, sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sci-legend-alpha {
  color: var(--sci-alpha-green);
  font-family: Arial, sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Key Buttons */
.sci-btn {
  width: 100%;
  height: 32px;
  background-color: var(--sci-key-dark);
  color: #ffffff;
  border: 1px solid #3a4454;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  outline: none;
}

.sci-btn:hover {
  background-color: var(--sci-key-hover);
  border-color: #4b586e;
}

.sci-btn:active {
  background-color: var(--sci-key-active);
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.sci-btn-shift {
  background-color: #2e3748;
  color: var(--sci-shift-gold);
  font-weight: 800;
  font-size: 11.5px;
}

.sci-btn-alpha {
  background-color: #2e3748;
  color: var(--sci-alpha-green);
  font-weight: 800;
  font-size: 11.5px;
}

.sci-btn-menu {
  background-color: #2e3748;
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
}

.sci-btn-opt {
  background-color: #28303d;
  color: #e2e8f0;
  font-size: 11.5px;
}

.sci-btn-calc {
  background-color: #28303d;
  color: #e2e8f0;
  font-size: 11.5px;
}

.sci-btn-settings {
  background-color: #28303d;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sci-btn-varx {
  color: #38bdf8;
  font-weight: 700;
  font-style: italic;
  font-family: "Times New Roman", Times, serif;
}

.sci-btn-frac {
  font-size: 14px;
}

/* Number & Operator Keys */
.sci-btn-num {
  height: 38px;
  background-color: var(--sci-key-num);
  border-color: #2a3342;
  font-size: 16px;
  font-weight: 700;
}

.sci-btn-num:hover {
  background-color: var(--sci-key-num-hover);
}

.sci-btn-del {
  height: 38px;
  background-color: var(--sci-key-del);
  border-color: #b91c1c;
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
}

.sci-btn-del:hover {
  background-color: var(--sci-key-del-hover);
}

.sci-btn-ac {
  height: 38px;
  background-color: var(--sci-key-ac);
  border-color: #b91c1c;
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
}

.sci-btn-ac:hover {
  background-color: var(--sci-key-ac-hover);
}

.sci-btn-op {
  height: 38px;
  background-color: #262e3d;
  border-color: #38455a;
  font-size: 16px;
  font-weight: 700;
}

.sci-btn-eq {
  height: 38px;
  background-color: var(--sci-key-eq);
  border-color: #27ae60;
  color: #ffffff;
  font-weight: 800;
  font-size: 18px;
}

.sci-btn-eq:hover {
  background-color: var(--sci-key-eq-hover);
}

/* ==========================================================================
   DUAL FRACTION ARITHMETIC & SCIENTIFIC SUITE
   ========================================================================== */
.sci-section-heading {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sci-section-heading .badge-icon {
  background-color: #dbeafe;
  color: #1d4ed8;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.sci-suite-card {
  background-color: #ffffff;
  border: 1px solid #d4dde6;
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Fraction Arithmetic Equation Box */
.sci-frac-builder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.sci-frac-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 68px;
}

.sci-frac-input {
  width: 100%;
  height: 34px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #ffffff;
  outline: none;
  transition: border 0.15s ease;
}

.sci-frac-input:focus {
  border-color: var(--sci-primary-blue);
  box-shadow: 0 0 0 2px rgba(43, 90, 136, 0.2);
}

.sci-frac-divider {
  width: 100%;
  height: 2.5px;
  background-color: #1e293b;
  border: none;
  margin: 5px 0;
}

.sci-frac-op-select {
  font-size: 20px;
  font-weight: bold;
  padding: 4px 10px;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
}

.sci-frac-eq-sign {
  font-size: 24px;
  font-weight: bold;
  color: #475569;
}

.sci-suite-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sci-suite-btn-calc {
  background-color: #38761d;
  color: #ffffff;
  border: 1px solid #275414;
  border-radius: 4px;
  padding: 8px 24px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sci-suite-btn-calc:hover {
  background-color: #2b5c17;
}

.sci-suite-btn-clear {
  background-color: #64748b;
  color: #ffffff;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.sci-suite-btn-clear:hover {
  background-color: #475569;
}

/* Result Box */
.sci-frac-result-box {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 14px 18px;
  margin-top: 12px;
}

.sci-frac-res-headline {
  font-size: 18px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 6px;
}

.sci-frac-res-decimal {
  font-size: 14px;
  color: #374151;
  margin-bottom: 8px;
}

.sci-frac-res-steps {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.6;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 10px 14px;
}

/* ==========================================================================
   CHARTS & VISUALIZATIONS
   ========================================================================== */
.sci-charts-wrapper {
  background-color: #ffffff;
  border: 1px solid #d4dde6;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 24px;
}

.sci-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.sci-chart-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  text-align: center;
}

.sci-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.sci-pie-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 8px;
}

.sci-pie-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  color: #475569;
}

/* Number Line SVG Container */
.sci-number-line-svg {
  width: 100%;
  height: 80px;
}

/* Scientific Function Grapher Canvas */
.sci-grapher-container {
  margin-top: 14px;
  background: #0f172a;
  border-radius: 6px;
  padding: 10px;
}

.sci-grapher-canvas {
  width: 100%;
  height: 200px;
  display: block;
}

.sci-grapher-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.sci-grapher-input {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

.sci-grapher-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

/* ==========================================================================
   SIDEBAR & SEARCH BAR
   ========================================================================== */
.sci-search-form {
  position: relative;
  display: flex;
  margin-bottom: 16px;
}

.sci-search-input {
  flex: 1;
  height: 28px;
  padding: 2px 8px;
  font-size: 13px;
  border: 1px solid #7f9db9;
  border-right: none;
  background-color: #ffffff;
  outline: none;
}

.sci-search-input:focus {
  border-color: #0044aa;
}

.sci-search-btn {
  height: 28px;
  padding: 0 14px;
  background-color: var(--sci-primary-blue);
  color: #ffffff;
  border: 1px solid #1f4366;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.sci-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #7f9db9;
  border-top: none;
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sci-search-dropdown.active {
  display: block;
}

.sci-search-item {
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
}

.sci-search-item:hover {
  background-color: #eff6ff;
  color: #0044aa;
}

/* Sidebar Cards */
.sci-side-card {
  border: 1px solid #2b5a88;
  background-color: #ffffff;
  margin-bottom: 16px;
}

.sci-side-card-title {
  background-color: var(--sci-primary-blue);
  color: #ffffff;
  font-size: 13px;
  font-weight: bold;
  padding: 4px 8px;
}

.sci-side-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 8px 10px;
  gap: 3px 8px;
  font-size: 11.5px;
}

.sci-side-card-grid a {
  color: var(--sci-link-blue);
  text-decoration: underline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sci-side-card-grid a.active {
  font-weight: bold;
  color: #000000;
  text-decoration: none;
}

.sci-side-card-grid a:hover {
  color: #002277;
}

.sci-side-card-footer {
  border-top: 1px solid #d0d0d0;
  padding: 5px 8px;
  font-size: 11.5px;
  color: #555555;
  background-color: #f1f1f1;
  text-align: center;
}

.sci-side-card-footer a {
  color: var(--sci-link-blue);
  text-decoration: none;
}

.sci-side-card-footer a:hover {
  text-decoration: underline;
}

.sci-side-card-footer .active-cat {
  font-weight: bold;
  color: #000000;
}

/* ==========================================================================
   SEO, AEO, GEO ARTICLE & FAQS
   ========================================================================== */
.sci-seo-article {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 24px;
  margin-top: 24px;
  line-height: 1.65;
  color: #334155;
}

.sci-seo-article h2 {
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
  margin: 20px 0 10px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
}

.sci-seo-article h3 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 16px 0 8px;
}

.sci-seo-article p {
  margin: 0 0 12px;
  font-size: 13.5px;
}

.sci-seo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin: 14px 0 20px;
}

.sci-seo-table th {
  background-color: #2b5a88;
  color: #ffffff;
  padding: 6px 10px;
  text-align: left;
  border: 1px solid #1f4366;
}

.sci-seo-table td {
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
}

.sci-seo-table tr:nth-child(even) {
  background-color: #f8fafc;
}

/* FAQ Accordion */
.sci-faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  margin-bottom: 8px;
}

.sci-faq-q {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13.5px;
  color: #1e293b;
  background-color: #f8fafc;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sci-faq-a {
  padding: 12px 14px;
  font-size: 13px;
  color: #475569;
  line-height: 1.55;
  border-top: 1px solid #e2e8f0;
  display: none;
}

.sci-faq-item.active .sci-faq-a {
  display: block;
}

/* ==========================================================================
   MODALS (Print & Saved Drawer)
   ========================================================================== */
.sci-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sci-modal-card {
  background: #ffffff;
  border-radius: 8px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.sci-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background-color: var(--sci-primary-blue);
  color: #ffffff;
}

.sci-modal-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.sci-modal-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.sci-modal-body {
  padding: 18px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.55;
}

.sci-modal-footer {
  padding: 12px 18px;
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   TOP SEARCH BAR STYLING
   ========================================================================== */
.sci-top-search-container {
  position: relative;
  margin-bottom: 16px;
  width: 100%;
}

.sci-top-search-wrapper {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.sci-top-search-wrapper:focus-within {
  border-color: #2b5a88;
  box-shadow: 0 0 0 3px rgba(43, 90, 136, 0.15);
}

.sci-top-search-icon {
  color: #64748b;
  margin-right: 10px;
  flex-shrink: 0;
}

.sci-top-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: #1e293b;
  background: transparent;
  font-family: inherit;
}

.sci-top-search-input::placeholder {
  color: #94a3b8;
}

.sci-top-search-clear {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.sci-top-search-clear:hover {
  color: #475569;
}

.sci-top-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}

.sci-top-search-dropdown.active {
  display: block;
}

.sci-top-search-group-title {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
}

.sci-top-search-item {
  padding: 8px 14px;
  font-size: 13px;
  color: #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

.sci-top-search-item:last-child {
  border-bottom: none;
}

.sci-top-search-item:hover,
.sci-top-search-item.highlighted {
  background: #f0f9ff;
  color: #0369a1;
}

.sci-top-search-item .sci-item-badge {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 500;
}

.sci-top-search-item.is-feature .sci-item-badge {
  background: #fef3c7;
  color: #92400e;
}

/* ==========================================================================
   COLLAPSIBLE SECTIONS
   ========================================================================== */
.sci-collapsible-heading {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: opacity 0.15s ease;
}

.sci-collapsible-heading:hover {
  opacity: 0.9;
}

.sci-heading-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sci-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sci-collapse-icon {
  font-size: 11px;
  color: #64748b;
  transition: transform 0.2s ease;
}

.sci-collapsible-heading.sci-collapsed .sci-collapse-icon {
  transform: rotate(-90deg);
}

.sci-collapsible-body.sci-collapsed {
  display: none !important;
}

/* ==========================================================================
   REAL-TIME CALCULATION HISTORY
   ========================================================================== */
.sci-history-badge {
  background: #2b5a88;
  color: #ffffff;
  font-size: 11px;
  font-weight: bold;
  padding: 1px 7px;
  border-radius: 10px;
  display: inline-block;
}

.sci-history-clear-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sci-history-clear-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.sci-live-history-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sci-history-empty {
  text-align: center;
  padding: 24px 16px;
  color: #64748b;
  font-size: 13px;
  font-style: italic;
}

.sci-history-card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sci-history-card-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.sci-history-main {
  flex: 1;
  min-width: 0;
}

.sci-history-expr-line {
  font-family: monospace;
  font-size: 13.5px;
  color: #1e293b;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sci-history-res-val {
  color: #166534;
}

.sci-history-sub-meta {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  display: flex;
  gap: 8px;
}

.sci-history-btn-group {
  display: flex;
  gap: 6px;
  margin-left: 12px;
  flex-shrink: 0;
}

.sci-btn-action-small {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  color: #334155;
  transition: all 0.15s ease;
}

.sci-btn-action-small:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}

.sci-btn-action-delete {
  color: #ef4444;
}

.sci-btn-action-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* ==========================================================================
   TOAST NOTIFICATIONS (No blocking alerts in iframes)
   ========================================================================== */
.sci-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.sci-toast {
  background: #1e293b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: sciToastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 340px;
}

.sci-toast.success {
  background: #166534;
}

.sci-toast.info {
  background: #1e40af;
}

@keyframes sciToastSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS & MOBILE OPTIMIZATIONS
   ========================================================================== */
@media (max-width: 860px) {
  .sci-main-layout {
    flex-direction: column;
  }
  .sci-sidebar-col {
    width: 100%;
  }
  .sci-calc-chassis {
    max-width: 100%;
  }
  .sci-page-container {
    padding: 10px 12px 36px;
  }
}

@media (max-width: 580px) {
  .sci-page-title {
    font-size: 22px;
  }
  .sci-lead-text {
    font-size: 12.5px;
  }
  .sci-calc-chassis {
    padding: 12px 8px 16px;
    border-radius: 12px;
  }
  .sci-calc-screen-lcd {
    min-height: 70px;
    padding: 6px 8px;
  }
  .sci-lcd-formula-line {
    font-size: 15px;
  }
  .sci-lcd-result-line {
    font-size: 18px;
  }
  .sci-keys-grid-function {
    gap: 3px;
  }
  .sci-keys-grid-standard {
    gap: 3px;
  }
  .sci-btn-key {
    min-height: 32px;
    padding: 4px 1px;
  }
  .sci-btn-main-label {
    font-size: 10.5px;
  }
  .sci-btn-shift-label, .sci-btn-alpha-label {
    font-size: 7.5px;
  }
  .sci-dpad-ring {
    width: 68px;
    height: 68px;
  }
  .sci-frac-builder {
    flex-wrap: wrap;
    justify-content: center;
  }
  .sci-charts-grid {
    grid-template-columns: 1fr;
  }
  .sci-pie-container {
    flex-direction: column;
    align-items: center;
  }
  .sci-history-card-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .sci-history-btn-group {
    margin-left: 0;
    align-self: flex-end;
  }
}

/* Clean Formatted Print Styling */
@media print {
  body * {
    visibility: hidden;
  }
  #sci-print-content,
  #sci-print-content * {
    visibility: visible;
  }
  #sci-print-content {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
  }
}
