/* ════════════════════════════════════════
   TERMINAL.CSS — стили терминала
   ════════════════════════════════════════ */

/* ── Весь терминал — на весь экран ── */
.terminal-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #0d0d1a;
}

/* ── Idle экран ── */
.idle-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100svh;
  background: linear-gradient(135deg, #0d0d1a, #1a1a3e);
  cursor: pointer;
  user-select: none;
}
.idle-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #4a90d9, #7b6cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 24px;
  animation: pulse-idle 3s ease-in-out infinite;
}
@keyframes pulse-idle {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(74,144,217,0.4); }
  50%       { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(74,144,217,0); }
}
.idle-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
}
.idle-device {
  font-size: 13px;
  color: #444;
  margin-bottom: 6px;
}
.idle-subtitle {
  font-size: 14px;
  color: #555;
}

/* ── Камера / основной экран ── */
.terminal-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100vh;
  height: 100svh;
  background: #0d0d1a;
}

.terminal-header {
  width: 100%;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid #1e1e3a;
  flex-shrink: 0;
}
.object-name {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}
.device-name-hint {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,0.35);
  margin-left: 4px;
}
.admin-btn {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.07);
  border: none;
  border-radius: 7px;
  color: #555;
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.admin-btn:hover {
  color: #aaa;
  background: rgba(255,255,255,0.12);
}

.camera-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 0;
}

/* Овальная рамка камеры */
.camera-frame {
  position: relative;
  width: min(290px, 72vw);
  aspect-ratio: 290 / 370;
  border-radius: 50% / 45%;
  overflow: hidden;
  background: #111;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.8), 0 0 24px rgba(74, 144, 217, 0.25);
}
/* overflow и transform на разных элементах — иначе iOS Safari не рендерит video */
.camera-mirror {
  position: absolute;
  inset: 0;
  -webkit-transform: scaleX(-1);
  transform: scaleX(-1);
}
.camera-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #1a1a2e, #111);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2a2a4a;
  font-size: 72px;
}

/* ── Результат верификации (overlay поверх камеры) ── */
.result-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50% / 45%;
  z-index: 10;
}
.result-overlay.success   { background: rgba(34,197,94,0.88); }
.result-overlay.error     { background: rgba(239,68,68,0.88); }
.result-overlay.warning   { background: rgba(234,179,8,0.88); }
.result-overlay.processing{ background: rgba(0,0,0,0.65); }
.result-overlay.duplicate { background: rgba(74,144,217,0.88); }

.result-icon {
  font-size: 50px;
  margin-bottom: 10px;
  line-height: 1;
}
.result-name {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  padding: 0 18px;
  line-height: 1.3;
  color: #fff;
}
.result-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
  text-align: center;
  padding: 0 12px;
}

/* Спиннер обработки */
.verify-spinner {
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

/* ── Подвал с кнопками ── */
.terminal-footer {
  padding: 16px 20px 28px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Кнопки направления Вход / Выход */
.direction-btns {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 300px;
}
.direction-btn {
  flex: 1;
  padding: 13px;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  color: #888;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.direction-btn:hover {
  border-color: rgba(255,255,255,0.25);
  color: #ccc;
}
.direction-btn.active {
  background: linear-gradient(135deg, #4a90d9, #7b6cf6);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(74,144,217,0.35);
}
.verify-btn {
  width: 100%;
  max-width: 300px;
  padding: 17px;
  background: linear-gradient(135deg, #4a90d9, #7b6cf6);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(74,144,217,0.4);
}
.verify-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(74,144,217,0.5);
}
.verify-btn:disabled {
  background: #252535;
  box-shadow: none;
  cursor: default;
  transform: none;
}

/* ── Настройка устройства ── */
.setup-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #0d0d1a, #1a1a3e);
  overflow-y: auto;
  padding: 20px;
}
.setup-card {
  background: #16162a;
  border: 1px solid #2a2a4a;
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
}
.setup-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #4a90d9, #7b6cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 20px;
}
.setup-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: #fff;
}
.setup-subtitle {
  font-size: 13px;
  color: #555;
  text-align: center;
  margin-bottom: 24px;
}
.setup-input {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.setup-input:focus { border-color: #4a90d9; }
.setup-btn {
  width: 100%;
  padding: 13px;
  margin-top: 4px;
  background: linear-gradient(135deg, #4a90d9, #7b6cf6);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.setup-btn:hover { opacity: 0.9; }
.setup-btn:disabled { opacity: 0.5; cursor: default; }
.setup-btn.secondary {
  background: #252535;
  margin-top: 8px;
}
.setup-error {
  color: #ef4444;
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
}

/* Список устройств в setup */
.device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}
.device-list-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid #2a2a4a;
  cursor: pointer;
  transition: all 0.15s;
}
.device-list-item:hover {
  border-color: #4a90d9;
  background: rgba(74,144,217,0.08);
}
.device-list-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.device-in-use-badge {
  font-size: 11px;
  font-weight: 600;
  color: #e07b3a;
}
.device-in-use {
  border-color: #6b3a1a;
  background: rgba(224,123,58,0.06);
  opacity: 0.7;
}
.device-list-object {
  font-size: 12px;
  color: #555;
}
.device-list-object.assigned { color: #4a90d9; }
.device-list-seen {
  font-size: 11px;
  color: #444;
}

/* Скрытый canvas для захвата кадра */
#capture-canvas { display: none; }
