/*
 * OATES web port — shell chrome.
 * Styles the "desktop" that hosts the window iframes, the modal backdrops,
 * the replacement dialogs, toasts, splash, and the closed screen.
 */

:root {
  --oates-accent: #3a76d8;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #2b2b30;
  font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* ---- Desktop that holds the windows ---- */
#oates-desktop {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, #34343b 0%, #232327 100%);
  overflow: hidden;
}

/* ---- Windows (iframes) — centred frameless cards ---- */
iframe.oates-window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100vw;
  max-height: 100vh;
  border: 0;
  border-radius: 12px;
  background: rgb(133, 133, 138);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

iframe.oates-window.fullscreen {
  top: 0; left: 0;
  transform: none;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

iframe.oates-window.modal {
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

/* ---- Modal backdrop ---- */
.oates-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(1px);
}

/* On small/tablet screens fit windows to the viewport with a small margin. */
@media (max-width: 1040px), (max-height: 800px) {
  iframe.oates-window {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
}

/* ---- Replacement dialogs (dialog.showMessageBox) ---- */
#oates-dialog-root { position: fixed; inset: 0; z-index: 100000; pointer-events: none; }
.oates-dialog-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
}
.oates-dialog {
  min-width: 300px; max-width: min(90vw, 460px);
  background: #fff; color: #1c1c1e;
  border-radius: 14px;
  padding: 22px 22px 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  font-size: 15px;
  animation: oates-pop 0.14s ease-out;
}
@keyframes oates-pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.oates-dialog-title { font-weight: 700; font-size: 17px; margin-bottom: 8px; }
.oates-dialog-detail { line-height: 1.4; margin-bottom: 18px; white-space: pre-wrap; color: #3a3a3c; }
.oates-dialog-buttons { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.oates-dialog-btn {
  appearance: none; border: 0; cursor: pointer;
  padding: 9px 18px; border-radius: 9px;
  background: #e4e4e8; color: #1c1c1e;
  font-size: 15px; font-weight: 600;
}
.oates-dialog-btn.default { background: var(--oates-accent); color: #fff; }
.oates-dialog-btn:active { transform: translateY(1px); }

/* ---- Toast (Notification fallback) ---- */
.oates-toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 100001;
  max-width: 320px;
  background: #1c1c1e; color: #fff;
  border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  transform: translateY(140%); opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.oates-toast.show { transform: translateY(0); opacity: 1; }
.oates-toast strong { display: block; font-size: 14px; margin-bottom: 3px; }
.oates-toast span { font-size: 13px; color: #d0d0d4; }

/* ---- Splash ---- */
#oates-splash {
  position: fixed; inset: 0; z-index: 200000;
  background: #232327;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
#oates-splash.hidden { opacity: 0; pointer-events: none; }
#oates-splash .splash-art {
  width: min(700px, 92vw); height: min(450px, 60vh);
  background: url("../assets/icons/oates-splash.svg") center/contain no-repeat;
}
#oates-splash-status {
  position: absolute; left: 0; right: 0; bottom: 6vh;
  text-align: center; color: #fff; font-weight: 300; font-size: 14px;
}

/* ---- Closed screen ---- */
#oates-closed {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; color: #fff; background: #232327;
}
#oates-closed .onero-logo {
  width: 96px; height: 96px;
  background: url("../assets/icons/onero.256.png") center/contain no-repeat;
}
#oates-closed button {
  appearance: none; border: 0; cursor: pointer;
  padding: 10px 22px; border-radius: 9px;
  background: var(--oates-accent); color: #fff; font-size: 15px; font-weight: 600;
}
