/* ==========================================================================
   app_yacht.css — Yacht Resistance Predictor Page Styles
   (Layout model, toolbar, and footer aligned to app_cylinder.css)
   ========================================================================== */

/* ── Full-height page layout (matches cylinder page) ── */
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

nav {
  flex-shrink: 0;
}

.divider {
  flex-shrink: 0;
}

footer.footer {
  flex-shrink: 0;
}

/* Main two-column workspace layout (matches cylinder proportions exactly) */
.app-workspace {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

/* ── Left sidebar control panel ── */
.control-panel {
  background: var(--navy-mid);
  border: 1px solid rgba(200, 168, 75, 0.2);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  min-height: 0;
}

.controls-section {
  width: 100%;
}

.panel-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--white);
  border-bottom: 1px solid rgba(200, 168, 75, 0.15);
  padding-bottom: 0.75rem;
  margin-top: 0;
  margin-bottom: 1.25rem;
}

/* ── Input groups & sliders ── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.input-group-final {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.input-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--amber);
  display: flex;
  justify-content: space-between;
}

.input-label span {
  color: var(--white);
  font-family: monospace;
}

.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--navy-light);
  border: 1px solid rgba(200, 168, 75, 0.1);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--amber);
  border: 1px solid var(--white);
  cursor: pointer;
  transition: transform 0.1s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ── Telemetry readout block (pinned to panel bottom) ── */
.telemetry-wrapper {
  margin-top: auto;
  padding-top: 10px;
}

.telemetry-title {
  margin-bottom: 0.5rem;
}

.telemetry-deck {
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid rgba(200, 168, 75, 0.1);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.telemetry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.telemetry-label {
  color: var(--muted);
}

.telemetry-val {
  font-family: monospace;
  font-size: 15px;
  color: var(--amber-light);
  font-weight: bold;
}

.total-row {
  border-top: 1px solid rgba(200, 168, 75, 0.2);
  padding-top: 8px;
  margin-top: 4px;
}

.highlight-text {
  color: var(--amber, #c8a84b);
}

.total-val {
  font-size: 18px;
}

/* ==========================================================================
   NAV VIEW-SWITCHER CLUSTER (3D CAD Model / Analytical Plots)
   ========================================================================== */
.nav-controls-cluster {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cad-toggle-wrapper {
  display: flex;
  background: rgba(10, 22, 40, 0.8);
  border: 1px solid rgba(200, 168, 75, 0.3);
  padding: 2px;
}

.btn-switch-view {
  background: transparent;
  border: none;
  color: var(--muted, #94a3b8);
  padding: 0.4rem 1rem;
  font-family: monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-switch-view.active-view {
  background: var(--amber, #c8a84b);
  color: var(--navy-dark, #060d18);
  font-weight: bold;
}

.btn-switch-view:hover:not(.active-view) {
  color: var(--white, #ffffff);
  background: rgba(200, 168, 75, 0.15);
}

/* ── Workspace Right Column (CAD Viewport) ── */
.workspace-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Split container holds both panels; only one is visible at a time */
.split-viewport-container {
  display: flex;
  flex-direction: row;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
}

.viewport-container {
  background: #060d18;
  border: 1px solid rgba(200, 168, 75, 0.15);
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chart-panel.is-hidden,
.visualizer-panel.is-hidden,
.table-panel.is-hidden {
  display: none !important;
}

/* ── CAD Toolbar (identical to cylinder page) ── */
.cad-toolbar {
  background: rgba(10, 22, 40, 0.8);
  border-bottom: 1px solid rgba(200, 168, 75, 0.15);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.cad-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.cad-btn {
  background: rgba(200, 168, 75, 0.05);
  border: 1px solid rgba(200, 168, 75, 0.3);
  color: var(--white);
  padding: 0.4rem 0.8rem;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.cad-btn:hover {
  background: rgba(200, 168, 75, 0.15);
  border-color: var(--amber);
}

/* Chart metric filter dropdown */
.cad-select {
  background: rgba(10, 22, 40, 0.9);
  border: 1px solid rgba(200, 168, 75, 0.3);
  color: var(--white);
  padding: 0.4rem 0.6rem;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.cad-select:hover {
  border-color: var(--amber);
}

.aspect-ratio-hud,
.chart-title-hud {
  font-family: monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.aspect-ratio-hud span {
  color: var(--amber-light);
  font-weight: bold;
}

#canvas-3d-target {
  width: 100%;
  flex: 1;
  min-height: 0;
  cursor: grab;
}

#canvas-3d-target:active {
  cursor: grabbing;
}

#plot-target {
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #060d18;
}

/* ==========================================================================
   THEORY & RESEARCH FULLSCREEN OVERLAY (Cylinder Mirror)
   ========================================================================== */
.theory-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 13, 24, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.theory-overlay.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.theory-modal {
  background: var(--navy-mid);
  border: 1px solid rgba(200, 168, 75, 0.25);
  width: 92%;
  max-width: 1160px;
  max-height: 85vh;
  padding: 3.5rem;
  position: relative;
  overflow-y: auto;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8);
  box-sizing: border-box;
}

.theory-modal::-webkit-scrollbar {
  width: 6px;
}
.theory-modal::-webkit-scrollbar-track {
  background: var(--navy-dark);
}
.theory-modal::-webkit-scrollbar-thumb {
  background: rgba(200, 168, 75, 0.3);
}

.theory-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: transparent;
  border: 1px solid rgba(200, 168, 75, 0.3);
  color: var(--amber);
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  font-family: monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s ease;
}

.theory-close:hover {
  background: var(--amber);
  color: var(--navy-dark);
  border-color: var(--amber);
}

.theory-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 4rem;
  margin-top: 1rem;
}

.theory-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--amber);
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.theory-left h2, .theory-right h2 {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  font-size: 28px;
  margin-bottom: 0.75rem;
  font-weight: normal;
  line-height: 1.25;
}

.theory-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 1.75rem;
  letter-spacing: 0.5px;
}

.theory-left p, .theory-right p {
  font-size: 14px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1.25rem;
}

.theory-left h3 {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  font-size: 18px;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.equation-box {
  background: rgba(10, 22, 40, 0.6);
  border-left: 3px solid var(--amber);
  padding: 1.5rem;
  margin: 2rem 0;
}

.eq-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.eq-math {
  font-family: 'Courier New', Courier, monospace;
  font-size: 22px;
  color: var(--white);
  font-weight: bold;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

.equation-box p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.5;
}

.equation-box strong {
  color: var(--amber-light);
}

.tutorial-step {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  align-items: flex-start;
}

.step-num {
  background: rgba(200, 168, 75, 0.08);
  border: 1px solid rgba(200, 168, 75, 0.4);
  color: var(--amber);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: monospace;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

.step-text h4 {
  color: var(--white);
  font-size: 14px;
  margin-bottom: 0.35rem;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.step-text p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

.theory-start-btn {
  width: 100%;
  background: var(--amber);
  color: var(--navy-dark);
  border: none;
  padding: 1.15rem;
  font-weight: bold;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: all 0.2s ease;
}

.theory-start-btn:hover {
  background: var(--white);
  color: var(--navy-dark);
}

/* ── Responsive adjustments (matches cylinder page) ── */
@media (max-width: 1024px) {
  .theory-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  .theory-modal {
    padding: 2rem;
    max-height: 90vh;
  }
}

/* ==========================================================================
   DATA TABLE PANEL
   ========================================================================== */
#table-target {
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem;
  background: #060d18;
  box-sizing: border-box;
}

#table-target::-webkit-scrollbar {
  width: 6px;
}
#table-target::-webkit-scrollbar-track {
  background: rgba(10, 22, 40, 0.5);
}
#table-target::-webkit-scrollbar-thumb {
  background: rgba(200, 168, 75, 0.3);
}

.data-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.data-table-block {
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid rgba(200, 168, 75, 0.15);
  padding: 1rem 1.1rem;
}

.data-table-title {
  font-family: monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--amber, #c8a84b);
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(200, 168, 75, 0.2);
  font-weight: bold;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: var(--white, #fff);
}

.data-table thead th {
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
  color: var(--amber, #c8a84b);
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid rgba(200, 168, 75, 0.3);
  background: rgba(200, 168, 75, 0.05);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table tbody td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(200, 168, 75, 0.08);
  vertical-align: middle;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(10, 22, 40, 0.4);
}

.data-table tbody tr:hover {
  background: rgba(200, 168, 75, 0.08);
}

.data-table .col-numeric {
  font-family: monospace;
  color: var(--amber-light, #e3c97a);
  text-align: right;
  white-space: nowrap;
}

.data-table .col-unit {
  color: var(--muted, #94a3b8);
  font-family: monospace;
  font-size: 11px;
  width: 50px;
}

.data-table .row-input td {
  background: rgba(78, 208, 225, 0.06);
}

.data-table .row-input td:first-child {
  border-left: 2px solid #4ed0e1;
}

.data-table-empty {
  text-align: center;
  color: var(--muted, #94a3b8);
  padding: 3rem 1rem;
  font-size: 13px;
  font-family: monospace;
}

/* Stack tables when the panel gets narrow */
@media (max-width: 1180px) {
  .data-tables-grid {
    grid-template-columns: 1fr;
  }
}