﻿/* ═══════════════════════════════════════════════════════════════════
   urlrelay.de — Onyx Design System
   ─────────────────────────────────────────────────────────────────
   Stylecard (Token Reference)
   ─────────────────────────────────────────────────────────────────
   Background layers (darkest → lightest):
     --bg            #0c0d10   Page canvas
     --surface       #131620   Cards, panels, sidebar
     --surface-2     #1c2035   Elevated elements (tab active, hover)
     --surface-3     #232840   Highest elevation (dropdowns)

   Borders:
     --border        rgba(255,255,255,.07)   Default separator
     --border-strong rgba(255,255,255,.12)   Inputs, cards

   Typography:
     --text          #e8eaf0   Primary
     --text-2        #6b7491   Secondary / muted
     --text-3        #3d4260   Tertiary / placeholder

   Accent (blue):
     --accent        #3b82f6
     --accent-hover  #2563eb
     --accent-dim    rgba(59,130,246,.12)
     --accent-border rgba(59,130,246,.25)

   Status — Live:
     --live          #22d37e
     --live-bg       rgba(34,211,126,.07)
     --live-border   rgba(34,211,126,.22)
     --live-text     #22d37e

   Status — Danger:
     --danger        #f87171
     --danger-bg     rgba(248,113,113,.10)
     --danger-border rgba(248,113,113,.20)

   Shape:
     --r-sm  8px   Inputs, badges, small buttons
     --r     12px  Cards, panels
     --r-lg  16px  Auth card, modals

   Elevation:
     --shadow-sm  0 1px 4px rgba(0,0,0,.4)
     --shadow     0 8px 32px rgba(0,0,0,.5)
     --shadow-lg  0 24px 64px rgba(0,0,0,.65)
═══════════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* Backgrounds */
  --bg: #0c0d10;
  --surface: #131620;
  --surface-2: #1c2035;
  --surface-3: #232840;
  --surface-secondary: #1c2035;

  /* Borders */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* Text */
  --text: #e8eaf0;
  --text-secondary: #6b7491;
  --text-tertiary: #3d4260;

  /* Accent */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-text: #ffffff;
  --accent-dim: rgba(59, 130, 246, 0.12);
  --accent-border: rgba(59, 130, 246, 0.25);

  /* Live */
  --live: #22d37e;
  --live-bg: rgba(34, 211, 126, 0.07);
  --live-border: rgba(34, 211, 126, 0.22);
  --live-text: #22d37e;

  /* Danger */
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --danger-border: rgba(248, 113, 113, 0.22);

  /* Shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  /* Elevation */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.65);

  /* Layout */
  --topbar-height: 52px;
  --sidebar-width: 260px;
}

html {
  min-height: 100%;
  font-size: 15px;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family:
    -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Brand TLD dimming */
.brand-tld {
  opacity: 0.35;
}

/* Topbar logo icon */
.topbar-logo {
  margin-right: 7px;
  vertical-align: middle;
  flex-shrink: 0;
  display: inline-block;
}

button,
input,
a {
  font: inherit;
}
h1,
h2,
h3,
p {
  margin: 0;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.hidden {
  display: none !important;
}

/* -- Auth ------------------------------------------------ */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  width: 48px;
  height: 48px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.auth-brand h1 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-brand p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 7px 12px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.auth-tab.is-active {
  background: var(--surface-2);
  color: var(--text);
}

.auth-form {
  display: grid;
  gap: 14px;
}

/* -- Fields & Inputs ------------------------------------- */

.field {
  display: grid;
  gap: 5px;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.9375rem;
  color: var(--text);
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.field input::placeholder {
  color: var(--text-tertiary);
}

.form-error {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--danger);
  min-height: 1.1em;
}

.form-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 2px;
}

/* -- Buttons --------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn-block {
  width: 100%;
  padding: 11px 16px;
  font-size: 1rem;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.17);
}

.btn-icon {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background 0.15s;
}

.btn-icon:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* -- Topbar ---------------------------------------------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: rgba(15, 17, 22, 0.85);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 100;
}

.topbar-brand {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-email {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* -- App layout ------------------------------------------ */

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

.workspace {
  display: flex;
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
}

/* -- Sidebar --------------------------------------------- */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
}

.sidebar-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.create-form {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 10px;
  background: var(--surface-2);
  flex-shrink: 0;
}

.overlay-list {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.overlay-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}

.overlay-card:hover {
  background: var(--surface-2);
}
.overlay-card.is-selected {
  background: var(--accent-dim);
}
.overlay-card-info {
  flex: 1;
  min-width: 0;
}

.overlay-card-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overlay-card-path {
  display: block;
  font-size: 0.73rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  font-family: ui-monospace, "SF Mono", "Fira Code", "Courier New", monospace;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
}

.status-dot.live {
  background: var(--live);
}

.status-dot.paused {
  background: #f59e0b;
}

.empty-sidebar {
  padding: 20px 16px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-align: center;
}

.cap-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0;
}

/* -- Main content ---------------------------------------- */

.main-content {
  flex: 1;
  padding: 36px 40px;
  overflow-y: auto;
}

.empty-state-panel {
  padding-top: 96px;
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}

.empty-icon {
  width: 52px;
  height: 52px;
  background: var(--surface-2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-tertiary);
  font-size: 22px;
}

.empty-state-panel h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state-panel p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* -- Overlay detail -------------------------------------- */

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.detail-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.live-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.live-url-link {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-family: "SF Mono", ui-monospace, "Fira Code", "Courier New", monospace;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-url-link:hover {
  color: var(--accent);
}

/* -- Active banner --------------------------------------- */

.active-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.2s,
    background 0.2s;
}

.active-banner-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.active-banner.live {
  border-color: var(--live-border);
  background: var(--live-bg);
}

.active-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
  transition:
    background 0.2s,
    box-shadow 0.2s;
}

.active-banner.live .active-indicator {
  background: var(--live);
  box-shadow: 0 0 0 4px rgba(34, 211, 126, 0.16);
}

.active-label {
  display: block;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.active-banner.live .active-label {
  color: var(--live-text);
}

.active-content strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.active-content p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 3px;
  word-break: break-all;
}

.source-preview-wrap {
  position: relative;
  height: 240px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--live-border);
  background: var(--surface-secondary);
}

.source-preview {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* -- Sources --------------------------------------------- */

.sources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sources-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.source-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.sources-list {
  display: grid;
  gap: 10px;
}

.source-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}

.source-card.is-active {
  border-color: var(--live-border);
  background: var(--live-bg);
}

.source-card-body {
  flex: 1;
  min-width: 0;
}

.source-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-card-url {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "SF Mono", ui-monospace, "Fira Code", "Courier New", monospace;
  margin-top: 3px;
  text-decoration: none;
}

.source-card-url:hover {
  color: var(--accent);
  text-decoration: underline;
}

.source-card-note {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.source-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.source-empty {
  padding: 28px 20px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* -- Notification toast ---------------------------------- */

.notification {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow);
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 200;
  white-space: nowrap;
  max-width: 90vw;
}

.notification.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.notification.is-error {
  background: var(--danger);
}

/* -- Modal ----------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 300;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  display: grid;
  gap: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.modal-form {
  display: grid;
  gap: 14px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* -- Live waiting page ----------------------------------- */

.live-body {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.live-waiting {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px;
}

.live-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 22px;
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.4);
    opacity: 1;
  }
}

.live-waiting h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.live-waiting p {
  font-size: 0.875rem;
  line-height: 1.6;
}
