/*
 * style.css - StructLab Beam Stress Distribution Calculator Design System
 * Default: Day Mode (Light) with optional Night Mode (Dark).
 */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  /* DAY MODE (DEFAULT) */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-canvas: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-subtle: #e2e8f0;
  --border-card: #e2e8f0;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --brand-cyan: #0284c7;
  --brand-amber: #d97706;
  --brand-rose: #e11d48;
  --brand-emerald: #059669;
  --brand-indigo: #4f46e5;
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* DARK MODE (WHEN .dark IS PRESENT) */
body.dark {
  --bg-primary: #070a11;
  --bg-surface: rgba(15, 23, 42, 0.85);
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-canvas: #090d16;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(15, 23, 42, 0.9);
  --input-border: rgba(255, 255, 255, 0.15);
  --brand-cyan: #38bdf8;
  --brand-amber: #f59e0b;
  --brand-rose: #f43f5e;
  --brand-emerald: #34d399;
  --brand-indigo: #818cf8;
  --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

/* Glass & Card Panels */
.glass-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.25s ease;
}

.glass-panel:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

.step-card {
  background: var(--bg-card);
  border-color: var(--border-card);
}

/* Shape Selector Buttons */
.shape-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.shape-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.4);
}

.shape-btn.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--brand-indigo);
  border-color: var(--brand-indigo);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

/* Ko-fi and Contact Header Buttons */
.btn-kofi {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-kofi:hover {
  background: #fff5f5;
  border-color: #fca5a5;
  color: #b91c1c;
  box-shadow: 0 2px 6px rgba(255, 94, 91, 0.2);
}

body.dark .btn-kofi {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

body.dark .btn-kofi:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-contact {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-contact:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}

body.dark .btn-contact {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

body.dark .btn-contact:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

/* Contact Modal Elements */
.contact-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: all 0.15s ease;
  gap: 8px;
}

.contact-card-item:hover {
  border-color: var(--brand-indigo);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.dark .contact-card-item {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark .contact-card-item:hover {
  border-color: rgba(129, 140, 248, 0.4);
}

.contact-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-action-btn {
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.contact-action-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

body.dark .contact-action-btn {
  color: #93c5fd;
  background: rgba(30, 58, 138, 0.4);
  border-color: rgba(59, 130, 246, 0.4);
}

body.dark .contact-action-btn:hover {
  background: rgba(30, 58, 138, 0.7);
  border-color: #60a5fa;
  color: #dbeafe;
}

/* Custom Styled Range Slider */
.probe-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 6px;
  background: linear-gradient(to right, #e11d48 0%, #0284c7 50%, #d97706 100%);
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.dark .probe-slider {
  background: linear-gradient(to right, #f43f5e 0%, #38bdf8 50%, #f59e0b 100%);
}

.probe-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #d97706;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s ease;
}

body.dark .probe-slider::-webkit-slider-thumb {
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.75);
}

.probe-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.probe-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.25);
  border-color: #0284c7;
}

/* Canvas Viewport Containers */
.diagram-canvas-wrap {
  position: relative;
  width: 100%;
  height: 350px;
  background: var(--bg-canvas);
  border-radius: 12px;
  border: 1px solid var(--border-card);
  overflow: hidden;
  cursor: crosshair;
}

.diagram-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* KaTeX Formula Blocks */
.formula-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  overflow-x: auto;
}

.formula-block .katex-display {
  margin: 0.35em 0;
}

/* Share Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  border-radius: 20px;
  width: 92%;
  max-width: 520px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-content {
  transform: scale(1);
}

/* Toast Notifications */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-surface);
  color: var(--brand-indigo);
  border: 1px solid var(--brand-indigo);
  padding: 10px 22px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100000;
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Print Friendly Styles */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  #structlab-universal-bar,
  .sidebar-panel,
  .probe-control-bar,
  .action-buttons,
  .modal-overlay {
    display: none !important;
  }

  .main-content {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .diagram-canvas-wrap {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
  }

  .glass-panel {
    background: #ffffff !important;
    border: 1px solid #dddddd !important;
    box-shadow: none !important;
  }
}

/* ========================================== */
/* Live Elevation Slice Readout Grid          */
/* ========================================== */
.readout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}

@media (min-width: 640px) {
  .readout-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

@media (min-width: 1024px) {
  .readout-grid {
    grid-template-columns: 1.35fr 1.22fr 1fr 1fr 0.98fr 0.88fr 0.92fr;
    gap: 0.625rem;
  }
}

.readout-card {
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.readout-title {
  display: block;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 600;
  white-space: nowrap;
  margin-bottom: 0.35rem;
}

@media (min-width: 1280px) {
  .readout-card {
    padding: 0.75rem 0.85rem;
  }
  .readout-title {
    font-size: 12px;
  }
}

@media (min-width: 1536px) {
  .readout-title {
    font-size: 12.5px;
  }
}

