* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; height: 100vh; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

::selection { background: rgba(139,92,246,0.35); color: #fff; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}
@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes sendPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes berryRain {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}
@keyframes confettiBurst {
  0% { transform: translate(0,0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0) rotate(720deg); opacity: 0; }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(139,92,246,0.1); }
  50% { box-shadow: 0 0 32px rgba(139,92,246,0.25); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

.anim-fade { animation: fadeIn 0.35s ease-out; }
.anim-slide-l { animation: slideInLeft 0.25s ease-out; }
.anim-slide-r { animation: slideInRight 0.25s ease-out; }
.anim-slide-up { animation: slideUp 0.3s ease-out; }
.anim-modal { animation: modalIn 0.2s ease-out; }
.anim-pulse-dot { animation: pulse-dot 2s ease-in-out infinite; }
.anim-spin { animation: spin-slow 1s linear infinite; }
.anim-send { animation: sendPulse 0.3s ease-out; }
.anim-glow { animation: glow-pulse 3s ease-in-out infinite; }
.anim-float { animation: float 3s ease-in-out infinite; }

/* Email row interactions */
.email-row {
  transition: background-color 0.1s ease, border-color 0.1s ease;
}
.email-row:hover {
  background-color: rgba(139,92,246,0.035);
}

/* Folder button */
.folder-btn {
  transition: all 0.12s ease;
  position: relative;
}
.folder-btn:hover {
  background-color: rgba(139,92,246,0.05);
}
.folder-btn.active {
  background: linear-gradient(90deg, rgba(139,92,246,0.1), transparent);
}
.folder-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, #8b5cf6, #ec4899);
}

/* Connect card */
.connect-card {
  background: linear-gradient(170deg, rgba(16,24,36,0.98), rgba(11,16,24,0.99));
  border: 1px solid rgba(139,92,246,0.08);
  box-shadow: 0 40px 120px rgba(0,0,0,0.7), 0 0 100px rgba(139,92,246,0.04);
}

/* Input fields */
.input-field {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.15s ease;
}
.input-field:focus {
  outline: none;
  border-color: rgba(139,92,246,0.35);
  background: rgba(139,92,246,0.03);
  box-shadow: 0 0 0 2px rgba(139,92,246,0.06);
}

/* Primary button */
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  transition: all 0.15s ease;
  box-shadow: 0 4px 20px rgba(124,58,237,0.2);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(124,58,237,0.35);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

/* Secondary button */
.btn-secondary {
  background: rgba(139,92,246,0.06);
  border: 1px solid rgba(139,92,246,0.12);
  transition: all 0.15s ease;
}
.btn-secondary:hover {
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.22);
}

/* Google sign-in button */
.btn-google {
  background: #fff;
  color: #3c4043;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.btn-google:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.4); transform: translateY(-1px); }

/* Microsoft sign-in button */
.btn-microsoft {
  background: #2f2f2f;
  color: #fff;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.btn-microsoft:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.4); transform: translateY(-1px); }

/* Detail panel */
.detail-panel {
  background: linear-gradient(180deg, rgba(16,24,36,0.2), rgba(7,9,14,0.5));
}

/* Overlay */
.compose-overlay {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
}

/* Modal */
.compose-modal {
  background: linear-gradient(170deg, rgba(16,24,36,0.98), rgba(11,16,24,0.99));
  border: 1px solid rgba(139,92,246,0.1);
  box-shadow: 0 50px 140px rgba(0,0,0,0.75), 0 0 80px rgba(139,92,246,0.05);
}

/* Sidebar */
.sidebar-bg {
  background: linear-gradient(180deg, rgba(11,16,24,0.98), rgba(7,9,14,0.99));
  border-right: 1px solid rgba(255,255,255,0.03);
}

/* Badges */
.unread-badge {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  font-size: 9px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 4px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.status-msg {
  background: linear-gradient(90deg, transparent, rgba(139,92,246,0.03), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.badge-real {
  background: rgba(16,185,129,0.1);
  color: #10b981;
  border: 1px solid rgba(16,185,129,0.18);
}

.badge-gmail {
  background: rgba(234,67,53,0.1);
  color: #ea4335;
  border: 1px solid rgba(234,67,53,0.18);
}

.badge-ms {
  background: rgba(0,120,215,0.1);
  color: #0078d7;
  border: 1px solid rgba(0,120,215,0.18);
}

.badge-smtp {
  background: rgba(245,158,11,0.1);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.18);
}

.badge-berrry {
  background: rgba(139,92,246,0.1);
  color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.18);
}

.badge-imported {
  background: rgba(6,182,212,0.1);
  color: #06b6d4;
  border: 1px solid rgba(6,182,212,0.18);
}

/* Tab styling */
.tab-btn {
  transition: all 0.15s ease;
  position: relative;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 12%;
  right: 12%;
  height: 2px;
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
  border-radius: 2px;
}

/* Import zone */
.import-zone {
  border: 2px dashed rgba(139,92,246,0.18);
  transition: all 0.15s ease;
}
.import-zone:hover, .import-zone.drag-over {
  border-color: rgba(139,92,246,0.45);
  background: rgba(139,92,246,0.03);
}

/* Effects */
.berry-rain-drop {
  position: fixed;
  font-size: 20px;
  pointer-events: none;
  z-index: 9999;
  animation: berryRain 2s ease-in forwards;
}

.confetti-piece {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  animation: confettiBurst 1.2s ease-out forwards;
}

/* Raw source */
.raw-source-view {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.04);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  line-height: 1.55;
  color: rgba(255,255,255,0.45);
  white-space: pre-wrap;
  word-break: break-all;
}

/* AI suggestions */
.ai-suggestion {
  background: linear-gradient(135deg, rgba(139,92,246,0.05), rgba(236,72,153,0.03));
  border: 1px solid rgba(139,92,246,0.08);
  transition: all 0.12s ease;
}
.ai-suggestion:hover {
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(236,72,153,0.06));
  border-color: rgba(139,92,246,0.18);
}

/* Connection method cards */
.method-card {
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.15s ease;
}
.method-card:hover {
  border-color: rgba(139,92,246,0.2);
  background: rgba(139,92,246,0.02);
}
.method-card.active-method {
  border-color: rgba(16,185,129,0.3);
  background: rgba(16,185,129,0.03);
}

/* Real email green border */
.real-email-border {
  border-left: 2px solid rgba(16,185,129,0.4) !important;
}

/* Connection status indicator */
.conn-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 8px;
  border-radius: 10px;
}
.conn-gmail { background: rgba(234,67,53,0.08); color: #ea4335; }
.conn-ms { background: rgba(0,120,215,0.08); color: #0078d7; }
.conn-smtp { background: rgba(245,158,11,0.08); color: #f59e0b; }
.conn-bridge { background: rgba(251,146,60,0.08); color: #fb923c; }
.conn-import { background: rgba(148,163,184,0.08); color: #94a3b8; }
.conn-jmap { background: rgba(16,185,129,0.08); color: #10b981; }

/* SMTP.js token field */
.smtp-token-field {
  background: rgba(245,158,11,0.04);
  border: 1px solid rgba(245,158,11,0.1);
}

@media (max-width: 768px) {
  body { overflow: auto; height: auto; }
}