/* styles.css - Clean, premium academic/scientific light theme */

:root {
  /* Minimal Mistakes Theme-Aligned Color Palette */
  --bg-base: #f2f3f3; /* jekyll page background */
  --bg-surface: #ffffff; /* crisp white cards and panels */
  --border-clean: #e5e7eb; /* clean light-gray borders */
  --border-focus: #52adc8; /* theme's main accent blue */
  
  --primary: #52adc8; /* main sky blue brand color */
  --primary-hover: #3e8296; /* deeper blue for hovers */
  --accent: #7a8288; /* standard theme gray */
  --accent-orange: #f89406; /* warning orange */
  --danger: #ee5f5b; /* danger red */
  --danger-hover: #be4c49;
  --success: #62c462; /* success green */
  
  --text-primary: #171516; /* high contrast dark gray text */
  --text-secondary: #494e52; /* intermediate slate gray text */
  --text-muted: #7a8288; /* muted gray */
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: Monaco, Consolas, "Lucida Console", monospace;
}

/* Global Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  padding: 0;
  margin: 0;
}

/* Page Layout Wrapper */
.app-container {
  width: 100%;
  max-width: 1200px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header Design (Clean, Scientific) */
.app-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border-clean);
  padding-bottom: 1.5rem;
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
}

h1 .accent {
  color: var(--primary);
  font-weight: 800;
  margin-left: 2px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

/* Grid Layout */
.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .app-layout {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
  }
}

/* Clean Panel Card Styling */
.glass-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-clean);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

/* Simulation Section & Canvas */
.simulation-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 512px;
  background: #000000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-clean);
}

#fluid-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.canvas-instructions {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border-clean);
  padding: 4px 12px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.canvas-instructions p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
}

/* Sidebar & Controls */
.controls-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  border-left: 4px solid var(--primary);
  padding-left: 8px;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Button Styling & Actions */
.simulation-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 512px;
  justify-content: stretch;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-sans);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  color: #fff !important;
  transition: background-color 0.2s ease-in-out, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary);
}

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

.btn-secondary {
  background-color: var(--accent);
}

.btn-secondary:hover {
  background-color: #5c6266;
}

.btn-danger {
  background-color: var(--danger);
}

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

.icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.hidden {
  display: none !important;
}

/* Diagnostics Display Panel */
.stats-panel h3 {
  border-left-color: var(--accent);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.stat-box {
  background: #f8fafc;
  border: 1px solid var(--border-clean);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.text-glow {
  color: var(--primary);
}

.text-accent {
  color: #7a8288;
}

.text-glow-orange {
  color: var(--accent-orange);
}

/* Beautiful Custom Select */
.custom-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23494e52'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 18px;
  padding-right: 32px;
  transition: border-color 0.15s ease;
}

.custom-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Sliders */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary);
  background: #eff6ff;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #dbeafe;
}

/* Range Input Styling */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 1px solid #3e8296;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Segmented Control Selector */
.segmented-control {
  display: flex;
  background: #f1f5f9;
  border: 1px solid var(--border-clean);
  padding: 3px;
  border-radius: 6px;
  width: 100%;
}

.segmented-control input[type="radio"] {
  display: none;
}

.segmented-control label {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.segmented-control input[type="radio"]:checked + label {
  background: var(--primary);
  color: #fff;
}

.segmented-control label:hover:not(:checked) {
  color: var(--text-primary);
  background: #e2e8f0;
}

/* Accessible Toggle Switch */
.switch-item {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.switch .slider {
  position: absolute;
  pointer-events: none;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .2s ease;
  border: 1px solid #cbd5e1;
  z-index: 1;
}

.switch .slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .2s ease;
}

.switch input:checked + .slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

.switch input:checked + .slider:before {
  transform: translateX(18px);
}

.switch .slider.round {
  border-radius: 20px;
}

.switch .slider.round:before {
  border-radius: 50%;
}

/* Footer Styling */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border-clean);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
