/* ─── Reset & Base ─────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

@media (max-width: 1024px) { html { font-size: 15px; } }
@media (max-width: 768px) { html { font-size: 14px; } }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100%;
  height: 100dvh;
  width: 100vw;
  position: fixed;
  /* Global theme transition */
  transition: background 0.5s ease, color 0.3s ease;
}

/* Smooth theme transitions on ALL themed elements */
body *, body *::before, body *::after {
  transition-property: background-color, border-color, color, box-shadow, opacity;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* Exclude elements that have their own specific transitions */
.message, .message *, .chat-item, .emoji-item, .btn, .icon-btn, 
input, textarea, a, .fab-btn, .scroll-bottom-btn {
  transition: all var(--transition-fast);
}

input, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* Scrollbar - Hidden globally */
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* ─── Ripple Effect ────────────────────────────────── */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: var(--bg-ripple);
  transform: scale(0);
  animation: rippleExpand 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleExpand {
  to { transform: scale(4); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════════════════ */

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  width: 100vw;
  background: #111116; /* Clean dark background */
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  background: #1a1a21; /* Slightly lighter than background */
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 48px 36px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.4);
  animation: authSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
}

@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.95); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.auth-logo {
  text-align: center;
  margin-bottom: 36px;
}

.auth-logo-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
}

.auth-logo-icon svg { width: 100%; height: 100%; }

.auth-title {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  color: #8da4c4;
  font-size: 0.95rem;
  margin-top: 8px;
}

/* ─── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.loading .btn-text { opacity: 0; }
.btn.loading .btn-loader { display: block; }

.btn-loader {
  display: none;
  width: 20px; height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  position: absolute;
}

@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: scale(1.08);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg { width: 20px; height: 20px; }

.auth-switch {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  animation: formGroupSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  animation-delay: 0.5s;
}

.auth-switch a {
  color: var(--primary-light);
  font-weight: 500;
  position: relative;
}

.auth-switch a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--primary-light);
  transition: width 0.3s ease;
}

.auth-switch a:hover::after { width: 100%; }
.auth-switch a:hover { text-decoration: none; }

/* ═══════════════════════════════════════════════════════
   MESSENGER LAYOUT
   ═══════════════════════════════════════════════════════ */

.messenger {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
  animation: messengerFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes messengerFadeIn {
  from { opacity: 0; transform: scale(0.98); filter: blur(4px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}
