/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0c1445, #1a1a2e, #16213e);
  color: #ffffff;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #ffd700, #87ceeb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-header p {
  font-size: 1.1rem;
  opacity: 0.8;
}

/* Main content */
.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  padding: 20px;
  height: calc(100vh - 120px);
}

/* Controls panel */
.controls-panel {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(15px);
  border-radius: 15px;
  padding: 25px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  max-height: 100%;
}

.controls-panel h3 {
  margin-bottom: 20px;
  color: #87ceeb;
  font-size: 1.3rem;
  text-align: center;
}

/* Filter section */
.filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.filter-control {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-control label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: #e6e6fa;
  font-size: 0.9rem;
}

/* Dual slider styles */
.dual-slider-container {
  margin-bottom: 10px;
}

.dual-slider {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-bottom: 15px;
}

.dual-slider input[type="range"] {
  position: absolute;
  width: 100%;
  height: 6px;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.dual-slider input[type="range"]::-webkit-slider-thumb {
  pointer-events: all;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #87ceeb;
  cursor: pointer;
  -webkit-appearance: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.dual-slider input[type="range"]::-webkit-slider-thumb:hover {
  background: #add8e6;
  transform: scale(1.1);
}

.dual-slider input[type="range"]::-moz-range-thumb {
  pointer-events: all;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #87ceeb;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

/* Slider values display */
.dual-slider-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #b0c4de;
}

.slider-value {
  background: rgba(135, 206, 235, 0.2);
  padding: 4px 8px;
  border-radius: 6px;
  min-width: 45px;
  text-align: center;
  font-weight: 600;
  border: 1px solid rgba(135, 206, 235, 0.3);
}

.slider-separator {
  color: #87ceeb;
  font-weight: 500;
}

.slider-unit {
  color: #ffd700;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Slider labels */
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #9370db;
  margin-top: 8px;
}

/* Filter actions */
.filter-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  text-align: center;
}

.stars-count {
  margin-top: 15px;
  font-size: 0.9rem;
  color: #87ceeb;
  padding: 8px 12px;
  background: rgba(135, 206, 235, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(135, 206, 235, 0.2);
}

/* Location section */
.location-section {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.location-info {
  margin-top: 15px;
  padding: 12px;
  background: rgba(135, 206, 235, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(135, 206, 235, 0.2);
}

.location-info p {
  margin: 5px 0;
  font-size: 0.9rem;
}

/* Star map container */
.star-map-container {
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
}

.map-controls {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
}

.zoom-controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#star-map {
  flex: 1;
  width: 100%;
  height: 100%;
  cursor: grab;
  background: radial-gradient(ellipse at center, #001122 0%, #000000 70%);
}

#star-map:active {
  cursor: grabbing;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, #4a90e2, #357abd);
  color: white;
  box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #357abd, #2968a3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1.2rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Star info modal */
.star-info-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 25, 45, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 15px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  max-width: 400px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.star-info-content {
  padding: 25px;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: #87ceeb;
  font-size: 1.5rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(135, 206, 235, 0.2);
  transform: scale(1.1);
}

#star-name {
  color: #ffd700;
  margin-bottom: 20px;
  font-size: 1.5rem;
  padding-right: 40px;
}

.star-details {
  line-height: 1.8;
  color: #e6e6fa;
}

.star-details strong {
  color: #87ceeb;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Responsive design */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 300px 1fr;
  }

  .controls-panel {
    padding: 20px;
  }
}

@media (max-width: 768px) {
  .app-header h1 {
    font-size: 2rem;
  }

  .main-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: calc(100vh - 120px);
  }

  .controls-panel {
    order: 2;
    max-height: none;
    margin-top: 20px;
  }

  .star-map-container {
    order: 1;
    height: 400px;
  }

  .filter-grid {
    gap: 15px;
  }

  .filter-control {
    padding: 12px;
  }

  .filter-control label {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }

  .dual-slider-values {
    font-size: 0.8rem;
  }

  .slider-value {
    min-width: 40px;
    font-size: 0.8rem;
    padding: 3px 6px;
  }

  .star-info-modal {
    width: 95%;
    max-width: none;
  }

  .star-info-content {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 15px;
  }

  .app-header h1 {
    font-size: 1.7rem;
  }

  .main-content {
    padding: 15px;
    gap: 15px;
  }

  .controls-panel {
    padding: 15px;
  }

  .filter-grid {
    gap: 12px;
  }

  .filter-control {
    padding: 10px;
  }

  .dual-slider-values {
    flex-wrap: wrap;
    gap: 6px;
  }

  .slider-value {
    min-width: 35px;
  }

  .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  .btn-icon {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }

  .zoom-controls {
    gap: 3px;
  }

  .map-controls {
    top: 10px;
    right: 10px;
  }
}

/* Loading animation */
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

.star-twinkle {
  animation: twinkle 2s infinite;
}

/* Scrollbar styling */
.controls-panel::-webkit-scrollbar {
  width: 6px;
}

.controls-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb {
  background: rgba(135, 206, 235, 0.5);
  border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(135, 206, 235, 0.7);
}

/* Lägg till dessa CSS-regler längst ner i filen: */

/* Modal styles */
.modal {
  padding: 0;
  border: none;
  border-radius: 15px;
  background: transparent;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  /* ✅ LÄGG TILL DESSA för korrekt centrering */
  margin: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  position: fixed;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: linear-gradient(135deg, #0c1445, #1a1a2e);
  color: #ffffff;
  padding: 30px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
}

.close-button {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: #87ceeb;
  font-size: 1.5rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 10; /* ✅ Säkerställ att X-knappen syns */
}

.close-button:hover {
  background: rgba(135, 206, 235, 0.2);
  transform: scale(1.1);
}

.modal-content h1 {
  color: #ffd700;
  margin-bottom: 10px;
  font-size: 1.8rem;
}

.modal-content h2 {
  color: #87ceeb;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.modal-content h3 {
  color: #87ceeb;
  margin: 25px 0 15px 0;
  font-size: 1.2rem;
}

.modal-content p {
  line-height: 1.6;
  margin-bottom: 15px;
  color: #e6e6fa;
}

.modal-content a {
  color: #87ceeb;
  text-decoration: none;
  font-weight: 600;
}

.modal-content a:hover {
  color: #add8e6;
  text-decoration: underline;
}

/* Contact form styles */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.form-control,
.contact-textarea {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 0.9rem;
  font-family: inherit;
}

.form-control::placeholder,
.contact-textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.form-control:focus,
.contact-textarea:focus {
  outline: none;
  border-color: #87ceeb;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(135, 206, 235, 0.2);
}

.contact-button {
  padding: 12px 24px;
  background: linear-gradient(135deg, #4a90e2, #357abd);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.contact-button:hover {
  background: linear-gradient(135deg, #357abd, #2968a3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal {
    width: 95%;
    max-width: none;
  }

  .modal-content {
    padding: 25px;
  }

  .modal-content h1 {
    font-size: 1.5rem;
  }

  .modal-content h2 {
    font-size: 1.1rem;
  }
}
