/* RainDotCity Remote — Design System Layer */

:root {
  --ok: #3dd6c6;
  --warn: #ffb35c;
  --err: #ff5c7c;
  --info: #56c8ff;
}

body {
  background:
    radial-gradient(60% 45% at 75% -10%, rgba(157, 123, 255, 0.12), transparent 65%),
    radial-gradient(50% 40% at 15% 0%, rgba(255, 79, 154, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

/* Utilities matching existing tokens */
.text-fg { color: var(--text); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-cyan { color: var(--cyan); }
.text-teal { color: var(--teal); }
.text-violet { color: var(--violet); }
.text-warn { color: var(--sun); }
.text-err { color: var(--err); }
.bg-surface { background: var(--surface); }
.bg-surface-2 { background: var(--surface-2); }
.border-line { border-color: var(--border); }
.border-line-strong { border-color: var(--border-strong); }

/* Header & Sidebar refinements */
.rcc-brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 79, 154, 0.22), rgba(157, 123, 255, 0.24));
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: 0 6px 20px -10px rgba(255, 79, 154, 0.65);
  flex-shrink: 0;
}

.rcc-bridge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  white-space: nowrap;
}

.rcc-bridge-pill[data-live="true"] {
  border-color: rgba(61, 214, 198, 0.35);
  background: rgba(61, 214, 198, 0.08);
  color: var(--teal);
}

/* Status Dots */
.rcc-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}
.rcc-dot-online { background: var(--teal); box-shadow: 0 0 8px rgba(61, 214, 198, 0.7); }
.rcc-dot-connected { background: var(--cyan); box-shadow: 0 0 9px rgba(86, 200, 255, 0.85); }
.rcc-dot-offline { background: var(--text-dim); opacity: 0.65; }
.rcc-dot-checking { background: var(--sun); animation: rcc-pulse 1s ease-in-out infinite; }

@keyframes rcc-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Buttons & Inputs */
.rcc-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px -12px rgba(255, 79, 154, 0.7);
  transition: transform 0.12s ease, opacity 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
}
.rcc-btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }
.rcc-btn-primary:active { transform: translateY(0); }

.rcc-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.5rem;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  font-size: 0.8rem;
  padding: 0.48rem 0.82rem;
  border: 1px solid var(--border-strong);
  transition: background-color 0.15s, border-color 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.rcc-btn-secondary:hover { background: var(--surface-3); border-color: rgba(205, 190, 255, 0.35); }

.rcc-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.38rem 0.68rem;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.rcc-btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}
.rcc-btn-ghost[data-active="true"] {
  border-color: rgba(255, 79, 154, 0.55);
  background: rgba(255, 79, 154, 0.12);
  color: var(--text);
}

.rcc-input, .rcc-select, .rcc-textarea {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  padding: 0.5rem 0.75rem;
  font-size: 0.84rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rcc-input:focus, .rcc-select:focus, .rcc-textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 2px rgba(157, 123, 255, 0.2);
}
.rcc-select option {
  background: var(--surface);
  color: var(--text);
}

/* Workspace Session Tab Bar */
.rcc-tabbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 10, 23, 0.78);
  backdrop-filter: blur(12px);
  overflow-x: auto;
  scrollbar-width: thin;
}
@media (max-width: 640px) {
  .rcc-tabbar { padding: 0.5rem 1rem; }
}

.rcc-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.75rem;
  border-radius: 0.45rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.rcc-tab:hover {
  background: var(--surface-2);
  color: var(--text);
}
.rcc-tab[data-active="true"] {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.rcc-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}
.rcc-tab-close:hover {
  background: rgba(255, 92, 124, 0.22);
  color: var(--err);
}

/* Grids & Cards */
.rcc-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}
@media (max-width: 900px) {
  .rcc-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.rcc-stat-card {
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(22, 19, 41, 0.85), rgba(16, 14, 31, 0.92));
  padding: 0.95rem 1.1rem;
}

.rcc-devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.rcc-device-card {
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(22, 19, 41, 0.86), rgba(16, 14, 31, 0.96));
  padding: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.rcc-device-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.rcc-device-card[data-connected="true"] {
  border-color: rgba(86, 200, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(86, 200, 255, 0.15), var(--shadow);
}

.rcc-device-icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--violet);
  flex-shrink: 0;
}

.rcc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16rem 0.52rem;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
}

.rcc-badge-proto {
  color: var(--cyan);
  border-color: rgba(86, 200, 255, 0.28);
  background: rgba(86, 200, 255, 0.09);
}

.rcc-badge-local {
  color: var(--teal);
  border-color: rgba(61, 214, 198, 0.32);
  background: rgba(61, 214, 198, 0.1);
}

/* Remote Session Viewport */
.rcc-session-shell {
  border-radius: 0.75rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 540px;
  box-shadow: var(--shadow);
}

.rcc-session-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.rcc-mode-pills {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 0.5rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  gap: 0.2rem;
}

.rcc-mode-btn {
  padding: 0.32rem 0.7rem;
  border-radius: 0.38rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.rcc-mode-btn[data-active="true"] {
  background: var(--surface-3);
  color: var(--text);
}

/* Web Terminal */
.rcc-terminal-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #06060b;
  min-height: 440px;
}

.rcc-terminal-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 14, 31, 0.65);
}

.rcc-terminal-output {
  flex: 1;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-y: auto;
  max-height: 420px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e4e1f0;
}

.rcc-term-line-cmd { color: var(--cyan); font-weight: 600; }
.rcc-term-line-err { color: var(--err); }
.rcc-term-line-sys { color: var(--text-dim); }

.rcc-terminal-input-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  background: #0b0a14;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.rcc-terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Remote Screen / Web Frame */
.rcc-screen-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 460px;
  background: #050509;
}

.rcc-iframe {
  width: 100%;
  flex: 1;
  min-height: 460px;
  border: none;
  background: #0b0a17;
}

/* Table / File Explorer */
.rcc-table-wrap {
  width: 100%;
  overflow-x: auto;
}
.rcc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.rcc-table th {
  text-align: left;
  padding: 0.65rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: rgba(16, 14, 31, 0.6);
}
.rcc-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.rcc-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

/* Modals & Toasts */
.rcc-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 4, 10, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.rcc-modal-backdrop.hidden { display: none; }

.rcc-modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 0.8rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.rcc-toast-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 4.5rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
@media (min-width: 1024px) {
  .rcc-toast-stack { bottom: 1.25rem; }
}
.rcc-toast {
  pointer-events: auto;
  padding: 0.65rem 0.95rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8rem;
  box-shadow: var(--shadow);
  animation: rcc-fadein 0.18s ease;
}
@keyframes rcc-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.cursor-none { cursor: none; }
#rcc-desk-stage, #rcc-cam-stage {
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}
#rcc-live-screen, #rcc-cam-img {
  width: 100%;
  height: auto;
  max-height: 76vh;
  object-fit: contain;
  display: block;
}
.rcc-float-win {
  position: fixed;
  z-index: 55;
  width: min(960px, 90vw);
  min-width: 420px;
  min-height: 300px;
  max-width: 98vw;
  max-height: 94vh;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(157, 123, 255, 0.25);
  display: flex;
  flex-direction: column;
}
.rcc-win-resize {
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 20;
}
.rcc-resize-nw { top: 0; left: 0; cursor: nwse-resize; }
.rcc-resize-ne { top: 0; right: 0; cursor: nesw-resize; }
.rcc-resize-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.rcc-resize-se { bottom: 0; right: 0; cursor: nwse-resize; }
.rcc-resize-se::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(157, 123, 255, 0.7);
  border-bottom: 2px solid rgba(157, 123, 255, 0.7);
  border-radius: 0 0 2px 0;
}
.rcc-float-win.rcc-win-max {
  top: 1rem !important;
  left: 1rem !important;
  width: calc(100vw - 2rem) !important;
  height: calc(100vh - 2rem) !important;
}
.rcc-float-win.rcc-win-max .rcc-win-resize { display: none; }
.rcc-float-win #rcc-desk-stage,
.rcc-float-win #rcc-cam-stage {
  flex: 1;
  min-height: 0;
}
.rcc-float-win #rcc-live-screen,
.rcc-float-win #rcc-cam-img {
  max-height: 100%;
  max-width: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.rcc-win-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
}
.rcc-win-titlebar:active { cursor: grabbing; }
#rcc-desk-container:fullscreen,
#rcc-cam-container:fullscreen { background: #040408; padding: 0.75rem; width: 100vw !important; height: 100vh !important; }
#rcc-desk-container:fullscreen #rcc-desk-stage,
#rcc-cam-container:fullscreen #rcc-cam-stage { max-height: calc(100vh - 7rem); }
#rcc-desk-container:fullscreen #rcc-live-screen,
#rcc-cam-container:fullscreen #rcc-cam-img { max-height: calc(100vh - 7.5rem); max-width: 100%; }

.rcc-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 92, 124, 0.45);
  background: rgba(255, 92, 124, 0.14);
  color: var(--err);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.46rem 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.rcc-btn-danger:hover {
  background: rgba(255, 92, 124, 0.25);
  border-color: rgba(255, 92, 124, 0.75);
}
.rcc-btn-primary:disabled,
.rcc-btn-secondary:disabled,
.rcc-btn-ghost:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.rcc-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.9rem;
}
.rcc-tool-card {
  text-align: left;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, background-color 0.15s;
}
.rcc-tool-card:hover {
  border-color: rgba(157, 123, 255, 0.55);
  background: var(--surface-3);
  transform: translateY(-2px);
}
.rcc-badge-new {
  border-color: rgba(255, 79, 154, 0.55);
  background: rgba(255, 79, 154, 0.14);
  color: #ff8bc2;
}
.rcc-meter {
  width: 100%;
  height: 0.45rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.rcc-meter-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--teal), var(--cyan), var(--violet));
  transition: width 0.25s ease;
}
