/* DeskID - stiluri (Etapa 1: MVP vizualizare) */

:root {
  --bg: #0f1419;
  --card-bg: #1a212b;
  --input-bg: #0f1419;
  --accent: #2f81f7;
  --accent-hover: #4a93ff;
  --danger: #e5534b;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --border: #2d333b;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* Antet + buton cont admin */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 18px;
  background: rgba(26, 33, 43, 0.6);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.account { position: relative; }

.account-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.account-btn:hover { color: var(--text); border-color: var(--accent); }
.account-btn svg { width: 24px; height: 24px; fill: currentColor; }

.account-menu {
  position: absolute;
  right: 0;
  top: 52px;
  width: 260px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.account-menu h3 { font-size: 0.95rem; color: var(--text); margin-bottom: 2px; }
.account-menu input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.account-menu input:focus { outline: none; border-color: var(--accent); }
.account-msg { font-size: 0.8rem; color: var(--text-dim); min-height: 16px; margin: 0; }

/* Camp parola cu buton ochi (arata/ascunde) */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 40px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 5px;
}
.password-toggle:hover { color: var(--text); }
.password-toggle svg { width: 18px; height: 18px; }

/* Mod embed: dashboard afisat in iframe-ul din panoul admin (fara antet) */
.embed .app-header { display: none; }
.embed .dashboard { padding-top: 1px; }

/* In sectiunea Suport (embed): layout pe doua coloane -
   stanga = logo + ID (+ instalare), dreapta = formularul de conectare, pe aceeasi linie. */
.embed .dashboard { max-width: 860px; }
/* Ascundem subtitle-ul in Suport ca sa se alinieze mai bine cele doua carduri */
.embed .subtitle { display: none; }
.embed .dash-row {
  display: flex;
  gap: 24px;
  align-items: flex-end;   /* cele doua carduri (ID + Conectare) aliniate la partea de jos */
  margin-bottom: 18px;     /* distanta carduri -> linia de despartire = 18px */
}
.embed .dash-left,
.embed .dash-right { flex: 1 1 0; min-width: 0; }
/* cardurile din coloane nu mai adauga spatiu propriu jos, ca distanta sa fie exact 18px */
.embed .dash-left .card,
.embed .dash-right .card { margin-bottom: 0; }
.embed .favorites-section { margin-top: 0; }
.embed .divider { margin: 0 0 18px 0; }

/* Pe pagina publica (fara embed) wrapper-ele nu schimba nimic: continutul ramane vertical. */

/* Dashboard */
.dashboard {
  max-width: 460px;
  margin: 0 auto;
  padding: 88px 20px 48px;
  text-align: center;
}

.logo-img {
  display: block;
  width: 240px;
  max-width: 80%;
  height: auto;
  margin: 0 auto 4px;
}

.subtitle {
  color: var(--text-dim);
  margin-bottom: 32px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.my-id {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
.my-id-label { color: var(--text-dim); font-weight: 600; }
#myId { color: var(--accent); }

.hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 12px;
}

.install-text { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 14px; }

/* Card succes instalare */
.installed-success { font-size: 3rem; margin-bottom: 12px; }

/* Linie despărțitoare */
.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* Secțiune și grid carduri favorit */
.favorites-section { margin-top: 8px; }
.favorite-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

/* Card client favorit individual */
.favorite-card {
  position: relative;
  border-radius: 12px;
  padding: 16px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  color: #fff;
}
.favorite-card:hover { transform: scale(1.05); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); }

/* Background-uri colorate */
.favorite-card.bg-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.favorite-card.bg-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.favorite-card.bg-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.favorite-card.bg-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.favorite-card.bg-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }

/* Status în colț stânga sus */
.favorite-card-status {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Star în colț dreapta sus */
.favorite-card-star {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Meniu 3 puncte (⋮) în colț dreapta-jos */
.favorite-card-menu {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  opacity: 0.85;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: background 0.15s;
}
.favorite-card-menu:hover { background: rgba(255, 255, 255, 0.2); opacity: 1; }

/* Dropdown drepturi (apare la click pe ⋮) */
.favorite-card-dropdown {
  position: absolute;
  bottom: 36px;
  right: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  min-width: 130px;
}
.favorite-card-dropdown button {
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 9px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s;
}
.favorite-card-dropdown button:hover { background: var(--accent); color: #fff; }
.favorite-card-dropdown button.active {
  font-weight: 700;
  color: var(--accent);
}
.favorite-card-dropdown button.active::before { content: '✓ '; }

/* Bloc nume+ID împins în partea de jos a cardului (nume imediat deasupra ID) */
.favorite-card-info {
  margin-top: auto;
}

.favorite-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.favorite-card-id {
  font-size: 0.75rem;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Buton toggle Instalare ON/OFF */
.install-toggle {
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 14px;
  width: 100%;
  transition: background 0.15s, border-color 0.15s;
}
.install-toggle:hover { background: rgba(255, 255, 255, 0.05); }
.toggle-state { font-weight: 700; }
.install-toggle.off .toggle-state { color: #8b949e; }
.install-toggle.on .toggle-state { color: #3fb950; }

input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-align: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 14px;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

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

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.status {
  min-height: 24px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Banner partajare (rolul Controlat) */
.sharing-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

/* Sesiune activa (rolul Controler) - bara sus, video dedesubt (NU suprapuse) */
.session {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
}

/* Bara este o fasie proprie DEASUPRA imaginii, ca sa poti controla tot ecranul,
   inclusiv marginea de sus (nu mai fura click-urile de la video). */
.toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

/* Buton mai compact in bara -> bara cu ~20% mai joasa */
.toolbar .btn {
  padding: 9px 16px;
  font-size: 0.9rem;
}

.remote-video {
  flex: 1 1 auto;
  min-height: 0;          /* permite videoului sa se micsoreze in flex */
  width: 100%;
  object-fit: contain;
  background: #000;
  user-select: none;
  -webkit-user-drag: none;
}

.toolbar-title {
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* Modal cerere de conectare */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  max-width: 380px;
  text-align: center;
}

.modal p {
  margin: 16px 0 24px;
  color: var(--text-dim);
}

.warning {
  background: rgba(229, 83, 75, 0.12);
  border: 1px solid rgba(229, 83, 75, 0.4);
  color: #ffb3ae;
  font-size: 0.82rem;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  margin: 0 0 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}
