/* Cache Status Panel styles */

.main-layout {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.left-panels {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cache-status-panel {
  width: 280px;
  min-width: 240px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px 12px 10px 12px;
  color: var(--primary-color);
  font-family: 'Courier New', monospace;
  display: none; /* Ausgeblendet */
  flex-direction: column;
  max-height: calc(100vh - 200px);
  overflow: auto;
  font-size: 0.8rem;
}

.cache-status-panel .cs-header {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.cache-status-panel .cs-location {
  color: var(--text-dim);
  font-size: 0.9em;
  margin-bottom: 12px;
}

.cache-status-panel .cs-section {
  margin-bottom: 12px;
}

.cache-status-panel .cs-section-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.cache-status-panel .cs-time-range {
  margin-left: 8px;
  color: var(--text-dim);
  line-height: 1.2;
}

.cache-status-panel .cs-kinds-section {
  margin-top: 8px;
}

.cache-status-panel .cs-kind {
  margin-bottom: 8px;
}

.cache-status-panel .cs-kind .head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.cache-status-panel .cs-kind:last-child {
  border-bottom: none;
}

.cache-status-panel .cs-kind .name {
  font-weight: 600;
}

.cache-status-panel .cs-kind .counts {
  color: var(--primary-color);
}

.cache-status-panel .cs-kind .range {
  color: var(--text-dim);
  font-size: 0.9em;
}

.cache-status-panel .cs-error {
  color: #ff7070;
}

/* Cache precompute section */
.cache-precompute {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.cache-precompute-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.cache-precompute-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cache-precompute-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cache-precompute-label {
  flex: 0 0 80px;
  font-size: 0.8rem;
}

.cache-precompute-input {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  padding: 4px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
}

.cache-precompute-button {
  background: var(--panel-bg);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  margin-top: 5px;
  align-self: flex-end;
}

.cache-precompute-button:hover {
  background: rgba(0, 255, 0, 0.1);
}

/* Progress indicator */
.cache-progress {
  margin-top: 10px;
}

.cache-progress-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin: 5px 0;
}

.cache-progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.5s ease;
}

.cache-progress-status {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.cache-progress-details {
  margin-top: 5px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Ensure the sky container flexes next to the panel, with width independent of content.
   flex-basis: 0 verhindert, dass Schriftgrößen-Änderungen (Zoom) die Breite verändern. */
.main-layout .sky-container {
  flex: 1 1 0;
  min-width: 0; /* allow flex overflow shrinking */
}

@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
  }
  .cache-status-panel {
    width: 100%;
    max-height: none;
    order: 2; /* Ensures it appears after the sky container */
    margin-top: 15px;
  }
  .main-layout .sky-container {
    order: 1; /* Ensures it appears before the cache panel */
  }
}

/* On very wide screens, place the panels in the left free margin (outside the content box)
   so the sky container keeps its full width. */
@media (min-width: 1600px) {
  .main-layout {
    position: relative;
  }
  .main-layout .left-panels {
    position: absolute;
    right: 100%; /* anchor to the left side of the content */
    margin-right: 16px; /* keep the same gap */
    top: 0;
  }
}
