* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: #0f172a;
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px;
}

.app-container {
  width: 100%;
  max-width: 832px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0 auto;
}

.app-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.app-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #38bdf8;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.current-year-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: 1.1rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none; /* Nu blocheaza click-ul pe harta */
}

.current-year-badge .label {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
}

.current-year-badge .year-val {
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.viewer-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.viewer-section:fullscreen,
.viewer-section:-webkit-full-screen {
  background: #0f172a;
  border: none;
  border-radius: 0;
  padding: 20px;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Grupează și centrează tot conținutul pe verticală în centrul ecranului */
  gap: 20px;
  overflow: auto;
}

.viewer-section:fullscreen .map-frame,
.viewer-section:-webkit-full-screen .map-frame {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.viewer-section:fullscreen .controls-panel,
.viewer-section:-webkit-full-screen .controls-panel {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.map-frame {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background: #090d16;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.map-frame:hover {
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
}

.map-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  cursor: pointer;
}

.map-image.base-layer {
  position: relative;
  z-index: 1;
  margin: 0 auto;
}

.map-image.overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  margin: auto;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #334155;
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 4px;
}

.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #334155;
  outline: none;
  cursor: pointer;
  transition: background 0.15s;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
  transition: transform 0.1s, background-color 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #7dd3fc;
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #38bdf8;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
  transition: transform 0.1s, background-color 0.1s;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #64748b;
  user-select: none;
  padding: 0 2px;
}

.timeline-labels span.active {
  color: #38bdf8;
  font-weight: 600;
}

.playback-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.buttons-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 0;
  justify-content: flex-start;
}

.control-btn {
  background: #334155;
  border: 1px solid #475569;
  color: #f8fafc;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.control-btn:hover {
  background: #475569;
  border-color: #64748b;
  transform: translateY(-1px);
}

.control-btn:active {
  transform: translateY(1px);
}

.control-btn.play-btn {
  width: 52px;
  height: 52px;
  background: #0284c7;
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

.control-btn.play-btn:hover {
  background: #0369a1;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.6);
}

.toggles-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
}

.toggle-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background-color 0.15s;
}

.toggle-option:hover {
  background-color: rgba(51, 65, 85, 0.4);
}

.toggle-option input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #38bdf8;
}

.speed-selector {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 0.85rem;
  color: #94a3b8;
  flex: 1 1 0;
}

.speed-selector select {
  background: #334155;
  color: #f1f5f9;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
}

.speed-selector select:focus {
  border-color: #38bdf8;
}

.controls-legend {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.7);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  text-align: center;
}

.legend-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.legend-category {
  font-size: 0.82rem;
  font-weight: 600;
  color: #38bdf8;
  min-width: 95px;
  text-align: right;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: #e2e8f0;
}

.legend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  color: #f1f5f9;
  flex-shrink: 0;
}

kbd {
  background: #334155;
  color: #f8fafc;
  border: 1px solid #475569;
  border-bottom: 2px solid #1e293b;
  border-radius: 4px;
  padding: 2px 7px;
  font-family: inherit;
  font-size: 0.78rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.legend-desc {
  color: #94a3b8;
}

.legend-desc::before {
  content: "—";
  margin-right: 5px;
  color: #64748b;
}

.app-footer {
  margin-top: 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: #64748b;
}

.app-footer a {
  color: #38bdf8;
  text-decoration: none;
  transition: color 0.15s;
}

.app-footer a:hover {
  text-decoration: underline;
  color: #7dd3fc;
}

.author-info {
  font-weight: 500;
  color: #94a3b8;
}

/* Tablet & Mobile responsive */
@media (max-width: 680px) {
  .playback-controls {
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }
  .buttons-row {
    justify-content: center;
    flex: unset;
  }
  .speed-selector {
    justify-content: center;
    flex: unset;
  }
  .legend-row {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  .legend-category {
    text-align: center;
    min-width: unset;
  }
}

@media (max-width: 520px) {
  body {
    padding: 10px 8px;
  }
  .app-title {
    font-size: 1.5rem;
  }
  .toggles-group {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .legend-items {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
}
