/* 
  Modern Industrial CAD Design System 
  Theme: Engineering Slate & Blueprint Cyan
*/
:root {
  --bg-primary: #070d1e;
  --bg-secondary: #0d172e;
  --bg-card: #13223f;
  --bg-input: #1a2c4e;
  --border-dim: #22375d;
  --border-focus: #00f5d4;
  --text-main: #f0f6fc;
  --text-muted: #8b9bb4;
  --accent-cyan: #00f5d4;
  --accent-gold: #ffd166;
  --accent-blue: #48cae4;
  --accent-red: #ff5a5f;
  --accent-green: #38b000;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  height: 56px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: linear-gradient(135deg, #00f5d4, #00bbf9);
  color: #070d1e;
  font-weight: 900;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Layout */
.app-body {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* Sidebar Controls */
.sidebar-controls {
  width: 420px;
  min-width: 380px;
  max-width: 440px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 5;
}

.sidebar-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-dim);
}

.section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-cyan);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.form-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-val-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-gold);
}

.input-text, .input-select {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-text:focus, .input-select:focus {
  border-color: var(--border-focus);
}

.input-range {
  width: 100%;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-number-input {
  width: 90px;
  padding: 6px 8px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  outline: none;
}

.slider-number-input:focus {
  border-color: var(--border-focus);
}

/* Radio Cards (Crane Type) */
.radio-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-card {
  border: 1px solid var(--border-dim);
  background-color: var(--bg-input);
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.radio-card:hover {
  border-color: #3a506b;
}

.radio-card.active {
  border-color: var(--accent-cyan);
  background-color: rgba(0, 245, 212, 0.08);
}

.radio-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.radio-card-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-cyan);
  color: #070d1e;
  border-color: var(--accent-cyan);
}

.btn-primary:hover {
  background-color: #38ef7d;
  border-color: #38ef7d;
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-dim);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

.btn-full {
  width: 100%;
}

/* Main CAD Viewport */
.cad-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.cad-toolbar {
  height: 44px;
  background-color: rgba(13, 23, 46, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 5;
}

.view-mode-tabs {
  display: flex;
  background-color: var(--bg-input);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-dim);
}

.view-tab {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.view-tab.active {
  background-color: var(--accent-cyan);
  color: #070d1e;
}

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

.zoom-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-dim);
  color: var(--text-main);
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.zoom-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.zoom-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 45px;
  text-align: center;
}

/* SVG Container with pan and zoom */
.svg-render-area {
  flex: 1;
  width: 100%;
  height: calc(100% - 44px);
  position: relative;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}

.svg-render-area.grabbing {
  cursor: grabbing;
}

.svg-pan-zoom-container {
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  transition: transform 0.05s ease-out;
}

/* Quick Floating Engineering Metrics Bar */
.engineering-metrics-bar {
  position: absolute;
  bottom: 16px;
  left: 20px;
  background-color: rgba(13, 23, 46, 0.92);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 10px 16px;
  backdrop-filter: blur(10px);
  display: flex;
  gap: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 5;
}

.metric-item {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Error/Notification Banner */
.notification-banner {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 20;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.notification-banner.error {
  display: flex;
  background-color: #591619;
  border: 1px solid var(--accent-red);
  color: #ffc9c9;
}

.notification-banner.success {
  display: flex;
  background-color: #123d24;
  border: 1px solid var(--accent-green);
  color: #bbf7d0;
}

/* Modal for Saved Designs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: 650px;
  max-width: 90vw;
  max-height: 80vh;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.saved-design-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease;
}

.saved-design-item:hover {
  border-color: var(--accent-cyan);
}

.design-item-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 2px;
}

.design-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-dim);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3a506b;
}
