/**
 * SPEEDNET PLANNER - MAIN STYLES
 * Responsive design for desktop and mobile
 */

:root {
  --primary-color: #0066cc;
  --secondary-color: #00b33c;
  --danger-color: #d9534f;
  --warning-color: #f0ad4e;
  --dark: #2c3e50;
  --light: #ecf0f1;
  --border-color: #bdc3c7;
  --text-color: #34495e;
  --bg-color: #fff;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
  background-color: var(--bg-color);
  overflow: hidden;
}

html, body, #app-container {
  width: 100%;
  height: 100vh;
}

#app-container {
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.header {
  background: linear-gradient(135deg, var(--primary-color), #004d99);
  color: white;
  padding: 1rem;
  box-shadow: var(--shadow);
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.logo h1 {
  font-size: 1.8rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo p {
  font-size: 0.85rem;
  margin: 0.25rem 0 0 0;
  opacity: 0.9;
}

.header-actions {
  display: flex;
  gap: 1rem;
}

/* ===== MAIN LAYOUT ===== */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 320px;
  background-color: var(--light);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 50;
}

.sidebar-content {
  padding: 1rem;
}

.panel {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.panel h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== FORM CONTROLS ===== */
.form-control {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 5px rgba(0, 102, 204, 0.3);
}

textarea.form-control {
  resize: vertical;
  min-height: 60px;
}

.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.form-group input[type="checkbox"] {
  margin-right: 0.5rem;
  cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: #0052a3;
}

.btn-success {
  background-color: var(--secondary-color);
  color: white;
}

.btn-success:hover {
  background-color: #009929;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-danger, .tool-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover, .tool-danger:hover {
  background-color: #c9302c;
}

.btn-large {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
}

/* ===== TOOL BUTTONS ===== */
.tool-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.tool-btn {
  padding: 0.6rem;
  border: 2px solid var(--border-color);
  background-color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--dark);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.tool-btn:hover {
  border-color: var(--primary-color);
  background-color: #f8fbff;
}

.tool-btn.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.tool-btn i {
  font-size: 1.2rem;
}

/* ===== MEASUREMENTS DISPLAY ===== */
.measurement-display {
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.75rem;
  font-size: 0.9rem;
}

.measurement-display p {
  margin: 0.5rem 0;
}

.measurement-display strong {
  color: var(--primary-color);
}

/* ===== OBJECTS LIST ===== */
.objects-list {
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.85rem;
}

.objects-list .object-item {
  padding: 0.5rem;
  background-color: #f9f9f9;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.objects-list .object-item:last-child {
  border-bottom: none;
}

.objects-list .object-item button {
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  font-size: 0.8rem;
}

.empty-message {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 1rem 0;
  margin: 0;
}

/* ===== MAP CONTAINER ===== */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* ===== MAP CONTROLS ===== */
.map-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.map-control-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: white;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--dark);
  transition: background-color 0.3s ease;
}

.map-control-btn:last-child {
  border-bottom: none;
}

.map-control-btn:hover {
  background-color: var(--light);
}

/* ===== SEARCH BOX ===== */
.search-box {
  position: absolute;
  top: 1rem;
  left: 340px;
  width: 300px;
  z-index: 30;
}

#search-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

#search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 8px rgba(0, 102, 204, 0.3);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  margin-top: -1px;
}

.search-results .result-item {
  padding: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  transition: background-color 0.2s;
}

.search-results .result-item:hover {
  background-color: var(--light);
}

.search-results .result-item:last-child {
  border-bottom: none;
}

/* ===== INFO PANEL ===== */
.info-panel {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.75rem;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  z-index: 30;
}

.info-panel p {
  margin: 0.25rem 0;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #999;
}

.modal-close:hover {
  color: var(--dark);
}

.modal h2 {
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

.results-content {
  margin-bottom: 1.5rem;
}

.results-content h3 {
  color: var(--dark);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.results-content p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner p {
  margin-top: 1rem;
  color: var(--dark);
  font-weight: 600;
}

/* ===== NOTIFICATIONS ===== */
.notifications {
  position: fixed;
  top: 80px;
  right: 1rem;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notification {
  padding: 1rem;
  border-radius: 4px;
  color: white;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease-out;
  min-width: 300px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification.success {
  background-color: var(--secondary-color);
}

.notification.error {
  background-color: var(--danger-color);
}

.notification.warning {
  background-color: var(--warning-color);
  color: var(--dark);
}

.notification.info {
  background-color: var(--primary-color);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 280px;
  }

  .search-box {
    left: 1rem;
    width: calc(100% - 2rem);
  }

  .map-controls {
    top: 5.5rem;
    right: 0.5rem;
  }

  .info-panel {
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .modal-content {
    margin: 1rem;
    max-width: calc(100% - 2rem);
  }

  .tool-group {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .sidebar {
    width: 100%;
    position: absolute;
    height: 60%;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 60;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .main-layout {
    flex-direction: column;
  }

  .map-container {
    width: 100%;
  }

  .search-box {
    left: 0.5rem;
    width: calc(100% - 1rem);
  }

  .notifications {
    right: 0;
    left: 0;
    width: 100%;
    top: auto;
    bottom: 0;
  }

  .notification {
    min-width: auto;
    border-radius: 0;
  }

  .modal-content {
    padding: 1rem;
  }
}

/* ===== MODULE 2-4 STYLES ===== */
.ap-panel, .bridge-panel, .heatmap-panel {
  margin-top: 1rem;
}

.ap-panel h3, .bridge-panel h3, .heatmap-panel h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ap-list-panel, .bridges-list-panel {
  max-height: 250px;
  overflow-y: auto;
  background-color: #f9f9f9;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.5rem 0;
}

.ap-item, .bridge-item {
  padding: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.ap-item:last-child, .bridge-item:last-child {
  border-bottom: none;
}

.ap-item-info, .bridge-item-info {
  flex: 1;
}

.ap-item-name {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.ap-item-details {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.4;
}

.bridge-item-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  margin-right: 0.5rem;
}

.bridge-valid {
  background-color: #d4edda;
  color: #155724;
}

.bridge-invalid {
  background-color: #f8d7da;
  color: #721c24;
}

.ap-actions, .bridge-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  background-color: #e8e8e8;
  color: #333;
  transition: all 0.2s;
}

.action-btn:hover {
  background-color: #d0d0d0;
}

.action-btn.delete {
  color: #d9534f;
}

.action-btn.delete:hover {
  background-color: #faddd7;
}

.empty-message {
  padding: 1rem;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  font-style: italic;
}

.heatmap-info {
  font-size: 0.85rem;
  padding: 0.5rem;
  background: #f9f9f9;
  border-radius: 4px;
  margin-top: 0.5rem;
}

.heatmap-info p {
  margin: 0.25rem 0;
}

.heatmap-info strong {
  color: var(--primary-color);
}

/* ===== MODULES 5-8 STYLES ===== */
.auto-design-panel, .device-profiles-panel, .project-reports-panel {
  margin-top: 1rem;
}

.auto-design-panel h3, .device-profiles-panel h3, .project-reports-panel h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: var(--dark);
}

.form-control {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  background: white;
  color: var(--dark);
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.btn {
  padding: 0.6rem 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: #0052a3;
}

.btn-success {
  background-color: var(--secondary-color);
  color: white;
}

.btn-success:hover {
  background-color: #008c2e;
}

.btn-info {
  background-color: #17a2b8;
  color: white;
}

.btn-info:hover {
  background-color: #138496;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-warning {
  background-color: #ffc107;
  color: #333;
}

.btn-warning:hover {
  background-color: #e0a800;
}

.device-profile-item {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 0.5rem;
  background: #f9f9f9;
}

.device-profile-name {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.device-profile-spec {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.3;
}

.project-item {
  padding: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  transition: background-color 0.2s;
}

.project-item:hover {
  background-color: #f9f9f9;
}

.project-item-name {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.project-item-meta {
  font-size: 0.75rem;
  color: #999;
}

/* ===== LEAFLET OVERRIDES ===== */
.leaflet-control-layers-toggle::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle><circle cx="5" cy="12" r="1"></circle></svg>');
}

.leaflet-draw-toolbar {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.leaflet-draw-toolbar a {
  width: 36px;
  height: 36px;
  border: none;
  border-right: 1px solid #ccc;
}

.leaflet-draw-toolbar a:hover {
  background-color: var(--light);
}

.leaflet-draw-toolbar a.leaflet-draw-edit-edit {
  border-right: none;
}
