/* ═══════════════════════════════════════════════════════════════
   Panel Bazaar BD — Component Library
   ═══════════════════════════════════════════════════════════════ */

/* ── Glass Card ── */
.card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--card-radius);
  padding: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform var(--transition-release), box-shadow var(--transition-standard);
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: var(--surface-top-edge);
  border-radius: 1px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.08);
}
.card-elevated {
  background: var(--bg-elevated);
  border-color: rgba(139, 92, 246, 0.18);
  backdrop-filter: blur(24px);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-press), opacity var(--transition-standard);
  user-select: none;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--input-radius);
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.96); transition-duration: 80ms; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  width: 100%;
  height: 54px;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(124, 58, 237, 0.35); }

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--violet-border);
  width: 100%;
  height: 48px;
}
.btn-ghost:hover { border-color: var(--violet-border-active); background: rgba(124, 58, 237, 0.05); }

.btn-sm { min-height: 36px; padding: 0 14px; font-size: 12px; border-radius: 10px; }

.btn-icon {
  width: 40px; height: 40px; min-height: unset; padding: 0; border-radius: 12px;
  background: var(--bg-surface); border: 1px solid var(--violet-border); color: var(--text-secondary);
}
.btn-icon:hover { color: var(--text-primary); border-color: var(--violet-border-active); }

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

/* ── Pill / Badge ── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--pill-radius);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill-glass { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); color: var(--text-secondary); backdrop-filter: blur(8px); }
.pill-violet { background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3); color: var(--lavender); }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill svg { width: 12px; height: 12px; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.dot-red { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.dot-amber { background: var(--warning); box-shadow: 0 0 6px rgba(245,158,11,0.4); }

/* ── Input ── */
.input-group { position: relative; width: 100%; }
.input-group .input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); width: 18px; height: 18px; pointer-events: none;
}
.input-field {
  width: 100%; height: 52px; background: var(--bg-input);
  border: 1px solid rgba(139,92,246,0.2); border-radius: var(--input-radius);
  color: var(--text-primary); font-family: var(--font-sans);
  font-size: 14px; font-weight: 500; padding: 0 16px 0 44px;
  transition: border-color var(--transition-standard), box-shadow var(--transition-standard);
  outline: none;
}
.input-field::placeholder { color: var(--text-muted); font-weight: 400; }
.input-field:focus { border-color: var(--violet-border-focus); box-shadow: 0 0 0 3px var(--violet-glow); }
.input-field:focus ~ .input-icon { color: var(--lavender); }
.input-field.no-icon { padding-left: 16px; }
.input-field.mono-input { font-family: var(--font-mono); font-size: 18px; font-weight: 700; height: 60px; }
.input-field.large-input { font-size: 24px; font-weight: 700; height: 60px; }

/* ── Toggle ── */
.toggle {
  position: relative; width: 44px; height: 24px;
  background: rgba(255,255,255,0.08); border-radius: 12px;
  cursor: pointer; transition: background var(--transition-standard); flex-shrink: 0;
}
.toggle.active { background: var(--violet); }
.toggle::after {
  content: ''; position: absolute; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; top: 2px; left: 2px;
  transition: transform var(--transition-standard);
}
.toggle.active::after { transform: translateX(20px); }

/* ── Tabs ── */
.tabs {
  display: flex; border-bottom: 1px solid rgba(139,92,246,0.08);
  overflow-x: auto; padding: 0 var(--page-padding);
}
.tab-item {
  padding: 12px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; min-height: 44px;
  display: flex; align-items: center;
  transition: color var(--transition-standard), border-color var(--transition-standard);
}
.tab-item.active { color: var(--text-primary); border-bottom-color: var(--violet); }

/* ── Chips ── */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 0 var(--page-padding); }
.chip {
  padding: 8px 16px; border-radius: var(--pill-radius); font-size: 12px; font-weight: 600;
  white-space: nowrap; cursor: pointer; background: var(--bg-surface);
  border: 1px solid var(--violet-border); color: var(--text-secondary);
  transition: all var(--transition-standard); min-height: 36px; display: flex; align-items: center;
}
.chip.active {
  background: var(--gradient-primary); border-color: transparent; color: #fff;
  box-shadow: 0 2px 12px rgba(124,58,237,0.3);
}

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-skeleton-from), var(--bg-skeleton-to), var(--bg-skeleton-from));
  background-size: 200% 100%; animation: skeletonPulse 1.8s ease-in-out infinite; border-radius: 8px;
}
@keyframes skeletonPulse { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Terminal Box ── */
.terminal-box {
  position: relative; background: #0a0a0f;
  border: 1px solid rgba(139,92,246,0.2); border-radius: 12px;
  padding: 16px; padding-right: 48px; font-family: var(--font-mono);
  font-size: 13px; color: var(--lavender); word-break: break-all; line-height: 1.6;
}
.terminal-box .copy-btn {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
  border-radius: 8px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(8px);
}
.terminal-box .copy-btn svg { width: 14px; height: 14px; }
.terminal-box.copied { animation: terminalPulse 300ms ease; }
@keyframes terminalPulse {
  0%, 100% { border-color: rgba(139,92,246,0.2); }
  50% { border-color: var(--violet); box-shadow: 0 0 12px rgba(124,58,237,0.2); }
}

/* ── Toast ── */
.toast-container {
  position: fixed; bottom: calc(var(--bottom-nav-height) + 16px);
  left: 50%; transform: translateX(-50%); z-index: var(--z-toast);
  width: calc(100% - 32px); max-width: 400px;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--bg-elevated); border: 1px solid var(--violet-border);
  border-radius: 14px; padding: 14px 16px; backdrop-filter: blur(20px);
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto; cursor: pointer; animation: toastIn 280ms var(--ease-out) forwards;
  position: relative; overflow: hidden;
}
.toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.toast.toast-success::before { background: var(--success); }
.toast.toast-error::before { background: var(--danger); }
.toast.toast-info::before { background: var(--violet); }
.toast .toast-text { font-size: 13px; font-weight: 500; flex: 1; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.toast-success svg { color: var(--success); }
.toast.toast-error svg { color: var(--danger); }
.toast.toast-info svg { color: var(--lavender); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.toast.removing { animation: toastOut 200ms ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(20px) scale(0.95); } }

/* ── Modal / Drawer ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px); z-index: var(--z-modal-backdrop); animation: fadeIn 200ms ease;
}
.modal-drawer {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; max-height: 90dvh;
  background: var(--bg-elevated); border: 1px solid rgba(139,92,246,0.15);
  border-bottom: none; border-radius: 24px 24px 0 0; z-index: var(--z-modal);
  overflow-y: auto; animation: drawerIn 320ms var(--ease-out) forwards;
  padding: 12px 20px 32px;
}
.modal-drawer .drawer-handle { width: 36px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; margin: 0 auto 20px; }
.modal-drawer::before {
  content: ''; position: absolute; top: 0; left: 24px; right: 24px;
  height: 1px; background: linear-gradient(90deg, transparent, var(--violet), transparent); opacity: 0.3;
}
@keyframes drawerIn { from { transform: translateX(-50%) translateY(100%); } to { transform: translateX(-50%) translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Animations ── */
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-4px); } }
.shake { animation: shake 300ms ease; }
@keyframes ringPulse { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
@keyframes successCheck { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } }

/* ── Progress Bar ── */
.progress-bar { height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--gradient-primary); border-radius: 3px; transition: width 300ms ease; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 13px; margin-top: 8px; }
