/* Remotly - Theme Blanc & Bleu / Noir, Gris & Bleu */
:root {
  --bg: #f8fafc;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --header-bg: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --line: #e2e8f0;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --phone-bezel: #0f172a;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
  --bg: #0b0f19;
  --sidebar-bg: #111827;
  --card-bg: #161f30;
  --card-border: #1e293b;
  --header-bg: #111827;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.15);
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --line: #1e293b;
  --success: #34d399;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #fbbf24;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --phone-bezel: #020617;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.brand {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.brand-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 18px;
}
.brand-name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
}
.brand-badge {
  font-size: 10px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-links {
  list-style: none;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav-item.active {
  background: var(--primary);
  color: #ffffff;
}
.nav-icon {
  font-size: 17px;
}
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--line);
  color: var(--text-secondary);
}
.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.sidebar-bottom {
  padding: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.btn-install {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 11px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-install:hover {
  background: var(--primary);
  color: #fff;
}
.user-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--line);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 12px;
  flex-shrink: 0;
}
.user-email {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

/* Main Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

/* Topbar */
.topbar {
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.view-title {
  font-size: 18px;
  font-weight: 800;
}
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 14px;
  gap: 8px;
  width: 260px;
}
.search-box input {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  width: 100%;
}
.search-box input:focus { outline: none; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stats-pills {
  display: flex;
  gap: 8px;
}
.stat-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-pill.online { background: var(--success-bg); color: var(--success); border-color: transparent; }
.stat-pill.warn { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.stat-pill.offline { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.theme-toggle {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
  font-size: 15px;
}

/* Content */
.content {
  padding: 28px;
  flex: 1;
}

/* Cards & Components */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

/* Onboarding Hero */
.onboarding-hero {
  border: 2px dashed var(--line);
  border-radius: 20px;
  padding: 48px 32px;
  text-align: center;
  max-width: 780px;
  margin: 30px auto;
  background: var(--card-bg);
}
.onboarding-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.onboarding-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}
.onboarding-desc {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 36px;
  text-align: left;
}
.step-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 12px;
}
.step-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}
.step-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.cmd-box {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  padding: 14px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto 20px;
  max-width: 600px;
  border: 1px solid #1e293b;
}
.cmd-box code { color: #60a5fa; }
.btn-copy-cmd {
  background: #1e293b;
  color: #fff;
  border: 0;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-copy-cmd:hover { background: var(--primary); }

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border: 0;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
button.primary {
  background: var(--primary);
  color: #ffffff;
}
button.primary:hover {
  background: var(--primary-hover);
}
button.secondary {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
}
button.secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}
button.ghost {
  background: transparent;
  color: var(--text-secondary);
}
button.ghost:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Grid & Phones */
.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.box-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
}
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.device-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.device-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.device-card.offline {
  opacity: 0.6;
}
.device-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.slot-badge {
  font-size: 12px;
  font-weight: 800;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 8px;
  border-radius: 6px;
}
.device-model {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}
.device-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.device-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  justify-content: center;
}

/* Focus View / Live Studio */
.focus-container {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: flex-start;
  margin: 0 auto;
}
.focus-phone {
  background: var(--phone-bezel);
  border-radius: 46px;
  padding: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  position: relative;
}
#screen {
  display: block;
  height: min(76vh, 740px);
  width: auto;
  aspect-ratio: 393/852;
  border-radius: 36px;
  background: #000;
  touch-action: none;
  cursor: crosshair;
}
.focus-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.focus-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}
.focus-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.focus-panel {
  width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}
.panel-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.quick-action-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  max-width: 580px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-backdrop.show .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 20px;
  font-weight: 800;
}
.btn-close {
  background: transparent;
  border: 0;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

/* Auth Cards */
.auth-wrapper {
  display: grid;
  place-items: center;
  min-height: 100vh;
  width: 100%;
  padding: 20px;
  background: var(--bg);
}
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  border-radius: 12px;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  margin: 0 auto 14px;
}
.auth-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.auth-subtitle { font-size: 13px; color: var(--text-muted); }

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
input[type="text"], input[type="email"], input[type="password"] {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s;
}
input:focus {
  outline: 2px solid var(--primary-light);
  border-color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 36px;
  backdrop-filter: blur(4px);
}
