/*
 * Shared Atlas / Hermes / Iris / Prometheus connectivity recovery surface.
 * Intentionally self-contained: this file may load before any application theme.
 */

.atlas-connection-panel[hidden],
.atlas-connection-panel [hidden],
.atlas-connection-shield[hidden] {
  display: none !important;
}

.atlas-connection-shield {
  position: fixed;
  inset: 0;
  z-index: 2147483645;
  background: rgba(4, 9, 13, .82);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.atlas-connection-panel {
  --connection-accent: #dcb46a;
  --connection-edge: rgba(221, 180, 106, .38);
  position: fixed;
  z-index: 2147483646;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(560px, calc(100vw - 48px));
  box-sizing: border-box;
  padding: 20px 22px;
  color: #f1f3ef;
  background: #142027;
  border: 1px solid rgba(177, 199, 194, .22);
  border-top: 2px solid var(--connection-accent);
  border-radius: 12px;
  box-shadow: 0 18px 58px rgba(0, 0, 0, .48), 0 2px 10px rgba(0, 0, 0, .25);
  font-family: "DM Sans", "Segoe UI", sans-serif;
  isolation: isolate;
}

.atlas-connection-panel.is-restored {
  --connection-accent: #83bd91;
  --connection-edge: rgba(131, 189, 145, .38);
}

.atlas-connection-panel.is-restricted {
  --connection-accent: #e27d78;
  --connection-edge: rgba(226, 125, 120, .42);
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  width: min(560px, calc(100vw - 40px));
  transform: translate(-50%, -50%);
}

.atlas-connection-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.atlas-connection-title {
  display: block;
  margin: 0;
  color: #f4f5f0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .005em;
}

.atlas-connection-message {
  margin: 6px 0 0;
  color: #c0ccca;
  font-size: .84rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.atlas-connection-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.atlas-connection-actions button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: #e5ece8;
  background: #202f36;
  border: 1px solid rgba(181, 201, 196, .29);
  border-radius: 7px;
  font: 650 .78rem/1.2 "DM Sans", "Segoe UI", sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.atlas-connection-actions button:hover:not(:disabled) {
  background: #2a3d44;
  border-color: rgba(202, 221, 213, .48);
}

.atlas-connection-actions button:active:not(:disabled) {
  transform: translateY(1px);
}

.atlas-connection-actions button:focus-visible {
  outline: 2px solid var(--connection-accent);
  outline-offset: 3px;
}

.atlas-connection-actions button:disabled {
  opacity: .52;
  cursor: not-allowed;
}

#atlas-connection-retry {
  color: #f0e4c9;
  background: #3a3326;
  border-color: var(--connection-edge);
}

#atlas-connection-retry:hover:not(:disabled) {
  background: #49402e;
}

.atlas-connection-panel.is-restored #atlas-connection-retry {
  color: #ddf0e0;
  background: #263b31;
}

.atlas-connection-panel.is-restricted #atlas-connection-retry {
  color: #f6dcda;
  background: #432d30;
}

.atlas-connection-panel.is-checking #atlas-connection-retry {
  opacity: .72;
  cursor: progress;
}

@media (max-width: 700px) {
  .atlas-connection-panel {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    width: auto;
    gap: 14px;
    padding: 16px;
  }

  .atlas-connection-panel.is-restricted {
    top: 50%;
    right: max(12px, env(safe-area-inset-right));
    bottom: auto;
    left: max(12px, env(safe-area-inset-left));
    width: auto;
    transform: translateY(-50%);
  }
}

@media (max-width: 480px) {
  .atlas-connection-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    border-radius: 10px;
  }

  .atlas-connection-title {
    font-size: .94rem;
  }

  .atlas-connection-message {
    margin-top: 4px;
    font-size: .8rem;
  }

  .atlas-connection-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .atlas-connection-actions button {
    min-width: 0;
    padding: 0 9px;
    white-space: normal;
  }
}

@media (max-width: 390px) {
  .atlas-connection-panel {
    gap: 10px;
    padding: 13px;
  }

  .atlas-connection-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-connection-actions button {
    transition: none;
  }
}
