/* planner-style.css - Updated for Right-Side Control Panel + Mobile Map Fix */
/* Main wrap: Flex for side-by-side layout */
.ccctv-planner-wrap {
  position: relative;
  font-family: Arial, sans-serif;
}
.ccctv-planner-wrap.cctv-layout-flex {
  display: flex;
  height: 70vh; /* Desktop default */
  overflow: hidden;
  min-height: 100vh; /* UPDATED: Ensures full viewport on mobile */
}
#ccctv-map {
  width: 100%;
  height: 70vh;
  background: #eee;
  border: 1px solid #ddd;
  flex: 1;
  position: relative;
  z-index: 1;
}
/* Top-left controls */
.ccctv-top-left {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  margin: 6px;
  background: rgba(255,255,255,0.95);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.ccctv-header {
  text-align: center;
  margin: 8px 0;
}
/* Buttons */
.ccctv-btn {
  border: 0;
  background: #0b57d0;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: opacity 0.2s ease;
}
.ccctv-btn:hover, .ccctv-btn:active {
  opacity: 0.95;
}
.ccctv-btn.secondary {
  background: #6c757d;
}
.ccctv-btn.secondary.active {
  background: #dc3545;
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
.ccctv-btn.danger {
  background: #ff4444;
}
.ccctv-btn.primary {
  background: #1e88e5;
}
/* Right panel */
.ccctv-right-panel {
  width: 350px;
  background: #fff;
  border-left: 1px solid #eee;
  box-shadow: -2px 0 8px rgba(0,0,0,0.06);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  z-index: 5;
  transition: transform 0.3s ease;
}
.ccctv-panel-toggle {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  color: #495057;
  padding: 12px;
  text-align: center;
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  margin-bottom: 10px;
  display: none;
  touch-action: manipulation;
}
.ccctv-panel-toggle:hover {
  background: #e9ecef;
}
#ccctv-panel-inner.collapsed {
  display: none;
}
#ccctv-panel-inner {
  max-width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ccctv-panel-empty {
  text-align: center;
  color: #666;
  padding: 20px;
  font-style: italic;
}
#ccctv-camera-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
/* Form rows */
.ccctv-row {
  display: block;
  margin-bottom: 6px;
}
.ccctv-row label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: #333;
  font-weight: 600;
}
.ccctv-row input[type="text"],
.ccctv-row input[type="number"],
.ccctv-row select {
  width: 100%;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-height: 40px;
  font-size: 14px;
  touch-action: manipulation;
}
.ccctv-row input[type="range"] {
  padding: 0;
  width: 100%;
  height: 8px;
}
.ccctv-row input[type="color"] {
  width: 50px;
  height: 30px;
  padding: 2px;
}
/* Multi-col */
.ccctv-row.two-col,
.ccctv-row.three-col {
  display: flex;
  gap: 10px;
  flex-direction: row;
}
.ccctv-row.two-col > div,
.ccctv-row.three-col > div {
  flex: 1;
}
/* Sensor types */
.ccctv-sensor-types {
  display: flex;
  gap: 15px;
  font-size: 14px;
}
.ccctv-sensor-types label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-weight: normal;
  min-height: 44px;
  padding: 4px;
}
/* Overlap checkbox */
.ccctv-row:has(#cam-show-overlap) {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.ccctv-row:has(#cam-show-overlap) label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-weight: normal;
  min-height: 44px;
}
/* Buttons row */
.ccctv-row.buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: stretch;
}
.ccctv-row.buttons .ccctv-btn {
  padding: 8px 12px;
  flex: 1;
  text-align: center;
}
/* Range value */
#cam-range-value {
  font-weight: bold;
  color: #0b57d0;
  margin-left: 10px;
}
/* Responsive: UPDATED for Mobile Map Fix */
@media (max-width: 768px) {
  .ccctv-planner-wrap.cctv-layout-flex {
    flex-direction: column;
    height: auto; /* Allow natural height */
    min-height: 100vh; /* UPDATED: Full screen to prevent collapse */
  }
  .ccctv-right-panel {
    width: 100%;
    border-left: none;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    max-height: 50vh;
    padding: 10px;
  }
  .ccctv-panel-toggle {
    display: block;
  }
  .ccctv-panel-inner.collapsed {
    display: none;
  }
  .ccctv-top-left {
    flex-direction: row;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    flex-wrap: wrap;
  }
  .ccctv-row.two-col,
  .ccctv-row.three-col {
    flex-direction: column;
    gap: 6px;
  }
  #ccctv-map {
    height: 50vh !important; /* UPDATED: Force height with !important for mobile */
    flex: none; /* UPDATED: Prevent flex-grow from overriding */
    position: relative; /* UPDATED: For flexbox compatibility */
  }
  .ccctv-sensor-types {
    flex-direction: column;
    gap: 5px;
  }
  .ccctv-row input[type="text"],
  .ccctv-row input[type="number"],
  .ccctv-row select {
    font-size: 16px;
  }
}
/* Scrollbar */
.ccctv-right-panel::-webkit-scrollbar {
  width: 6px;
}
.ccctv-right-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}
.ccctv-right-panel::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}
.ccctv-right-panel::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
/* Wire styles */
.ccctv-wire-polyline {
  stroke-dasharray: 5, 5;
}
/* Storage marker hover */
.ccctv-storage-marker:hover {
  z-index: 1000;
}
/* Help Modal Styles */
.ccctv-modal {
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
}
.ccctv-modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 600px;
  border-radius: 8px;
  max-height: 80vh;
  overflow-y: auto;
}
.ccctv-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.ccctv-close:hover,
.ccctv-close:focus {
  color: black;
}
#ccctv-help-instructions h3 {
  color: #0b57d0;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}
#ccctv-help-instructions p {
  line-height: 1.5;
  margin-bottom: 10px;
}
/* Wire edit glow */
.gm-style .gm-line-editable {
  stroke: #ff0000 !important;
  stroke-width: 4px !important;
  filter: drop-shadow(0 0 3px #1e88e5);
}