/* ==========================================================================
   Kalkuli - Scientific Calculator (Windows 11 Light Mode Design System)
   ========================================================================== */

/* 1. Design Tokens & Custom Properties */
:root {
  /* Windows 11 Light Theme Palette */
  --win-bg: #f3f3f3;
  --win-card-bg: #ffffff;
  --win-card-secondary: #f9f9f9;
  --win-border: rgba(0, 0, 0, 0.08);
  --win-border-strong: rgba(0, 0, 0, 0.14);

  /* Typography Colors */
  --text-primary: #1b1b1b;
  --text-secondary: #5d5d5d;
  --text-tertiary: #8a8a8a;

  /* Windows 11 Accent Color */
  --win-accent: #0067c0;
  --win-accent-hover: #005a9e;
  --win-accent-active: #004e8c;
  --win-accent-light: rgba(0, 103, 192, 0.08);

  /* Calculator Key Colors */
  --btn-num-bg: #ffffff;
  --btn-num-hover: #f6f6f6;
  --btn-num-active: #e9e9e9;
  --btn-num-border: rgba(0, 0, 0, 0.08);

  --btn-func-bg: #f9f9f9;
  --btn-func-hover: #f0f0f0;
  --btn-func-active: #e5e5e5;
  --btn-func-text: #262626;

  --btn-op-bg: #f3f3f3;
  --btn-op-hover: #e9e9e9;

  --btn-danger-bg: #fdf2f2;
  --btn-danger-text: #c53030;

  /* Fonts */
  --font-win: 'Segoe UI Variable Text', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  --font-mono: 'Consolas', 'Segoe UI Mono', 'Courier New', monospace;

  /* Corner Radius & Shadows */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.05), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 2. Global Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  background-color: var(--win-bg);
  color: var(--text-primary);
  font-family: var(--font-win);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--win-bg);
}

/* Accessible Visually Hidden Utility for SEO H1 */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Anti-Spam Honeypot Field Styling */
.hp-field {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 0 !important;
  height: 0 !important;
}

/* 3. Windows 11 Style Header Bar */
.win-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--win-border);
  height: 52px;
  min-height: 52px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1100px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-subtitle {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--win-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-nav,
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(0, 0, 0, 0.03);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--win-border);
  position: relative;
}

.nav-link {
  white-space: nowrap;
  text-decoration: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-win);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.nav-link:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.nav-link.active {
  background: #ffffff;
  color: var(--win-accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.win-btn-icon {
  background: #ffffff;
  border: 1px solid var(--win-border);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-btn);
}

.win-btn-icon:hover {
  background: var(--btn-num-hover);
  color: var(--win-accent);
  border-color: var(--win-border-strong);
}

.history-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--win-accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 99px;
}

/* 4. Main App Layout & View Transitions */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

.app-view {
  display: none;
}

.app-view.active-view {
  display: block;
}

/* 5. CALCULATOR VIEW */
.calculator-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .calculator-wrapper.has-history {
    grid-template-columns: 1fr 280px;
    max-width: 860px;
  }
}

.calculator-window {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

/* Sub-header Bar */
.calc-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.mode-toggles {
  display: flex;
  gap: 0.4rem;
}

.win-pill {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  color: var(--text-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.win-pill.active {
  background: var(--win-accent-light);
  color: var(--win-accent);
  border-color: rgba(0, 103, 192, 0.3);
}

.memory-active {
  color: var(--win-accent);
  border-color: var(--win-accent);
}

.memory-active.hidden {
  display: none;
}

.calc-type-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 600;
}

/* Display Screen */
.calc-display-panel {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  text-align: right;
  position: relative;
}

.calc-history-line {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  min-height: 1.3rem;
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: 0.2rem;
}

.calc-primary-display {
  font-family: var(--font-win);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.copy-display-btn {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--win-border);
  color: var(--text-secondary);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.copy-display-btn:hover {
  background: var(--btn-num-hover);
  color: var(--text-primary);
}

.copy-tooltip {
  position: absolute;
  left: 2rem;
  background: var(--text-primary);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.copy-tooltip.show {
  opacity: 1;
}

/* Memory Bar */
.memory-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.btn-mem {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-win);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-mem:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

/* Keypad Grid */
.calc-keypad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.btn {
  background: var(--btn-func-bg);
  border: 1px solid var(--win-border);
  color: var(--btn-func-text);
  padding: 0.75rem 0.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-win);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.1s ease, border-color 0.1s ease, transform 0.05s ease;
  box-shadow: var(--shadow-btn);
}

.btn:hover {
  background: var(--btn-func-hover);
  border-color: var(--win-border-strong);
}

.btn:active,
.btn.btn-pressed {
  background: var(--btn-func-active);
  transform: scale(0.98);
}

/* Button Colors */
.btn-num {
  background: var(--btn-num-bg);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.1rem;
}

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

.btn-op {
  background: var(--btn-op-bg);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.15rem;
}

.btn-op:hover {
  background: var(--btn-op-hover);
}

.btn-symbol {
  background: var(--win-card-secondary);
  color: var(--text-primary);
  font-weight: 500;
}

.btn-const {
  background: var(--win-card-secondary);
  color: var(--win-accent);
  font-style: italic;
  font-family: serif;
}

.btn-clear {
  background: var(--win-card-secondary);
  color: #c53030;
  font-weight: 600;
}

.btn-clear:hover {
  background: var(--btn-danger-bg);
}

.btn-del {
  background: var(--win-card-secondary);
  color: var(--text-primary);
}

.btn-equals {
  background: var(--win-accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.25rem;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 103, 192, 0.3);
}

.btn-equals:hover {
  background: var(--win-accent-hover);
}

.btn-equals:active {
  background: var(--win-accent-active);
}

.span-2 {
  grid-column: span 2;
}

/* History Side Panel */
.history-panel {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  max-height: 480px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--win-border);
  margin-bottom: 0.5rem;
}

.history-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.win-btn-text {
  background: transparent;
  border: none;
  color: var(--win-accent);
  font-size: 0.75rem;
  cursor: pointer;
}

.win-btn-text:hover {
  text-decoration: underline;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.history-item {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: right;
  transition: background 0.15s ease;
}

.history-item:hover {
  background: #e9e9e9;
}

.history-expr {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.history-val {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--win-accent);
}

.history-empty {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  text-align: center;
  margin: auto 0;
}


/* ==========================================================================
   6. SUBSTANTIAL PUBLISHER CONTENT & OPERATIONAL GUIDE
   ========================================================================== */
.publisher-content-card {
  width: 100%;
  max-width: 860px;
  margin: 1.5rem auto 3rem auto;
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  box-sizing: border-box;
}

.content-header {
  border-bottom: 1px solid var(--win-border);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.content-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
  line-height: 1.35;
}

.lead-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.guide-grid-three {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.info-box {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.info-box-header {
  margin-bottom: 0.75rem;
}

.info-box h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.info-box p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.styled-list,
.styled-numbered-list {
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 0.5rem;
}

.styled-list li,
.styled-numbered-list li {
  margin-bottom: 0.35rem;
}

/* Worked Mathematical Examples */
.worked-examples-section {
  border-top: 1px solid var(--win-border);
  padding-top: 1.5rem;
  margin-bottom: 2rem;
}

.worked-examples-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.section-intro {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.example-card {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

.example-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.formula-code {
  font-family: var(--font-mono);
  font-size: 0.825rem;
  background: #ffffff;
  border: 1px solid var(--win-border-strong);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--win-accent);
  display: inline-block;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.example-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.keystroke-box {
  background: #ffffff;
  border: 1px solid var(--win-border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.keystroke-box code {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
}

.result-tag {
  font-weight: 600;
  color: #16794c;
}

/* Precision Section */
.precision-section {
  border-top: 1px solid var(--win-border);
  padding-top: 1.5rem;
}

.precision-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.precision-section p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   7. EDUCATIONAL GUIDES, HANDBOOKS & FORMULAS
   ========================================================================== */
.guide-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1rem;
}

.guide-topic {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

.topic-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.topic-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.guide-topic p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.math-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.math-card {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
}

.math-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.formula-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--win-accent);
  font-weight: 600;
  margin-bottom: 0.5rem !important;
}

.math-card p {
  font-size: 0.825rem;
  margin-bottom: 0;
}

.callout-box {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.15rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.math-table-container {
  overflow-x: auto;
  border: 1px solid var(--win-border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.math-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.math-table th {
  background: var(--win-card-secondary);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--win-border-strong);
}

.math-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--win-border);
  color: var(--text-secondary);
  line-height: 1.5;
}

.math-table tr:last-child td {
  border-bottom: none;
}

.topic-note {
  font-size: 0.825rem !important;
  color: var(--text-tertiary) !important;
  margin-bottom: 0 !important;
}

/* Formula Sheet */
.formula-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 1rem;
}

.formula-group {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.formula-group h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--win-border);
  padding-bottom: 0.5rem;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.formula-card {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.825rem;
  line-height: 1.6;
}

.formula-card-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
}

.formula-card code {
  font-family: var(--font-mono);
  color: var(--win-accent);
  font-weight: 500;
}

/* Physical Constants Catalog */
.constants-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.constant-detail-card {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.const-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.const-symbol-badge {
  width: 44px;
  height: 44px;
  background: var(--win-card-secondary);
  color: var(--text-primary);
  border: 1px solid var(--win-border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.const-card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.const-val-str {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--win-accent);
  font-weight: 600;
}

.constant-detail-card p {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

/* FAQ List */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.faq-item {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
}

.faq-question {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.faq-answer p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Legal Cards (About, Privacy, Terms) */
.legal-card {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-card);
  margin-top: 1rem;
}

.legal-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.legal-card h3:first-child {
  margin-top: 0;
}

.legal-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.legal-card a {
  color: var(--win-accent);
  text-decoration: underline;
}

/* 6. CONTACT PAGE */
.win-page-container {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
}

.page-title-box h2 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 1.6fr 1fr;
  }
}

.win-form-card {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
}

.win-form-group {
  margin-bottom: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.win-form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.required {
  color: #c53030;
}

.win-form-group input,
.win-form-group textarea {
  background: #ffffff;
  border: 1px solid var(--win-border-strong);
  color: var(--text-primary);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-win);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.win-form-group input:focus,
.win-form-group textarea:focus {
  border-color: var(--win-accent);
  box-shadow: 0 0 0 2px var(--win-accent-light);
}

.win-form-group input.invalid,
.win-form-group textarea.invalid {
  border-color: #c53030;
}

.error-msg {
  color: #c53030;
  font-size: 0.75rem;
  display: none;
}

.error-msg.show {
  display: block;
}

.win-primary-btn {
  background: var(--win-accent);
  color: #ffffff;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-win);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-top: 0.25rem;
}

.win-primary-btn:hover {
  background: var(--win-accent-hover);
}

.win-info-sidebar {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: fit-content;
}

.win-info-sidebar h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.win-info-item {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.win-info-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--win-accent-light);
  color: var(--win-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Disclaimer Styling */
.win-disclaimer-card {
  border-top: 1px solid var(--win-border);
  padding-top: 0.85rem;
  margin-top: 0.25rem;
}

.win-disclaimer-card h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.win-disclaimer-card p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.45;
}

code {
  background: var(--win-card-secondary);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--win-border-strong);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* 7. MODALS & TOASTS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.win-modal-card {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border-strong);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  padding: 1.25rem;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--win-border);
  margin-bottom: 0.75rem;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.constants-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 300px;
  overflow-y: auto;
}

.constant-item-btn {
  background: var(--win-card-secondary);
  border: 1px solid var(--win-border);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.constant-item-btn:hover {
  background: #e9e9e9;
}

.const-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.const-units {
  font-size: 0.75rem;
  color: var(--win-accent);
  font-family: var(--font-mono);
}

.const-insert-tag {
  font-size: 0.75rem;
  color: var(--win-accent);
  font-weight: 600;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--text-primary);
  color: #ffffff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 8. Windows 11 Enhanced Multi-Column Footer */
.win-footer {
  border-top: 1px solid var(--win-border);
  background: #ffffff;
  padding: 2.5rem 0 1.5rem 0;
  margin-top: 3rem;
  width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.footer-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  box-sizing: border-box;
}

.footer-top-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

.brand-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-brand-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.logo-icon-sm {
  width: 22px;
  height: 22px;
  background: var(--win-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 320px;
}

.footer-version {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
}

.footer-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-nav-list a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.825rem;
  transition: color 0.15s ease;
}

.footer-nav-list a:hover {
  color: var(--win-accent);
}

.footer-bottom-bar {
  border-top: 1px solid var(--win-border);
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  width: 100%;
  box-sizing: border-box;
}

.footer-copy {
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
}

.footer-legal-inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-legal-inline a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  white-space: nowrap;
}

.footer-legal-inline a:hover {
  color: var(--win-accent);
}

.footer-sep {
  color: var(--win-border-strong);
}

/* Responsive Rules */
@media (max-width: 900px) {
  .brand-subtitle {
    display: none;
  }
  .footer-top-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 680px) {
  .calc-keypad {
    gap: 0.25rem;
  }

  .btn {
    padding: 0.6rem 0.1rem;
    font-size: 0.85rem;
  }

  .calc-primary-display {
    font-size: 1.75rem;
  }

  .brand-subtitle {
    display: none;
  }

  .footer-top-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .win-header {
    height: auto;
    min-height: 52px;
    padding: 0.4rem 0;
  }

  .header-container {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .win-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .dropdown-menu {
    width: min(320px, calc(100vw - 2rem));
  }
}

/* ==========================================================================
   SPECIALIZED SOLVERS & INTERACTIVE TOOLS DESIGN SYSTEM
   ========================================================================== */

/* Nav Dropdown */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.dropdown-chevron {
  transition: transform 0.2s ease;
  pointer-events: none;
}

.nav-dropdown:hover .dropdown-chevron,
.nav-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 320px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--win-border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16), 0 3px 10px rgba(0, 0, 0, 0.08);
  padding: 0.45rem;
  z-index: 1010;
}

.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.open .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.dropdown-item:hover,
.dropdown-item.active {
  background: rgba(0, 103, 192, 0.08);
}

.dropdown-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-item:hover .dropdown-item-title,
.dropdown-item.active .dropdown-item-title {
  color: var(--win-accent);
}

.dropdown-item-desc {
  font-size: 0.725rem;
  color: var(--text-secondary);
  line-height: 1.25;
}

.quick-tool-pill:hover {
  border-color: var(--win-accent);
  color: var(--win-accent);
  transform: translateY(-1px);
}

.quick-tool-pill.active {
  background: var(--win-accent);
  color: #ffffff;
  border-color: var(--win-accent);
  box-shadow: 0 2px 6px rgba(0, 103, 192, 0.3);
}

/* Ad Safety Zone Protection */
.no-ad-zone {
  position: relative;
  isolation: isolate;
  contain: layout style;
  padding: 0.5rem 0;
}

/* Solver Layout Cards */
.solver-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
}

@media (max-width: 860px) {
  .solver-layout-grid {
    grid-template-columns: 1fr;
  }
}

.solver-input-card,
.solver-output-card {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.solver-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--win-border);
}

.solver-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Inputs & Form Controls */
.form-group-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.solver-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.solver-input-wrap label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.solver-input-field {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: var(--font-win);
  border: 1px solid var(--win-border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.solver-input-field:focus {
  outline: none;
  border-color: var(--win-accent);
  box-shadow: 0 0 0 2px var(--win-accent-light);
}

.solver-textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border: 1px solid var(--win-border-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.solver-textarea:focus {
  outline: none;
  border-color: var(--win-accent);
  box-shadow: 0 0 0 2px var(--win-accent-light);
}

.solver-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.btn-primary-solver {
  background: var(--win-accent);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.btn-primary-solver:hover {
  background: var(--win-accent-hover);
  box-shadow: 0 2px 8px rgba(0, 103, 192, 0.35);
}

.btn-secondary-solver {
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--win-border-strong);
  padding: 0.65rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary-solver:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

.preset-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  font-size: 0.775rem;
  color: var(--text-tertiary);
}

.preset-chip {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid transparent;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.preset-chip:hover {
  background: #ffffff;
  border-color: var(--win-border-strong);
  color: var(--win-accent);
}

/* Hero Solution Box */
.hero-solution-box {
  background: linear-gradient(135deg, rgba(0, 103, 192, 0.05), rgba(0, 103, 192, 0.02));
  border: 1px solid rgba(0, 103, 192, 0.2);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  position: relative;
}

.hero-solution-label {
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--win-accent);
  margin-bottom: 0.4rem;
}

.hero-solution-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-win);
  word-break: break-word;
}

.hero-solution-subtext {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

/* Step By Step List */
.solution-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.solution-step-item {
  background: #fafafa;
  border-left: 3px solid var(--win-accent);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
}

.solution-step-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.solution-step-math {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: #ffffff;
  border: 1px solid var(--win-border);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-top: 0.25rem;
  color: #1a365d;
}

/* Visualizer Canvas Containers */
.visualizer-container {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--win-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
}

.visualizer-container svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.visualizer-caption {
  font-size: 0.775rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}

/* Matrix Styling */
.matrix-input-table {
  border-collapse: separate;
  border-spacing: 6px;
  position: relative;
  display: inline-block;
  padding: 0 8px;
}

.matrix-input-table::before,
.matrix-input-table::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  border: 2px solid var(--text-primary);
}

.matrix-input-table::before {
  left: 0;
  border-right: none;
}

.matrix-input-table::after {
  right: 0;
  border-left: none;
}

.matrix-cell-input {
  width: 60px;
  height: 40px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid var(--win-border-strong);
  border-radius: var(--radius-sm);
}

.matrix-cell-input:focus {
  outline: none;
  border-color: var(--win-accent);
  box-shadow: 0 0 0 2px var(--win-accent-light);
}

.matrix-grid-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

/* Statistics Metrics Grid */
.stats-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-box {
  background: #fcfcfc;
  border: 1px solid var(--win-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.stat-label {
  font-size: 0.725rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Unit Converter Grid */
.converter-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .converter-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.swap-btn {
  background: var(--win-card-bg);
  border: 1px solid var(--win-border-strong);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 auto;
  transition: all 0.2s;
}

.swap-btn:hover {
  background: var(--win-accent);
  color: #ffffff;
  border-color: var(--win-accent);
  transform: rotate(180deg);
}

.category-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.category-pill {
  padding: 0.35rem 0.75rem;
  background: #ffffff;
  border: 1px solid var(--win-border);
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.category-pill:hover {
  color: var(--win-accent);
  border-color: var(--win-accent);
}

.category-pill.active {
  background: var(--win-accent);
  color: #ffffff;
  border-color: var(--win-accent);
}