/* ═══════════════════════════════════════════════════════════ */
/*  Shared Design System — Account Management System v2      */
/* ═══════════════════════════════════════════════════════════ */

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

:root {
  --bg-primary: #0f0c29;
  --bg-secondary: #1a1a3e;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1a3e 40%, #24243e 100%);
  color: var(--text-primary);
  overflow: hidden;
}

/* BG Orbs */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bg-orbs .orb {
  position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.15;
  animation: float 10s ease-in-out infinite;
}
.bg-orbs .orb:nth-child(1) { width: 500px; height: 500px; background: #7c3aed; top: -15%; left: -10%; }
.bg-orbs .orb:nth-child(2) { width: 400px; height: 400px; background: #06b6d4; bottom: -10%; right: -10%; animation-delay: -4s; }
.bg-orbs .orb:nth-child(3) { width: 300px; height: 300px; background: #f59e0b; top: 50%; left: 60%; animation-delay: -7s; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-25px) rotate(3deg); }
}

/* ─── App Layout ─── */
.app-container {
  position: relative; z-index: 1;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  max-width: 1200px; margin: 0 auto;
}

/* ─── Header ─── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--accent, #7c3aed);
  z-index: 100; gap: 10px; flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header .logo { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.5px; white-space: nowrap; }
.header-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.5);
}

/* ─── Online Presence ─── */
.presence-indicator {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 0.68rem; font-weight: 600;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4); transition: all 0.3s; white-space: nowrap;
}
.presence-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.2); transition: all 0.5s;
}
.presence-indicator.online {
  background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.3);
  color: #34d399;
}
.presence-indicator.online .presence-dot {
  background: #34d399; box-shadow: 0 0 8px rgba(52,211,153,0.6);
  animation: presence-pulse 2s ease-in-out infinite;
}
.presence-indicator.warming {
  background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.25);
  color: #fbbf24;
}
.presence-indicator.warming .presence-dot {
  background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,0.4);
}
@keyframes presence-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ─── Nav Tabs ─── */
.nav-tabs {
  display: flex; gap: 4px; flex-shrink: 0;
}
.nav-tab {
  padding: 6px 14px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04); border-radius: 10px;
  color: rgba(255,255,255,0.45); font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s; font-family: inherit;
  position: relative; white-space: nowrap;
}
.nav-tab.active {
  background: rgba(var(--accent-rgb, 124, 58, 237), 0.2);
  border-color: rgba(var(--accent-rgb, 124, 58, 237), 0.4);
  color: var(--accent-light, #a78bfa);
}
.nav-tab .badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: #ef4444; color: #fff; font-size: 0.6rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1; animation: badge-pop 0.3s ease;
}
@keyframes badge-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ─── Search ─── */
.search-box { position: relative; width: 100%; }
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: rgba(255, 255, 255, 0.3);
}
.search-box input {
  width: 100%; padding: 8px 12px 8px 32px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-size: 0.82rem; font-family: inherit; transition: var(--transition);
}
.search-box input:focus {
  outline: none; border-color: var(--accent, #7c3aed);
  background: rgba(255, 255, 255, 0.08);
}
.search-box input::placeholder { color: rgba(255, 255, 255, 0.3); }

/* ─── Main Content ─── */
.main-content {
  flex: 1; display: flex; overflow: hidden; position: relative;
}
.panel {
  display: none; flex-direction: column; overflow: hidden;
}
.panel.active { display: flex; }

/* ─── Entries List ─── */
.entries-list {
  flex: 1; padding: 10px; display: flex; flex-direction: column;
  gap: 8px; overflow-y: auto; overflow-x: hidden;
}

/* ─── Entry Card ─── */
.entry-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 30px 14px 12px;
  transition: var(--transition); cursor: default;
  animation: card-in 0.3s ease;
  position: relative;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.entry-card:hover { background: var(--bg-card-hover); border-color: var(--border-medium); }
.entry-card.pinned {
  border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.04);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.1), inset 0 0 30px rgba(239, 68, 68, 0.02);
}
.entry-card.completed { opacity: 0.5; border-color: rgba(5, 150, 105, 0.2); }

.entry-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.entry-info { flex: 1; min-width: 0; }
.entry-id-row { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.entry-label {
  font-size: 0.68rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; min-width: 52px; flex-shrink: 0;
}
.entry-value {
  font-size: 0.85rem; color: var(--text-secondary); font-weight: 500;
  word-break: break-all; user-select: text; cursor: text;
}
.entry-account { color: var(--accent-light, #a78bfa); font-weight: 600; }
.entry-status { flex-shrink: 0; text-align: right; }
.entry-time {
  position: absolute;
  top: 11px;
  left: 14px;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ─── Copy Button ─── */
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border: none; border-radius: 6px;
  background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.35);
  cursor: pointer; transition: all 0.2s; flex-shrink: 0; font-size: 0.7rem; padding: 0;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.8); transform: scale(1.1); }
.copy-btn.copied { background: rgba(52, 211, 153, 0.2); color: #34d399; }

/* ─── Entry Action Buttons ─── */
.entry-card-actions {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center;
}
.pin-btn, .delete-btn {
  padding: 4px 10px; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
  font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
  font-family: inherit; background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.5);
  display: flex; align-items: center; gap: 3px;
}
.pin-btn:hover { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); color: #f87171; }
.pin-btn.pinned { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); color: #f87171; }
.delete-btn:hover { background: rgba(220, 38, 38, 0.12); border-color: rgba(220, 38, 38, 0.3); color: #f87171; }
.delete-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ─── Status Indicators ─── */
.status-indicator {
  padding: 4px 10px; border-radius: 16px; font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}
.status-pending { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.status-approved { background: rgba(5,150,105,0.15); color: #34d399; border: 1px solid rgba(5,150,105,0.2); }
.status-password-error { background: rgba(220,38,38,0.15); color: #f87171; border: 1px solid rgba(220,38,38,0.2); }
.status-need-verification { background: rgba(217,119,6,0.15); color: #fbbf24; border: 1px solid rgba(217,119,6,0.2); }
.status-processing { background: rgba(37,99,235,0.15); color: #60a5fa; border: 1px solid rgba(37,99,235,0.2); }

/* ─── Meta Badges ─── */
.meta-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 0.68rem; font-weight: 600;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5);
}

/* ─── Chat ─── */
.chat-panel { flex: 1; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-msg {
  max-width: 80%; padding: 8px 12px; border-radius: 14px;
  font-size: 0.84rem; line-height: 1.5; word-break: break-word;
  animation: msg-in 0.25s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-msg.self {
  align-self: flex-end; background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-light, #a78bfa));
  color: #fff; border-bottom-right-radius: 4px;
}
.chat-msg.other {
  align-self: flex-start; background: rgba(255,255,255,0.08);
  color: var(--text-secondary); border-bottom-left-radius: 4px;
}
.chat-msg .msg-meta {
  font-size: 0.62rem; color: rgba(255,255,255,0.35); margin-top: 3px;
}
.chat-msg.self .msg-meta { text-align: right; color: rgba(255,255,255,0.5); }
.chat-input-bar {
  display: flex; gap: 8px; padding: 10px 12px;
  background: rgba(255,255,255,0.03); border-top: 1px solid var(--border-subtle);
}
.chat-input-bar input {
  flex: 1; padding: 10px 14px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-md);
  color: #fff; font-size: 0.88rem; font-family: inherit;
}
.chat-input-bar input:focus { outline: none; border-color: var(--accent, #7c3aed); }
.chat-input-bar input::placeholder { color: rgba(255,255,255,0.3); }
.chat-send-btn {
  padding: 10px 18px; border: none; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-light, #a78bfa));
  color: #fff; font-weight: 700; font-size: 0.85rem; cursor: pointer;
  transition: all 0.2s; font-family: inherit; white-space: nowrap;
}
.chat-send-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.chat-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.9rem; text-align: center; padding: 20px;
}

/* ─── Empty State ─── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px; text-align: center; color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state p { font-size: 0.82rem; }

/* ─── Toast ─── */
.toast-container {
  position: fixed; bottom: 20px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 6px;
}
.toast {
  padding: 10px 16px; border-radius: var(--radius-md);
  font-size: 0.8rem; font-weight: 500; color: #fff;
  backdrop-filter: blur(20px); box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  opacity: 0; transform: translateX(30px); transition: all 0.3s ease; max-width: 300px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { background: linear-gradient(135deg, rgba(5,150,105,0.9), rgba(52,211,153,0.9)); }
.toast-error { background: linear-gradient(135deg, rgba(220,38,38,0.9), rgba(248,113,113,0.9)); }
.toast-info { background: linear-gradient(135deg, rgba(37,99,235,0.9), rgba(96,165,250,0.9)); }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ─── Desktop Layout ─── */
@media (min-width: 769px) {
  .main-content { flex-direction: row; }
  .panel.entries-panel { flex: 1; display: flex !important; border-right: 1px solid var(--border-subtle); }
  .panel.chat-panel { width: 360px; display: flex !important; flex-shrink: 0; }
  .panel.add-panel { display: none !important; }
  .nav-tabs { display: none; }
  .desktop-hide { display: none !important; }
  .add-section-desktop { display: block !important; }
}

/* ─── Mobile Layout ─── */
@media (max-width: 768px) {
  .header { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
  .header .logo { font-size: 0.95rem; }
  .panel { width: 100%; position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
  .panel.active { display: flex; }
  .mobile-hide { display: none !important; }
  .add-section-desktop { display: none !important; }
  .main-content { position: relative; }
  .entry-card { padding: 10px 12px; }
}
