/* ═══════════════════════════════════════════════════
   FX_PC — Design System
   Siyah · Turuncu · Beyaz — FXCLUP Design Language
   ═══════════════════════════════════════════════════ */

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-tertiary: #1a1a24;
  --bg-card: #14141e;
  --bg-input: #1e1e2a;
  --bg-hover: #222233;
  --bg-overlay: rgba(0, 0, 0, 0.85);

  --accent: #FF6B00;
  --accent-light: #FF8A33;
  --accent-dark: #CC5500;
  --accent-glow: rgba(255, 107, 0, 0.3);
  --accent-bg: rgba(255, 107, 0, 0.08);

  --text-primary: #FFFFFF;
  --text-secondary: #a0a0b8;
  --text-muted: #666680;
  --text-accent: #FF6B00;

  --success: #00D68F;
  --danger: #FF3D71;
  --warning: #FFAA00;
  --info: #3366FF;

  --border: #2a2a3a;
  --border-light: #333348;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* ── Reset ──────────────────────────────────────── */

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

html, body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100%;
  height: 100dvh;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Screen System ──────────────────────────────── */

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform: translateY(10px);
  z-index: 1;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  z-index: 10;
}

/* Remote screen: flex column with viewport growing and controls at bottom */
#remote-screen.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: none;
}

/* ── Splash Screen ──────────────────────────────── */

#splash-screen {
  background: var(--bg-primary);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.splash-content {
  text-align: center;
}

.logo-icon {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
}

.logo-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 50%;
  animation: pulse-ring 2s ease-out infinite;
}

.ring-2 {
  animation-delay: 0.5s;
}

.logo-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 2px;
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.splash-title {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 3px;
}

.accent {
  color: var(--accent);
}

.splash-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.splash-loader {
  margin-top: 48px;
  width: 200px;
  margin-left: auto;
  margin-right: auto;
}

.loader-bar {
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.loader-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 3px;
  animation: load-bar 2s ease-in-out forwards;
}

@keyframes load-bar {
  0% { width: 0; }
  50% { width: 60%; }
  100% { width: 100%; }
}

/* ── Login Screen ───────────────────────────────── */

#login-screen {
  background: var(--bg-primary);
  justify-content: center;
  align-items: center;
}

.login-container {
  width: 100%;
  max-width: 380px;
  padding: 32px 24px;
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 3px;
}

.login-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

/* ── Buttons ────────────────────────────────────── */

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-accent {
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-accent:hover {
  background: var(--accent-light);
}

.btn-ghost {
  padding: 12px 20px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-outline {
  padding: 12px 24px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: var(--accent-bg);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.icon-btn-sm {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

.icon-btn-sm:hover {
  background: rgba(255,255,255,0.15);
}

.btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-primary.loading .btn-text { display: none; }
.btn-primary.loading .btn-loader { display: inline-block; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

.security-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 32px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Top Bar ────────────────────────────────────── */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
}

.top-right {
  display: flex;
  gap: 8px;
}

/* ── Screen Body ────────────────────────────────── */

.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* ── Stats Bar ──────────────────────────────────── */

.stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-item {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ── Pair Section ───────────────────────────────── */

.pair-section {
  margin-bottom: 20px;
}

.pair-input-row {
  display: flex;
  gap: 10px;
}

.pair-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.pair-input:focus {
  border-color: var(--accent);
}

/* ── Host List ──────────────────────────────────── */

.host-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.host-card {
  display: flex;
  align-items: center;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.host-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.host-card:active {
  transform: scale(0.98);
}

.host-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.host-info {
  flex: 1;
  min-width: 0;
}

.host-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.host-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.host-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.host-delete {
  margin-left: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary, #888);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.host-delete:hover {
  background: #c0392b;
  border-color: #c0392b;
  color: #fff;
}

.host-delete:active {
  transform: scale(0.92);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(0, 214, 143, 0.5);
}

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

.status-dot.offline {
  background: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state p {
  margin: 16px 0;
}

.hidden {
  display: none !important;
}

/* ── Modal ──────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

.os-selector {
  display: flex;
  gap: 10px;
}

.os-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  transition: all 0.2s;
}

.os-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.os-btn.selected {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ── Audit List ─────────────────────────────────── */

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-item {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.audit-type {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.audit-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.audit-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.7;
}

/* ── Animations ─────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.host-card {
  animation: fadeIn 0.3s ease backwards;
}

.host-card:nth-child(1) { animation-delay: 0.05s; }
.host-card:nth-child(2) { animation-delay: 0.1s; }
.host-card:nth-child(3) { animation-delay: 0.15s; }

/* ── Scrollbar ──────────────────────────────────── */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
