/* ==========================================================================
   Sunrise & Sunset Tool - Tool-Specific Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tool Container Layout
   -------------------------------------------------------------------------- */
.tool-container {
  display: flex;
  max-height: 700px;
  background-color: var(--bg);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.tool-sidebar {
  width: 380px;
  background-color: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.sidebar-content {
  padding: 20px;
}

.sidebar-content label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-content label:first-of-type {
  margin-top: 0;
}

.tool-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tool-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.tool-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Input Section
   -------------------------------------------------------------------------- */
.input-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--card) 100%);
  margin: -20px -20px 28px -20px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Suggestions Dropdown
   -------------------------------------------------------------------------- */
.input-with-suggestions {
  position: relative;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.suggestions.show {
  display: block;
}

.suggestions .item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.suggestions .item:last-child {
  border-bottom: none;
}

.suggestions .item:hover {
  background: var(--hover-bg);
}

/* --------------------------------------------------------------------------
   Date Navigation
   -------------------------------------------------------------------------- */
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.date-nav input[type="date"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.date-nav button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.date-nav button:hover {
  background: var(--hover-bg);
  border-color: var(--primary);
}

/* --------------------------------------------------------------------------
   Result Card
   -------------------------------------------------------------------------- */
.result-card {
  background: var(--glass);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.result-location {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.result-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Sun times grid */
.sun-times-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.sun-time-item {
  text-align: center;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.sun-time-item.sunrise {
  border-left: 3px solid #f97316;
}

.sun-time-item.sunset {
  border-left: 3px solid #8b5cf6;
}

.sun-time-item.dawn {
  border-left: 3px solid #fb923c;
}

.sun-time-item.dusk {
  border-left: 3px solid #a78bfa;
}

.sun-time-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.sun-time-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

/* Day length highlight */
.day-length {
  text-align: center;
  padding: 12px;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(139, 92, 246, 0.1));
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.day-length-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.day-length-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* Golden hour & solar noon */
.extra-times {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.extra-time-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.extra-time-item .label {
  color: var(--text-muted);
}

.extra-time-item .value {
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Sun Details Section
   -------------------------------------------------------------------------- */
.sun-details-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sun-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.sun-detail-item .label {
  color: var(--text-muted);
}

.sun-detail-item .value {
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Moon Section
   -------------------------------------------------------------------------- */
.moon-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.moon-phase-display {
  text-align: center;
  margin-bottom: 12px;
}

.moon-phase-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 4px;
}

.moon-phase-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.moon-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.moon-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.moon-detail-item .label {
  color: var(--text-muted);
}

.moon-detail-item .value {
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Tool Info / Attribution
   -------------------------------------------------------------------------- */
.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
}

.tool-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 8px 0;
  line-height: 1.5;
}

.tool-info p:last-child {
  margin-bottom: 0;
}

.tool-info a {
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Terms Section
   -------------------------------------------------------------------------- */
.terms-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.term-item {
  padding: 10px 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.term-item strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 2px;
}

.term-item span {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Button Groups
   -------------------------------------------------------------------------- */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Map Container
   -------------------------------------------------------------------------- */
.map-container {
  max-height: calc(100vh - 120px);
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 500px;
  max-height: 700px;
}

.map {
  width: 100%;
  height: 100%;
  min-height: 500px;
}

#map .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

/* --------------------------------------------------------------------------
   Mobile FAB
   -------------------------------------------------------------------------- */
.fab {
  display: none;
  width: 56px;
  height: 56px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 9999;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .tool-container {
    flex-direction: column;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    height: auto;
  }

  .tool-sidebar {
    width: 100%;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .tool-sidebar.collapsed {
    max-height: 0;
    overflow: hidden;
  }

  .map-container {
    max-height: calc(100vh - 120px);
    flex: none;
    height: 400px;
    min-height: 350px;
    max-height: 400px;
  }

  .map {
    min-height: 350px;
    height: 400px;
  }

  .fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 600px) {
  .sidebar-content {
    padding: 16px;
  }

  .input-section {
    margin: -16px -16px 24px -16px;
    padding: 16px;
  }

  .tool-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
  }

  .map-container {
    max-height: calc(100vh - 120px);
    height: 350px;
    min-height: 300px;
    max-height: 350px;
  }

  .map {
    min-height: 300px;
    height: 350px;
  }

  .sun-times-grid {
    grid-template-columns: 1fr;
  }

  .day-length-value {
    font-size: 1.25rem;
  }
}
