/* ================================================================
   DESIGNER CSS
================================================================ */

body {
  background-color: #000000 !important;
  color: #ffffff !important;
}

#designer-wrapper {
  --bg: #000000;
  --panel: rgba(8, 8, 8, 0.92);
  --panel-solid: #080808;
  --border: rgba(212, 168, 26, 0.18);
  --accent: #d4a81a;
  --accent-glow: rgba(212, 168, 26, 0.28);
  --accent2: #e6bc3a;
  --text: #ffffff;
  --text-dim: #888888;
  --slider-track: rgba(255,255,255,0.08);
  --slider-thumb: #d4a81a;
  
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-primary);
  height: calc(100vh - 80px);
  margin-top: 80px;
  display: block;
  position: relative;
  overflow: hidden;
}

#designer-wrapper * {
  user-select: none;
  -webkit-user-drag: none;
}

/* LEFT: 3D Canvas (100%) */
#canvas-pane {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#three-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Floating overlay controls in 3D view */
.cam-presets-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 5;
  display: flex;
  gap: 10px;
}

.cam-pill {
  padding: 8px 16px;
  background: rgba(0,0,0,0.65);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}

.cam-pill:hover, .cam-pill.active-cam {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.sightline-overlay {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(10,10,10,0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 12px;
  z-index: 5;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sightline-overlay span {
  color: var(--text-dim);
}
.sightline-overlay strong {
  color: var(--accent);
}

/* RIGHT: Control Panel (Floating) */
#control-pane {
  position: absolute;
  right: 20px;
  top: 20px;
  bottom: 20px;
  width: 380px;
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

/* Top bar of control panel */
.panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-family: var(--font-primary);
  font-size: 1.2rem;
  color: var(--accent);
  margin: 0;
}

.unit-toggle {
  display: flex;
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  padding: 3px;
}
.unit-toggle span {
  padding: 4px 12px;
  font-size: 11px;
  border-radius: 15px;
  cursor: pointer;
  color: var(--text-dim);
  transition: 0.2s;
}
.unit-toggle span.active {
  background: var(--accent);
  color: #000;
  font-weight: bold;
}

/* Accordion Styling */
.accordion-item {
  border-bottom: 1px solid var(--border);
}

.accordion-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
  transition: background 0.2s;
  font-size: 12px;
}

.accordion-header:hover {
  background: rgba(212, 168, 26, 0.05);
}

.accordion-header i {
  color: var(--accent);
  transition: transform 0.3s ease;
}

.accordion-header.active i {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  background: rgba(255,255,255,0.01);
}

.accordion-item.open .accordion-body {
  padding: 16px 20px 24px;
  max-height: 500px;
}

/* Form Controls inside Accordion */
.ctrl-group {
  margin-bottom: 20px;
}
.ctrl-group:last-child {
  margin-bottom: 0;
}

.ctrl-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}
.ctrl-label { color: var(--text-dim); }
.ctrl-val { color: var(--accent); font-weight: bold; }

/* Custom Shadcn-Style Sliders */
.custom-slider-container {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.slider-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.slider-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.slider-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type=range].custom-slider {
  -webkit-appearance: none;
  flex-grow: 1;
  /* Apply the track background to the input itself to avoid WebKit pseudo-element repaint bugs */
  background: var(--track-bg, rgba(255,255,255,0.1));
  background-size: 100% 8px;
  background-position: center;
  background-repeat: no-repeat;
  margin: 0;
  height: 24px; /* hit area */
}

input[type=range].custom-slider:focus {
  outline: none;
}

input[type=range].custom-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: transparent;
  border-radius: 4px;
}

input[type=range].custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: #000;
  cursor: pointer;
  margin-top: -6px; /* (trackHeight 8 - thumbHeight 20)/2 */
  transition: transform 0.1s;
}

input[type=range].custom-slider:active::-webkit-slider-thumb {
  transform: scale(1.1);
}

input[type=range].custom-slider:focus-visible::-webkit-slider-thumb {
  outline: 3px solid rgba(212, 168, 26, 0.4);
  outline-offset: 2px;
}

/* Firefox Support */
input[type=range].custom-slider::-moz-range-track {
  width: 100%;
  height: 8px;
  cursor: pointer;
  background: transparent;
  border-radius: 4px;
}

input[type=range].custom-slider::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: #000;
  cursor: pointer;
}

.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.stepper-label {
  font-size: 12px;
  color: var(--text-dim);
}
.stepper-ctrl {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.05);
  padding: 4px 6px;
  border-radius: 6px;
}
.stepper-btn {
  background: none; border: none; color: var(--accent);
  cursor: pointer; padding: 0 6px; font-size: 14px;
}
.stepper-val {
  font-weight: bold; min-width: 16px; text-align: center; font-size: 12px;
}

/* Bottom Action */
.panel-footer {
  padding: 20px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(212, 168, 26, 0.05);
}

.btn-save {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-weight: bold;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-save:hover {
  background: var(--accent2);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Responsive */
@media (max-width: 991px) {
  #control-pane { width: 320px; }
}

@media (max-width: 768px) {
  #designer-wrapper {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
  }
  #canvas-pane {
    position: relative;
    width: 100%;
    height: 45vh;
  }
  #control-pane {
    position: relative;
    inset: auto;
    width: 100%;
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--panel-solid);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    z-index: auto;
    flex: 1;
  }
}

/* ================================================================
   LEAD CAPTURE MODAL & DOWNLOAD BUTTON
================================================================ */
.download-plan-btn {
  display: block;
  width: 100%;
  padding: 18px;
  background: #c9a84c;
  color: #080808;
  border: none;
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 8px;
  transition: background 200ms ease;
}

.download-plan-btn:hover { background: #e0c06a; }

.lead-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.lead-modal {
  background: rgba(13, 13, 13, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(201, 168, 76, 0.3);
  width: 100%;
  max-width: 460px;
  padding: 40px;
  position: relative;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.lead-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #666;
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 200ms;
}
.lead-modal-close:hover { color: #c9a84c; }

.lead-modal-logo {
  width: 60px;
  margin-bottom: 16px;
}

.lead-modal-header h2 {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 1.6rem;
  color: #c9a84c;
  margin: 0 0 8px;
}

.lead-modal-header p {
  color: #888;
  font-size: 0.85rem;
  margin: 0 0 28px;
  line-height: 1.5;
}

.lead-field {
  margin-bottom: 20px;
}

.lead-field label {
  display: block;
  color: #999;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.lead-field input {
  width: 100%;
  background: rgba(17, 17, 17, 0.5);
  border: 1px solid rgba(42, 42, 42, 0.8);
  color: #fff;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: var(--font-primary);
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 200ms;
}

.lead-field input:focus {
  border-color: #c9a84c;
}

.phone-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(17, 17, 17, 0.5);
  border: 1px solid rgba(42, 42, 42, 0.8);
  border-radius: 8px;
  transition: border-color 200ms;
}

.phone-input-wrap:focus-within { border-color: #c9a84c; }

.phone-prefix {
  color: #c9a84c;
  padding: 12px 12px 12px 16px;
  font-size: 0.95rem;
  border-right: 1px solid #2a2a2a;
  white-space: nowrap;
}

.phone-input-wrap input {
  border: none;
  background: transparent;
  flex: 1;
}

.phone-input-wrap input:focus { border: none; }

.lead-error {
  color: #ff4444;
  font-size: 0.82rem;
  margin: -8px 0 16px;
}

.lead-submit-btn {
  width: 100%;
  padding: 16px;
  background: #c9a84c;
  color: #080808;
  border: none;
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 8px;
  transition: background 200ms;
  margin-top: 8px;
}

.lead-submit-btn:hover { background: #e0c06a; }
.lead-submit-btn:disabled {
  background: #555;
  color: #333;
  cursor: not-allowed;
}

.lead-privacy {
  color: #444;
  font-size: 0.75rem;
  text-align: center;
  margin: 12px 0 0;
}
