/* =====================================================================
   RemoteControl Dashboard — Styles
   Dark GitHub-inspired theme with blue accents
   ===================================================================== */

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

:root {
  --bg:        #0d1117;
  --bg-card:   #161b22;
  --bg-input:  #21262d;
  --border:    #30363d;
  --accent:    #1f6feb;
  --accent-lt: #58a6ff;
  --green:     #3fb950;
  --red:       #f85149;
  --yellow:    #d29922;
  --text:      #e6edf3;
  --text-muted:#8b949e;
  --radius:    8px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-lt);
  letter-spacing: -0.3px;
}

.topbar-logo span { color: var(--text-muted); font-weight: 400; }

.topbar-url {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 12px;
  font-size: 13px;
  outline: none;
  max-width: 380px;
}
.topbar-url:focus { border-color: var(--accent); }

.btn {
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .85; }
.btn-primary  { background: var(--accent);   color: #fff; }
.btn-danger   { background: #6e2020;         color: var(--red); }
.btn-ghost    { background: var(--bg-input); color: var(--text); }

/* Status pill */
.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.status-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-pill.connected .dot  { background: var(--green); }
.status-pill.connected      { color: var(--green); }
.status-pill.connecting .dot { background: var(--yellow); animation: pulse 1s infinite; }
.status-pill.connecting      { color: var(--yellow); }
.status-pill.error .dot      { background: var(--red); }
.status-pill.error           { color: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

/* Device info */
.device-info {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Main layout ──────────────────────────────────────────────────── */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Screen panel (center) ────────────────────────────────────────── */
.screen-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #090d13;
  position: relative;
  overflow: hidden;
}

.phone-frame {
  position: relative;
  background: #1a1a2e;
  border-radius: 36px;
  border: 3px solid var(--border);
  box-shadow: 0 0 60px rgba(31,111,235,.15), 0 20px 60px rgba(0,0,0,.6);
  overflow: hidden;
}

/* Video from Android device */
#remoteVideo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Transparent click overlay */
#clickOverlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  z-index: 10;
}

/* Touch ripple animation */
.touch-ripple {
  position: absolute;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: ripple 0.5s ease-out forwards;
  z-index: 20;
}
@keyframes ripple {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* Disconnected overlay */
.disconnected-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(13,17,23,.92);
  z-index: 30;
  gap: 12px;
  color: var(--text-muted);
}
.disconnected-overlay .icon { font-size: 48px; }
.disconnected-overlay p { font-size: 14px; text-align: center; max-width: 220px; line-height: 1.5; }

/* ── Control sidebar (right) ──────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Nav buttons grid */
.nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.nav-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 4px;
  cursor: pointer;
  font-size: 11px;
  text-align: center;
  transition: background .15s, border-color .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.nav-btn:hover { background: var(--border); border-color: var(--accent); }
.nav-btn .icon { font-size: 18px; }

/* Volume row */
.vol-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Text inject */
.text-inject textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px;
  font-size: 13px;
  resize: vertical;
  min-height: 64px;
  outline: none;
  margin-bottom: 6px;
}
.text-inject textarea:focus { border-color: var(--accent); }

/* Wake button */
.btn-wake {
  width: 100%;
  background: #1c2a1c;
  color: var(--green);
  border: 1px solid #234023;
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
}
.btn-wake:hover { background: #23342a; }

/* Swipe buttons */
.swipe-cross {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 4px;
  place-items: center;
}
.swipe-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  width: 52px; height: 36px;
  cursor: pointer;
  font-size: 16px;
  transition: background .15s;
}
.swipe-btn:hover { background: var(--border); }
.swipe-center { grid-column: 2; grid-row: 2; }

/* Quality badge */
.quality-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.quality-bar .bar-track {
  flex: 1; height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
}
.quality-bar .bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  width: 0%;
  transition: width .5s;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
