/* =============================================
   GPTYar Dedicated Account Plugin — Styles
   Dark Mode | RTL | Vazirmatn Font
   ============================================= */

/* ---- Font ---- */
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: block;
}

/* ---- Variables ---- */
:root {
  --bg-base:      #0f1117;
  --bg-card:      #1a1d27;
  --bg-card-2:    #21253a;
  --bg-input:     #12151f;
  --border:       #2e3247;
  --border-focus: #5b6af0;

  --text-primary:   #eef0f8;
  --text-secondary: #8b90b0;
  --text-muted:     #555a78;

  --accent:       #5b6af0;
  --accent-hover: #4757e0;
  --accent-glow:  rgba(91, 106, 240, 0.25);

  --success:      #22c55e;
  --success-bg:   rgba(34, 197, 94, 0.12);
  --danger:       #ef4444;
  --danger-bg:    rgba(239, 68, 68, 0.12);
  --warn:         #f59e0b;
  --warn-bg:      rgba(245, 158, 11, 0.12);
  --info-bg:      rgba(91, 106, 240, 0.12);

  --badge-gpt:        #10a37f;
  --badge-grok:       #1da1f2;
  --badge-claude:     #c96a2a;
  --badge-midjourney: #7c5cbf;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);

  --popup-w: 360px;
  --popup-h: 580px;

  --transition: 0.2s ease;
}

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

html {
  width: var(--popup-w);
  height: var(--popup-h);
  max-height: var(--popup-h);
  overflow: hidden;
}

body {
  width: var(--popup-w);
  height: var(--popup-h);
  max-height: var(--popup-h);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: 'Vazirmatn', system-ui, sans-serif;
  font-size: 13px;
  background: var(--bg-base);
  color: var(--text-primary);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}

/* ---- Utility ---- */
.hidden { display: none !important; }

.update-notice {
  position: absolute;
  inset: 0;
  z-index: 600;
  background: rgba(8, 10, 16, 0.86);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.update-notice-card {
  width: 100%;
  max-width: 320px;
  border: 1px solid var(--warn);
  background: rgba(30, 20, 5, 0.96);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.update-notice-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--warn);
}

.update-notice-text {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
}

/* =============================================
   SCREENS
   ============================================= */

.screen {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* screens themselves clip — only .scrollable-cards scrolls */
}

/* ---- Loading Screen ---- */
.screen-loading {
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-base);
}

.loading-logo-wrap {
  width: 64px;
  height: 64px;
}

.loading-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: contain;
}

.loading-logo.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.1); opacity: 0.7; }
}

.loading-dots {
  display: flex;
  gap: 6px;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.4; }
  40%            { transform: translateY(-8px); opacity: 1; }
}

.loading-text {
  color: var(--text-secondary);
  font-size: 12px;
}

/* =============================================
   LOGIN SCREEN
   ============================================= */

#screen-login {
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 16px;
}

.login-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-md);
}

.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: contain;
  border: 2px solid var(--border-focus);
  box-shadow: 0 0 16px var(--accent-glow);
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.login-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: center;
}

/* ---- Input Group ---- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  right: 12px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.input-field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 40px 10px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  direction: ltr;
  text-align: left;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.input-field::placeholder {
  color: var(--text-muted);
  direction: ltr;
}

/* ---- Error message ---- */
.error-msg {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--danger);
  text-align: center;
}

.login-footer {
  text-align: center;
}

.footer-link {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-link:hover { color: var(--accent); }

/* =============================================
   BUTTONS
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-full { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-card-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.22); }

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: var(--radius-sm);
}

/* Loading state */
.btn-loading .btn-text::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Icon button */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--border); color: var(--text-primary); }
.icon-btn-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* Button group vertical */
.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-group-vertical .btn {
  padding: 8px 14px;
  font-size: 12px;
}

/* =============================================
   MAIN SCREEN
   ============================================= */

#screen-main {
  background: var(--bg-base);
  flex: 1;
  min-height: 0; /* must be explicit so the inner flex chain can compute finite heights */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- App Header ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-basis: auto;
}

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

.header-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: contain;
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-site-link {
  font-size: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.header-site-link:hover {
  color: var(--accent);
}

.header-subtitle {
  font-size: 10px;
  color: var(--text-secondary);
}

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

/* ---- Main Content (flex column container) ---- */
.main-content {
  flex: 1;
  min-height: 0;        /* critical: lets flex children shrink below their natural height */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- Scrollable cards area (top section) ---- */
.scrollable-cards {
  flex: 1;
  min-height: 0;        /* critical: prevents this from overflowing parent */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.scrollable-cards::-webkit-scrollbar { width: 4px; }
.scrollable-cards::-webkit-scrollbar-track { background: transparent; }
.scrollable-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---- Cookie panel (fixed at bottom) ---- */
.cookie-panel {
  flex-shrink: 0;
  padding: 0 10px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
  padding-top: 8px;
}

/* =============================================
   CARD
   ============================================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /* Use overflow:clip instead of overflow:hidden so border-radius clips visually
     but does NOT create a new scroll container (which was breaking the flex scroll chain) */
  overflow: clip;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-2);
}

.card-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ---- Agent Badge ---- */
.agent-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-right: auto;
}

.badge-gpt        { background: rgba(16,163,127,0.18); color: #10a37f; border: 1px solid rgba(16,163,127,0.35); }
.badge-grok       { background: rgba(29,161,242,0.18); color: #1da1f2; border: 1px solid rgba(29,161,242,0.35); }
.badge-claude     { background: rgba(201,106,42,0.18); color: #c96a2a; border: 1px solid rgba(201,106,42,0.35); }
.badge-midjourney { background: rgba(124,92,191,0.18); color: #7c5cbf; border: 1px solid rgba(124,92,191,0.35); }

.renew-now-btn {
  margin-bottom: 8px;
  width: 100%;
}

/* ---- Info Row ---- */
.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.info-label {
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 80px;
}

.info-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Monospace credential values */
.info-value-mono {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  direction: ltr;
  text-align: left;
  word-break: break-all;
}

/* Copyable: subtle pointer + highlight on hover */
.copyable {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 4px;
  transition: background 0.15s;
}
.copyable:hover {
  background: var(--surface-3);
}

/* Password row: value + toggle button side by side */
.info-value-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

/* Tiny icon button for password eye toggle */
.icon-btn-xs {
  background: transparent;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.icon-btn-xs:hover {
  color: var(--text-primary);
  background: var(--surface-3);
}

/* =============================================
   CREDENTIALS GRID
   ============================================= */

.creds-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cred-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cred-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.cred-value-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

.cred-value {
  flex: 1;
  font-size: 12px;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  word-break: break-all;
  direction: ltr;
  text-align: left;
}

/* Copy button */
.copy-btn, .toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 3px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--transition);
  flex-shrink: 0;
}
.copy-btn:hover  { color: var(--accent); }
.toggle-btn:hover { color: var(--text-primary); }
.copy-btn.copied { color: var(--success); }

/* Empty state */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}
.empty-state.small { padding: 10px; }

/* =============================================
   ONE-TIME CARD
   ============================================= */

.onetime-notice {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--warn);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* =============================================
   TOAST
   ============================================= */

.toast {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.toast-error   { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger);  }
.toast-warn    { background: var(--warn-bg);    border-color: var(--warn);    color: var(--warn);    }
.toast-info    { background: var(--info-bg);    border-color: var(--accent);  color: var(--accent);  }

/* =============================================
   TUTORIAL OVERLAY
   ============================================= */

.tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 300;
  border-radius: var(--radius-lg);
  pointer-events: none; /* children re-enable it */
}

.tutorial-overlay.hidden {
  display: none;
}

/* Dark vignette backdrop */
.tutorial-backdrop {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(1.5px);
  pointer-events: all;
}

/* Glowing ring around the highlighted element */
.tutorial-spotlight {
  position: absolute;
  border-radius: var(--radius-md);
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 0 6px rgba(91, 106, 240, 0.22),
    0 0 20px 4px rgba(91, 106, 240, 0.18);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 2;
}

/* Tooltip card */
.tutorial-card {
  position: absolute;
  left: 12px;
  right: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-lg);
  padding: 16px 16px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  pointer-events: all;
  z-index: 3;
  animation: tutorialCardIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.tutorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tutorial-step-badge {
  background: rgba(91, 106, 240, 0.15);
  border: 1px solid rgba(91, 106, 240, 0.35);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  direction: ltr;
}

.tutorial-skip-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: color 0.15s;
}
.tutorial-skip-btn:hover {
  color: var(--text-primary);
}

.tutorial-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin-bottom: 10px;
}

.tutorial-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
  line-height: 1.4;
}

.tutorial-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 8px;
}

.tutorial-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.tutorial-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}
.tutorial-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.tutorial-nav {
  display: flex;
  gap: 6px;
}

.tutorial-back-btn {
  min-width: 52px;
}

.tutorial-next-btn {
  min-width: 64px;
}


/* =============================================
   CONFIRM DIALOG
   ============================================= */

.confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  border-radius: var(--radius-lg);
  animation: fadeIn 0.15s ease;
}

.confirm-overlay.hidden {
  display: none;
}

.confirm-dialog {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px 18px;
  width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideUp 0.18s ease;
}

.confirm-icon {
  color: var(--warn);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-message {
  font-size: 13px;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.6;
  margin: 0;
  white-space: pre-line;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.confirm-actions .btn {
  flex: 1;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.btn-warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  color: var(--warn);
}
.btn-warning:hover {
  background: rgba(245,158,11,0.22);
}

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

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

/* =============================================
   EXTRAS
   ============================================= */

/* btn-icon for login button */
.btn-icon {
  flex-shrink: 0;
}

/* standalone cred-value (no row wrap) */
.cred-value-standalone {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  word-break: break-all;
  direction: ltr;
  text-align: left;
}

/* =============================================
   MFA KEY INPUT SECTION
   ============================================= */

.mfa-key-section {
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  background: rgba(91, 106, 240, 0.04);
  /* no border-radius — proxy-section is below; card's own border-radius handles the outer curve */
}

.mfa-key-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mfa-key-header svg {
  color: var(--accent);
  flex-shrink: 0;
}

.mfa-saved-badge {
  margin-right: auto;
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}

.mfa-key-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.mfa-key-input {
  flex: 1;
  font-size: 12px;
  height: 34px;
  padding: 6px 10px;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

.btn-ghost-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0 8px;
  height: 34px;
}
.btn-ghost-danger:hover {
  background: var(--danger-bg);
}

/* ---- MFA Live Code Block (inside creds card) ---- */
.mfa-live-block {
  margin-top: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-md);
  padding: 10px 12px 8px;
}

.mfa-live-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.mfa-live-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mfa-code {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--accent);
  font-family: 'Courier New', monospace;
  direction: ltr;
  text-shadow: 0 0 16px var(--accent-glow);
  line-height: 1;
}

.mfa-copy-btn {
  flex-shrink: 0;
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.mfa-timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.mfa-timer-bar {
  flex: 1;
  height: 3px;
  background: var(--bg-card-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.mfa-timer-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 1s linear;
}

.mfa-timer-text {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: center;
  direction: ltr;
}

/* =============================================
   PROXY SECTION
   ============================================= */

.proxy-section {
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  background: rgba(102, 126, 234, 0.03);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); /* round bottom corners of the card */
}

.proxy-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.proxy-section-header svg {
  color: var(--accent);
  flex-shrink: 0;
}

/* Status badge */
.proxy-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  border: 1px solid transparent;
}

.proxy-badge-loading {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}

.proxy-badge-connected {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.proxy-badge-offline {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

.proxy-badge-disabled {
  background: rgba(139, 144, 176, 0.15);
  border-color: rgba(139, 144, 176, 0.5);
  color: var(--text-secondary);
}

/* Refresh button */
.proxy-refresh-btn {
  margin-right: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
  flex-shrink: 0;
}

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

.proxy-refresh-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

/* Proxy list container */
.proxy-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Individual proxy item */
.proxy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  gap: 8px;
}

.proxy-item:hover {
  border-color: var(--accent);
  background: rgba(91, 106, 240, 0.06);
}

.proxy-item.active {
  border-color: var(--accent);
  background: rgba(91, 106, 240, 0.1);
}

.proxy-item.testing {
  opacity: 0.7;
  cursor: default;
}

.proxy-item.offline {
  opacity: 0.55;
}

.proxy-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.proxy-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.proxy-item-ping {
  font-size: 10px;
  color: var(--text-muted, var(--text-secondary));
  direction: ltr;
  text-align: right;
}

.proxy-item-status {
  font-size: 10px;
  flex-shrink: 0;
}

.status-online  { color: var(--success); }
.status-offline { color: var(--danger);  }

/* Skeleton placeholders */
.proxy-item.skeleton {
  cursor: default;
  pointer-events: none;
  animation: pulse 1.4s ease-in-out infinite;
}

.proxy-item.skeleton .skeleton-line {
  background: var(--bg-card-2);
  border-radius: 4px;
  height: 10px;
}

.proxy-item.skeleton .skeleton-line.name { width: 70%; }
.proxy-item.skeleton .skeleton-line.ping { width: 30%; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* Empty / error hint */
.proxy-empty-hint {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  padding: 10px 0 4px;
}

.proxy-toggle-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.proxy-toggle-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.proxy-toggle-state {
  font-size: 11px;
  color: var(--text-primary);
  margin-right: auto;
}

.proxy-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.proxy-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.proxy-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.5);
  transition: all var(--transition);
}

.proxy-switch-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  right: 2px;
  top: 2px;
  border-radius: 50%;
  background: var(--danger);
  transition: transform var(--transition), background var(--transition);
}

.proxy-switch input:checked + .proxy-switch-slider {
  background: var(--success-bg);
  border-color: rgba(34, 197, 94, 0.6);
}

.proxy-switch input:checked + .proxy-switch-slider::before {
  transform: translateX(-18px);
  background: var(--success);
}
