/* =========================================================================
 * Strumenti della mappa: registrazione tracce, orientamento, vista 3D
 * ========================================================================= */

/* ------------------------- Controlli sulla mappa ------------------------ */

.track-control a.is-recording,
.track-control.is-recording a {
  color: #e74c3c;
}

.track-control a .fa-circle {
  font-size: 13px;
  vertical-align: middle;
}

.track-control.is-recording a .fa-circle {
  color: #e74c3c;
  animation: track-recording-pulse 1.2s ease-in-out infinite;
}

@keyframes track-recording-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.orientation-arrow {
  display: inline-block;
  transition: transform 0.12s linear;
}

.orientation-control a {
  font-size: 16px;
  line-height: 26px;
  color: #2c3e50;
}

.orientation-control a:hover,
.orientation-control a:focus {
  color: #3498db;
}

.map3d-control a {
  font-size: 15px;
  font-weight: 700;
  line-height: 26px;
  color: #2c3e50;
}

.map3d-control a:hover,
.map3d-control a:focus {
  color: #3498db;
}

/* ------------------------- Pannelli (sheet) ----------------------------- */

.track-panel {
  position: fixed;
  right: 50%;
  bottom: 0;
  z-index: 2200;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 460px;
  max-height: 82vh;
  font-family: sans-serif;
  font-size: 13px;
  color: #2c3e50;
  background: #fff;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.35);
  transform: translateX(50%);
}

.track-panel[hidden] {
  display: none !important;
}

.track-panel__header {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: #fff;
  background: #2c3e50;
  border-radius: 14px 14px 0 0;
}

.track-panel__title {
  font-size: 14px;
  font-weight: 600;
}

.track-panel__title .fa {
  margin-right: 4px;
}

.track-panel__close {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 22px;
  line-height: 26px;
  color: #fff;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.track-panel__close:hover,
.track-panel__close:focus {
  background: rgba(255, 255, 255, 0.18);
}

.track-panel__body {
  flex: 1 1 auto;
  padding: 12px 14px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.track-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.track-field label {
  font-size: 12px;
  font-weight: 600;
  color: #566b7e;
}

.track-field input[type="text"] {
  box-sizing: border-box;
  width: 100%;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 13px;
  color: #2c3e50;
  background: #f7f9fa;
  border: 1px solid #cfd8df;
  border-radius: 7px;
}

.track-field input[type="text"]:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* ------------------------------ Statistiche ----------------------------- */

.track-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.track-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: #f7f9fa;
  border: 1px solid #e6eaee;
  border-radius: 8px;
}

.track-stat__label {
  font-size: 10.5px;
  font-weight: 600;
  color: #7b8b9a;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.track-stat__value {
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
}

.track-follow {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: #566b7e;
}

.track-status {
  margin: 4px 0 10px;
  font-size: 12px;
  color: #566b7e;
  overflow-wrap: anywhere;
}

.track-hint-text {
  color: #7b8b9a;
  font-style: italic;
}

.track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.track-btn {
  display: inline-flex;
  flex: 1 1 auto;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  cursor: pointer;
  background: #eef2f5;
  border: 0;
  border-radius: 8px;
}

.track-btn:hover:not(:disabled),
.track-btn:focus:not(:disabled) {
  background: #e2e8ed;
}

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

.track-btn--primary {
  color: #fff;
  background: #e74c3c;
}

.track-btn--primary:hover:not(:disabled),
.track-btn--primary:focus:not(:disabled) {
  background: #d63d2d;
}

.track-btn--save {
  color: #fff;
  background: #3498db;
}

.track-btn--save:hover:not(:disabled),
.track-btn--save:focus:not(:disabled) {
  background: #2f89c5;
}

.track-btn--danger {
  color: #fff;
  background: #c82333;
}

.track-btn--danger:hover:not(:disabled),
.track-btn--danger:focus:not(:disabled) {
  background: #b01c2a;
}

.track-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.track-mode.is-active {
  color: #fff;
  background: #3498db;
}

/* -------------------------------- Vista 3D ------------------------------ */

.map3d-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  background: #0b1620;
}

.map3d-overlay[hidden] {
  display: none !important;
}

.map3d-header {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  color: #fff;
  background: #1f2d3a;
}

.map3d-title {
  font-family: sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.map3d-title .fa {
  margin-right: 4px;
}

.map3d-close {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 30px;
  color: #fff;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 50%;
}

.map3d-close:hover,
.map3d-close:focus {
  background: rgba(255, 255, 255, 0.15);
}

.map3d-canvas {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.map3d-status {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  max-width: 86%;
  padding: 12px 16px;
  font-family: sans-serif;
  font-size: 13px;
  color: #fff;
  text-align: center;
  background: rgba(20, 30, 40, 0.88);
  border-radius: 10px;
  transform: translate(-50%, -50%);
}

.map3d-status[hidden] {
  display: none !important;
}

.map3d-attribution-note {
  font-size: 10.5px;
  color: #9fb0bf;
}

@media (min-width: 700px) {
  .track-panel {
    right: 12px;
    bottom: 12px;
    border-radius: 12px;
    transform: none;
  }

  .track-panel__header {
    border-radius: 12px 12px 0 0;
  }
}

@media (max-height: 480px) {
  .track-panel {
    max-height: 94vh;
  }

  .track-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
