/* ==========================================================================
   Bounding Box Controller / Template Fine-Tuner Styles
   Theme: Royal Blue (#1a3566), Amber Gold (#d97706), Slate (#475569)
   ========================================================================== */

.bbc-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(26, 53, 102, 0.18);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.8);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  z-index: 99999;
  width: 320px;
  box-sizing: border-box;
  overflow: hidden;
  user-select: none;
  transition: box-shadow 0.2s ease;
}

.bbc-panel:hover {
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
}

/* Header & Drag Bar */
.bbc-header {
  background: linear-gradient(135deg, #1a3566 0%, #2563eb 100%);
  color: #ffffff;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  letter-spacing: -0.01em;
}

.bbc-header:active {
  cursor: grabbing;
}

.bbc-header-title {
  display: flex;
  align-items: center;
  pointer-events: none;
}

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

.bbc-icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s ease, transform 0.15s ease;
}

.bbc-icon-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* Panel Body */
.bbc-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 80vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.bbc-body.bbc-hidden {
  display: none !important;
}

/* Row & Labels */
.bbc-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bbc-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--royal-dark, #122549);
  white-space: nowrap;
}

/* Target Selection Dropdown */
.bbc-target-select {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.bbc-target-select:focus {
  border-color: #2563eb;
}

/* Live Coordinate Grid Inputs */
.bbc-coords-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: #f8fafc;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.bbc-coord-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.bbc-coord-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
}

.bbc-coord-input {
  width: 100%;
  padding: 4px 2px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
}

.bbc-coord-input:focus {
  border-color: #2563eb;
  background: #eff6ff;
}

/* Percentage Readout Badge */
.bbc-percent-badge {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  color: #1e40af;
  text-align: center;
  line-height: 1.4;
}

/* Step Size Selector Pills */
.bbc-step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.bbc-step-pills {
  display: flex;
  gap: 4px;
}

.bbc-step-pill {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bbc-step-pill:hover {
  background: #e2e8f0;
}

.bbc-step-pill.active {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
  font-weight: 700;
}

/* Controls Grid */
.bbc-controls {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  background: #f8fafc;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.bbc-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bbc-section-title {
  font-size: 10px;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  font-weight: 700;
}

/* D-Pad Layout */
.bbc-dpad {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows: repeat(3, 28px);
  gap: 3px;
  justify-content: center;
}

.bbc-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: all 0.1s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.bbc-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.bbc-btn:active {
  background: #dbeafe;
  border-color: #2563eb;
  transform: scale(0.92);
}

.bbc-up { grid-column: 2; grid-row: 1; }
.bbc-down { grid-column: 2; grid-row: 3; }
.bbc-left { grid-column: 1; grid-row: 2; }
.bbc-right { grid-column: 3; grid-row: 2; }

/* Size Buttons */
.bbc-size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
}

.bbc-size-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 0;
  cursor: pointer;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.1s ease;
}

.bbc-size-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.bbc-size-btn:active {
  background: #dbeafe;
  border-color: #2563eb;
  transform: scale(0.95);
}

.bbc-scale-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  margin-top: 4px;
}

.bbc-scale-btn {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 0;
  cursor: pointer;
  color: #1e40af;
  transition: all 0.1s ease;
}

.bbc-scale-btn:hover {
  background: #dbeafe;
}

.bbc-scale-btn:active {
  transform: scale(0.95);
}

/* Toggles Wrapper */
.bbc-toggles-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bbc-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.bbc-toggle-label {
  font-size: 11.5px;
  color: #334155;
  font-weight: 600;
}

/* Switch */
.bbc-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

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

.bbc-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s ease;
  border-radius: 20px;
}

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

input:checked + .bbc-slider {
  background-color: #2563eb;
}

input:checked + .bbc-slider:before {
  transform: translateX(16px);
}

/* Action Buttons */
.bbc-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.bbc-copy-btn {
  width: 100%;
  background: linear-gradient(135deg, #1a3566 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bbc-copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.bbc-copy-btn:active {
  transform: translateY(0);
}

.bbc-copy-all-btn {
  width: 100%;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 11.5px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.bbc-copy-all-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Hint Text */
.bbc-hint {
  font-size: 10.5px;
  color: #64748b;
  text-align: center;
  line-height: 1.3;
}

/* Toast */
.bbc-toast {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #d97706;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
  z-index: 1000;
}

.bbc-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(5px);
}

/* Responsive Mobile */
@media (max-width: 480px) {
  .bbc-panel {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-width: 320px;
  }
}


