:root {
  --font-base: 'Outfit', sans-serif;
  --fs-title: 1.35rem;
  --fs-subtitle: 1.05rem;
  --fs-label: 1.0rem;
  --fs-select: 0.9rem;
  --fs-panel-title: 1.0rem;
  --fs-plot-ticks: 16px;
  --fs-plot-labels: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-base);
  background-color: #f1f5f9;
  color: #0f172a;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Panel de control flotante (Glassmorphism) */
#control-panel {
  position: absolute;
  top: 24px;
  left: 24px;
  width: 380px;
  max-height: calc(100vh - 48px);
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 10;
  overflow-y: auto;
}

/* Barra de desplazamiento personalizada para el panel */
#control-panel::-webkit-scrollbar {
  width: 6px;
}

#control-panel::-webkit-scrollbar-track {
  background: transparent;
}

#control-panel::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

#control-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

h2,
h3 {
  color: #0f172a;
}

h2 {
  font-size: var(--fs-title);
  font-weight: 700;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 12px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--fs-subtitle);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: var(--fs-label);
  font-weight: 600;
  color: #64748b;
  display: flex;
  justify-content: space-between;
}

label span {
  color: #0284c7;
  font-weight: 700;
}

select {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: var(--fs-select);
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

select:hover {
  background: rgba(0, 0, 0, 0.05);
}

select:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Estilos de Controles de Deslizamiento (Sliders) */
input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  outline: none;
  margin: 8px 0;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #0369a1;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  background: #0369a1;
}

hr {
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.graph-container {
  position: relative;
  width: 100%;
  height: 100%;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Panel de Gráfica Flotante */
.floating-panel {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 420px;
  height: 280px;
  min-width: 280px;
  min-height: 160px;
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s cubic-bezier(0.4, 0, 0.2, 1), bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1), right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#flux-panel {
  bottom: 328px;
}

.panel-header {
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
}

.panel-title {
  font-size: var(--fs-panel-title);
  font-weight: 700;
  color: #334155;
  letter-spacing: -0.01em;
}

.panel-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.panel-controls button {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 1.1rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
  padding: 0;
}

.panel-controls button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0284c7;
}

.panel-body {
  flex-grow: 1;
  padding: 12px 16px 16px 16px;
  position: relative;
  overflow: hidden;
}

/* Tiradores de redimensión del panel */
.resizer {
  position: absolute;
  z-index: 25;
  background: transparent;
}

/* Bordes */
.resizer-t {
  top: 0;
  left: 8px;
  right: 8px;
  height: 6px;
  cursor: n-resize;
}

.resizer-b {
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 6px;
  cursor: s-resize;
}

.resizer-l {
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 6px;
  cursor: w-resize;
}

.resizer-r {
  right: 0;
  top: 8px;
  bottom: 8px;
  width: 6px;
  cursor: e-resize;
}

/* Esquinas */
.resizer-tl {
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
  z-index: 26;
}

.resizer-tr {
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
  z-index: 26;
}

.resizer-bl {
  bottom: 0;
  left: 0;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
  z-index: 26;
}

.resizer-br {
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  z-index: 26;
  background: linear-gradient(135deg, transparent 60%, rgba(2, 132, 199, 0.4) 60%);
  border-bottom-right-radius: 16px;
}

/* Estados de Minimizar y Maximizar */
.floating-panel.minimized {
  height: 45px !important;
  width: 280px !important;
}

.floating-panel.minimized .panel-body,
.floating-panel.minimized .resizer {
  display: none !important;
}

.floating-panel.maximized {
  top: 24px !important;
  left: 24px !important;
  right: 24px !important;
  bottom: 24px !important;
  width: calc(100vw - 48px) !important;
  height: calc(100vh - 48px) !important;
  z-index: 100 !important;
}

.floating-panel.maximized .resizer {
  display: none !important;
}

/* Estilos de Interruptor Deslizante (Toggle Switch) */
.toggle-group {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  margin-bottom: 4px;
}

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

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider.round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.08);
  transition: 0.25s ease;
  border-radius: 22px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.slider.round:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.25s ease;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
  background-color: #0284c7;
}

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