/* ── Global ──────────────────────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

body {
  animation: fadeIn 0.4s ease-out;
}

/* ── Custom Scrollbar ────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #fdf2f8;
}

::-webkit-scrollbar-thumb {
  background: #f9a8d4;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #f472b6;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #f9a8d4 #fdf2f8;
}

/* ── Fade-In Animation ───────────────────────────────────────────────────── */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* ── Profile Card Hover ──────────────────────────────────────────────────── */

.profile-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.06);
}

/* ── Chat Message Appear ─────────────────────────────────────────────────── */

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message {
  animation: messageAppear 0.25s ease-out;
}

/* ── Online Indicator Pulse ──────────────────────────────────────────────── */

@keyframes pulse-online {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.3);
  }
}

.online-dot {
  width: 10px;
  height: 10px;
  background-color: #22c55e;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-online 2s ease-in-out infinite;
  border: 2px solid white;
}

.online-dot-sm {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-online 2s ease-in-out infinite;
  border: 1.5px solid white;
}

/* ── Heart Like Button Animation ─────────────────────────────────────────── */

@keyframes heartBounce {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.3); }
  50%  { transform: scale(0.95); }
  75%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.like-btn {
  cursor: pointer;
  transition: color 0.2s ease;
}

.like-btn:active,
.like-btn.liked-animate {
  animation: heartBounce 0.4s ease-in-out;
}

.like-btn.liked {
  color: #e11d48;
}

.like-btn:not(.liked) {
  color: #9ca3af;
}

.like-btn:hover:not(.liked) {
  color: #fb7185;
}

/* ── Gradient Text ───────────────────────────────────────────────────────── */

.gradient-text {
  background: linear-gradient(135deg, #e11d48, #f472b6, #c026d3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-warm {
  background: linear-gradient(135deg, #e11d48, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Image Shimmer Placeholder ───────────────────────────────────────────── */

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.img-placeholder {
  background: linear-gradient(
    90deg,
    #f3f4f6 25%,
    #e5e7eb 37%,
    #f3f4f6 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.img-loading {
  position: relative;
  overflow: hidden;
}

.img-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #f3f4f6 25%,
    #e5e7eb 37%,
    #f3f4f6 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  z-index: 1;
}

.img-loading.loaded::before {
  display: none;
}

/* ── Flash Messages ──────────────────────────────────────────────────────── */

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-16px);
  }
}

.flash-message {
  animation: slideDown 0.3s ease-out;
}

.flash-message.dismissing {
  animation: slideUp 0.3s ease-in forwards;
}

/* ── Match Notification ──────────────────────────────────────────────────── */

@keyframes matchPopIn {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.match-notification {
  animation: matchPopIn 0.5s ease-out;
}

/* ── Typing Indicator ────────────────────────────────────────────────────── */

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #9ca3af;
  margin: 0 1.5px;
  animation: typingDot 1.2s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

/* ── Responsive Adjustments ──────────────────────────────────────────────── */

@media (max-width: 640px) {
  .profile-card:hover {
    transform: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .gradient-text {
    font-size: 1.75rem;
  }
}

@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 4px;
  }

  .chat-input-area {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 0.75rem;
    border-top: 1px solid #f3f4f6;
  }
}

@media (min-width: 1024px) {
  .profile-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
