/* ═══════════════════════════════════════════════════
   NexaChat — Base Reset & Global Styles
   ═══════════════════════════════════════════════════ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Selection ── */
::selection {
  background: rgba(0, 245, 255, 0.25);
  color: var(--neon-cyan);
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.15);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 245, 255, 0.3);
}

/* ── Links ── */
a {
  color: var(--neon-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--neon-purple);
}

/* ── Buttons Base ── */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
}

/* ── Input Base ── */
input, textarea {
  font-family: inherit;
  outline: none;
  border: none;
  background: transparent;
  color: var(--text-primary);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

/* ── Images ── */
img {
  max-width: 100%;
  display: block;
}

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

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-gradient {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Animated Background Grid ── */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(rgba(0, 245, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridPulse 8s ease-in-out infinite;
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* ── Floating Orbs (background decoration) ── */
.bg-orbs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 15s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
  width: 400px;
  height: 400px;
  background: rgba(0, 245, 255, 0.06);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.bg-orb:nth-child(2) {
  width: 350px;
  height: 350px;
  background: rgba(191, 0, 255, 0.05);
  bottom: -80px;
  left: -80px;
  animation-delay: -5s;
}

.bg-orb:nth-child(3) {
  width: 250px;
  height: 250px;
  background: rgba(255, 0, 110, 0.04);
  top: 50%;
  left: 50%;
  animation-delay: -10s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(15px, 30px) scale(1.03); }
}

/* ── Glass Card (shared component) ── */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* ── Neon Button ── */
.btn-neon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  background: var(--gradient-main);
  color: var(--bg-primary);
  font-weight: 600;
  font-size: var(--fs-base);
  border-radius: var(--radius-pill);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.5px;
}

.btn-neon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-main);
  opacity: 0;
  transition: opacity var(--transition-base);
  filter: blur(15px);
}

.btn-neon:hover {
  transform: translateY(-2px);
  box-shadow: var(--neon-cyan-glow);
}

.btn-neon:hover::before {
  opacity: 0.4;
}

.btn-neon:active {
  transform: translateY(0);
}

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

/* ── Ghost Button ── */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 24px;
  background: transparent;
  color: var(--text-primary);
  font-weight: 500;
  font-size: var(--fs-base);
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  transition: all var(--transition-base);
}

.btn-ghost:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
}

/* ── Spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 245, 255, 0.2);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Toast Notification ── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  font-size: var(--fs-sm);
  font-weight: 500;
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 360px;
}

.toast.success {
  background: rgba(0, 255, 136, 0.1);
  border-color: rgba(0, 255, 136, 0.2);
  color: var(--neon-green);
}

.toast.error {
  background: rgba(255, 0, 110, 0.1);
  border-color: rgba(255, 0, 110, 0.2);
  color: var(--neon-pink);
}

.toast.info {
  background: rgba(0, 245, 255, 0.1);
  border-color: rgba(0, 245, 255, 0.2);
  color: var(--neon-cyan);
}

/* ── Theme Toggle Components ── */
.theme-toggle-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  font-size: 1.5rem;
}

.theme-toggle-fab:hover {
  transform: scale(1.1) rotate(15deg);
  background: var(--glass-bg-hover);
  border-color: var(--neon-cyan);
  box-shadow: var(--neon-cyan-glow);
}

.theme-toggle-fab:active {
  transform: scale(0.95);
}

.theme-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ──── Sidebar Action Button Hover ──── */
.sidebar-action-btn:hover {
  background: var(--glass-bg-hover);
  color: var(--neon-cyan);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}
