/* Reset + theme root variables */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --navy: #2C3E50;
  --softgray: #ECF0F1;
  --teal: #1ABC9C;
  --gold: #F1C40F;
  --slate: #7F8C8D;
  --coral: #E74C3C;
  --white: #FFFFFF;
  --gray-100: #F7FAFC;
  --gray-200: #EDF2F7;
  --gray-300: #E2E8F0;
}

/* Page base */
body {
  font-family: 'Inter', sans-serif;
  background: white;
  min-height: 100vh;
  color: var(--navy);
}

/* Layout container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--gray-100);
  color: var(--navy);
  padding: 20px;
  text-align: center;
}

.header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
}

/* Controls */
.controls {
  padding: 15px 20px;
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

/* Button styles */
.btn {
  border: 0;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: box-shadow .12s ease, transform .08s ease;
}

.btn:active {
  transform: translateY(1px);
}

.teal-btn {
  background-color: rgba(26, 188, 156, 0.8);
  color: white;
}

.teal-btn:hover {
  background-color: rgba(26, 188, 156, 0.7);
}

.gold-btn {
  background-color: rgba(241, 196, 15, 0.8);
  color: var(--navy);
}

.gold-btn:hover {
  background-color: rgba(241, 196, 15, 0.7);
}

.coral-btn {
  background-color: rgba(231, 76, 60, 0.8);
  color: white;
}

.coral-btn:hover {
  background-color: rgba(231, 76, 60, 0.7);
}

.navy-btn {
  background-color: rgba(44, 62, 80, 0.8);
  color: white;
}

.navy-btn:hover {
  background-color: rgba(44, 62, 80, 0.7);
}

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

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

.btn-success {
  background: #27ae60;
  color: white;
}

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

.btn.active {
  background: #27ae60;
  color: white;
}

/* Main split panels */
.main-content {
  display: flex;
  flex: 1;
  min-height: 600px;
  align-items: stretch; /* Force panels to same height */
}

.left-panel, .right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Important for equal height */
}

.left-panel {
  border-right: 3px solid #bdc3c7;
  background: #fafafa;
}

.right-panel {
  background: #f8f9fa;
}

/* Panel headers */
.panel-header {
  background: #34495e;
  color: white;
  padding: 15px;
  text-align: center;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
}

/* Canvas container */
.canvas-container {
  flex: 1 0 400px; /* Grow, don't shrink, base height 400px */
  position: relative;
  padding: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 480px; /* Minimum height */
  max-height: 550px; /* Maximum height - LOCKED */
  overflow: hidden; /* Prevent canvas from extending beyond container */
  box-sizing: border-box; /* Include padding in height calculation */
}

/* Canvas visuals */
canvas {
  border: 2px solid #bdc3c7;
  border-radius: 8px;
  background: white;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  width: 100%;
  height: 100%;
  max-width: 450px;
}


/* Right canvas grabbed state */
#rightCanvas {
  cursor: grab;
}

#rightCanvas:active {
  cursor: grabbing;
}

/* Info panels */
.info-panel {
  background: white;
  border-top: 2px solid #bdc3c7;
  padding: 15px;
  height: 300px; /* Fixed height */
  max-height: 300px; /* Prevent growing */
  overflow-y: auto;
  flex-shrink: 0; /* Don't allow shrinking */
}

.vector-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.vector-card {
  background: #ecf0f1;
  padding: 10px;
  border-radius: 6px;
  border-left: 4px solid var(--teal);
  font-size: 12px;
}

.vector-card h5 {
  margin: 0 0 8px 0;
  font-size: 14px;
}

/* Scenario buttons */
.preset-scenarios {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scenario-btn {
  padding: 6px 12px;
  background: var(--slate);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.18s ease;
}

.scenario-btn:hover {
  background: var(--navy);
}

/* Component/result panels */
.components-display {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 6px;
  padding: 10px;
  margin-top: 10px;
  font-family: 'Montserrat';
  font-size: 0.8rem;
}

.resultant-info {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 6px;
  padding: 10px;
  margin-top: 10px;
  font-weight: 600;
}

/* Vector controls inside info */
.vector-controls {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 10px;
  margin-top: 10px;
}

.input-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 5px 0;
}

.input-group label {
  min-width: 80px;
  font-size: 12px;
  font-weight: 600;
}

.input-group input {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 12px;
}

.vector-edit-btn {
  padding: 4px 8px;
  background: #17a2b8;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  margin-left: 5px;
}

.vector-delete-btn {
  padding: 4px 8px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  margin-left: 5px;
}

/* Add vector section */
.add-vector-section {
  background: #e9ecef;
  border-radius: 6px;
  padding: 15px;
  margin-top: 10px;
}

.add-vector-section h5 {
  margin: 0 0 10px 0;
  color: #495057;
}

/* Angle display tooltip */
.angle-display {
  position: absolute;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  pointer-events: none;
}

/* Zoom control styles */
.zoom-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.zoom-controls .btn {
  width: 50px;
  height: 30px;
  padding: 0;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.lock-btn {
  padding: 6px 8px;
  margin-left: 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(44,62,80,0.08);
  background: #fff;
  cursor: pointer;
}

.lock-btn.lock-active {
  background: #f1c40f;
  color: #2c3e50;
  font-weight: 600;
}

.lock-btn.lock-inactive {
  background: #ecf0f1;
}

/* scenario floating box in left panel */
.scenario-box {
  background: rgba(255, 255, 255, 0.95);
  left: 50%;
  transform: translateX(-50%);
  position: absolute;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(44,62,80,0.15);
  padding: 15px 20px 15px 20px;
  border: 2px solid rgba(44,62,80,0.1);
  width: 600px;
  max-width: calc(100% - 40px);
  top: 20px;
  z-index: 40;
  pointer-events: auto;
}

.scenario-box[hidden] {
  display: none;
}

.scenario-title {
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  color: var(--navy, #2C3E50);
  margin-bottom: 6px;
}

.scenario-text {
  font-size: 0.92rem;
  color: var(--slate, #7F8C8D);
  line-height: 1.3;
}

.scenario-close {
  position: absolute;
  right: 12px;
  top: 10px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--slate, #7F8C8D);
  padding: 4px;
  border-radius: 3px;
}

.scenario-close:hover {
  background: rgba(0,0,0,0.1);
}

/* Responsive tweaks */
@media (max-width: 900px) {
  .main-content {
    flex-direction: column;
  }
  .left-panel {
    border-right: none;
    border-bottom: 3px solid #bdc3c7;
  }
  canvas {
    max-width: 95%;
  }
  .scenario-box {
    left: 10px;
    right: 10px;
    top: 10px;
    max-width: calc(100% - 20px);
  }
}

/* Mode toggle pills */
.mode-toggle {
  display: inline-flex;
  background: var(--gray-200);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.mode-pill {
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  background: transparent;
  color: var(--slate);
  transition: background 0.15s, color 0.15s;
}

.mode-pill:hover:not(.active) {
  background: rgba(255,255,255,0.5);
  color: var(--navy);
}

.mode-pill.active {
  background: var(--navy);
  color: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.dropdown-group {
  position: relative;
  display: inline-block;
  margin: 5px;
}

.dropdown-btn {
  background: var(--navy);
  color: white;
  min-width: 100px;
  text-align: left;
  position: relative;
  padding-right: 30px;
}

.dropdown-btn::after {
  content: '▼';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
}

.dropdown-btn:hover {
  background: var(--slate);
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--softgray);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  font-size:0.8rem;
  overflow: hidden;
}

.dropdown-group:hover .dropdown-content {
  display: block;
}

.dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #ecf0f1;
  color: #2c3e50;
  font-weight: 500;
 
  transition: background-color 0.12s ease;
}

.dropdown-item:hover {
  background: var(--slate);
  color: white;
}

.dropdown-item:last-child {
  border-bottom: none;
}
