/* ── Component: VisionPanel, wallet ──
 * Class prefix: vision-
 */

/* ── Vision Panel ───────────────────────────────────────────────────────────── */

.vision-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.vision-panel {
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  background: #0f1225;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

.vision-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vision-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vision-eye {
  font-size: 22px;
}

.vision-title {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
}

.vision-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vision-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #94a3b8;
}

.vision-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  animation: pulse-badge 1.5s ease infinite;
}

.vision-badge-done {
  background: rgba(52, 211, 153, 0.15) !important;
  color: #34d399 !important;
  animation: none !important;
}

.vision-badge-failed {
  background: rgba(248, 113, 113, 0.15) !important;
  color: #f87171 !important;
  animation: none !important;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.vision-stop-btn {
  padding: 5px 12px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.vision-stop-btn:hover {
  background: rgba(248, 113, 113, 0.2);
}

.vision-close-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
}

.vision-close-btn:hover {
  color: #e2e8f0;
}

.vision-task-desc {
  padding: 12px 20px;
  font-size: 13px;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Screenshot area */
.vision-screenshot {
  min-height: 200px;
  max-height: 360px;
  background: #1a1f3a;
  margin: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vision-screenshot-placeholder {
  color: #475569;
  font-size: 13px;
}

.vision-screenshot-img {
  width: 100%;
  height: auto;
  display: block;
}

/* Steps log */
.vision-steps {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  max-height: 220px;
}

.vision-steps-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.vision-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  color: #cbd5e1;
  animation: fadeIn 0.2s ease;
}

.vision-step-icon {
  flex-shrink: 0;
  font-size: 13px;
}

.vision-step-text {
  word-break: break-word;
}

/* Result */
.vision-result {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(52, 211, 153, 0.04);
}

.vision-result-title {
  font-size: 12px;
  font-weight: 600;
  color: #34d399;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.vision-result-text {
  font-size: 13px;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 150px;
  overflow-y: auto;
}

/* ── Wallet ────────────────────────────────────────────────────────────────── */

.wallet-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.wallet-modal {
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  background: #0f1225;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wallet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wallet-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-icon {
  font-size: 28px;
}

.wallet-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0;
}

.wallet-subtitle {
  font-size: 12px;
  color: #64748b;
  margin: 2px 0 0;
}

.wallet-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.wallet-close:hover {
  color: #e2e8f0;
}

.wallet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
}

.wallet-loading,
.wallet-error {
  text-align: center;
  padding: 32px;
  color: #94a3b8;
  font-size: 14px;
}

.wallet-empty {
  text-align: center;
  padding: 32px 16px;
}

.wallet-empty-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

.wallet-empty p {
  color: #94a3b8;
  font-size: 14px;
  margin: 4px 0;
}

.wallet-empty-hint {
  font-size: 12px !important;
  color: #64748b !important;
}

/* Credential cards */
.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.wallet-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.wallet-card-service {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
}

.wallet-card-label {
  font-size: 12px;
  color: #64748b;
}

.wallet-card-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: 4px;
}

.wallet-card-actions {
  display: flex;
  gap: 6px;
}

.wallet-btn-edit,
.wallet-btn-del {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.wallet-btn-edit {
  background: rgba(167, 139, 250, 0.1);
  color: #a78bfa;
}

.wallet-btn-edit:hover {
  background: rgba(167, 139, 250, 0.2);
}

.wallet-btn-del {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
}

.wallet-btn-del:hover {
  background: rgba(248, 113, 113, 0.2);
}

.wallet-card-used {
  width: 100%;
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
}

.wallet-add-btn {
  width: 100%;
  padding: 12px;
  border: 2px dashed rgba(167, 139, 250, 0.3);
  border-radius: 10px;
  background: none;
  color: #a78bfa;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.wallet-add-btn:hover {
  border-color: #a78bfa;
  background: rgba(167, 139, 250, 0.05);
}

/* Add/Edit form modal */
.wallet-form-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.1s ease;
}

.wallet-form-modal {
  width: 90%;
  max-width: 420px;
  background: #131730;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 24px;
}

.wallet-form-modal h3 {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0 0 20px;
}

.wallet-form-group {
  margin-bottom: 14px;
}

.wallet-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 5px;
}

.wallet-form-group input,
.wallet-form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 14px;
  font-family: inherit;
}

.wallet-form-group input:focus,
.wallet-form-group textarea:focus {
  outline: none;
  border-color: #a78bfa;
}

.wallet-pw-wrap {
  position: relative;
}

.wallet-pw-wrap input {
  padding-right: 40px;
}

.wallet-pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.5;
}

.wallet-pw-toggle:hover {
  opacity: 1;
}

.wallet-form-security {
  font-size: 11px;
  color: #64748b;
  margin: 16px 0;
  text-align: center;
}

.wallet-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.wallet-btn-cancel {
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: none;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.wallet-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.04);
}

.wallet-btn-save {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #a78bfa, #6C3BEE);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.wallet-btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 59, 238, 0.4);
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .vision-panel { width: 100%; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .wallet-modal { width: 100%; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .wallet-form-modal { width: 95%; }
}
