/* ===== THEME COLORS ===== */
:root {
  --bg-color: #f5f7fa;
  --text-color: #222;
  --accent-color: #0078ff;
  --bubble-me: #daf1ff;
  --bubble-them: #ffffff;
  --card-bg: #fff;
  --shadow: rgba(0, 0, 0, 0.1);
  --glow: 0 0 10px rgba(0, 120, 255, 0.4);
}

body.dark {
  --bg-color: #0d1117;
  --text-color: #e0e0e0;
  --accent-color: #00b7ff;
  --bubble-me: #00344e;
  --bubble-them: #1b1f24;
  --card-bg: #161b22;
  --shadow: rgba(0, 255, 255, 0.2);
  --glow: 0 0 10px rgba(0, 183, 255, 0.6);
}

/* ===== BASIC RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background 0.4s, color 0.4s, border 0.4s, box-shadow 0.4s;
}

body::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(0,255,255,0.2), transparent 70%),
              radial-gradient(circle at 30% 70%, rgba(255,0,255,0.1), transparent 70%),
              radial-gradient(circle at 70% 30%, rgba(255,255,0,0.15), transparent 70%);
  filter: blur(100px);
  animation: pulseGlow 8s infinite alternate;
  z-index: -1;
}

/* Subtle glowing pulse motion */
@keyframes pulseGlow {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.1);
    opacity: 1;
  }
}


body {
  font-family: "Poppins", sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ===== BACKGROUND ANIMATION ===== */
body::before {
  content: "";
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, #00b7ff22, transparent 50%),
              radial-gradient(circle at 70% 70%, #0078ff33, transparent 50%);
  animation: pulse 8s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes pulse {
  0% { transform: scale(1) rotate(0deg); opacity: 0.9; }
  100% { transform: scale(1.2) rotate(10deg); opacity: 1; }
}

body::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(0,255,255,0.2), transparent 70%),
              radial-gradient(circle at 30% 70%, rgba(255,0,255,0.1), transparent 70%),
              radial-gradient(circle at 70% 30%, rgba(255,255,0,0.15), transparent 70%);
  filter: blur(100px);
  animation: pulseGlow 8s infinite alternate;
  z-index: -1;
}

/* Subtle glowing pulse motion */
@keyframes pulseGlow {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.1);
    opacity: 1;
  }
}


body.light {
  background: linear-gradient(135deg, #f8f9fa, #d9e4f5);
  background-size: 200% 200%;
}

body.light::before {
  display: none;
}


/* ===== LOGIN / SIGNUP CONTAINERS ===== */
#container, .auth-container {
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px var(--shadow);
  width: 380px;
  max-width: 90%;
  position: relative;
}

#container h2, .auth-container h2 {
  color: var(--accent-color);
  text-shadow: var(--glow);
  margin-bottom: 0.4rem;
  margin-top: 1.5rem;
}

input {
  width: 100%;
  padding: 0.7rem;
  margin: 0.3rem 0;
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-color);
  box-shadow: var(--glow);
}

button {
  border: none;
  background: var(--accent-color);
  color: #fff;
  margin: 0.5rem;
  padding: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--glow);
  transition: transform 0.2s;
}

button:hover {
  transform: scale(1.03);
  background: #005ad9;
}

/* ===== RIGHT SIDE IMAGE ===== */
body::after {
  content: "";
  position: absolute;
  right: 8%;
  top: 50%;
  transform: translateY(-50%);
  width: 400px;
  height: 400px;
  filter: drop-shadow(0 0 20px rgba(0, 183, 255, 0.5));
  opacity: 0.9;
  z-index: 1;
}
@media (max-width: 768px) {
  body::after {
    position: static;
    width: 100%;
    height: 200px;
    margin-top: 1rem;
    display: block;
    transform: none;
  }
}

/* ===== CHAT PAGE ===== */
#welcome-page {
  width: 80%;
  max-width: 900px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 4px 30px var(--shadow);
  padding: 1rem 1.5rem;
  position: relative;
  z-index: 2;
}

#welcome-page h2 {
  text-align: center;
  color: var(--accent-color);
  text-shadow: var(--glow);
}

#logout-Btn {
  position: absolute;
  top: 30px;
  right: 20px;
  background: rgb(246, 46, 86);
  color: white;
}

/* ===== MESSAGES AREA ===== */
.message-box {
  flex-grow: 1;
  background: var(--bubble-them);
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 10px;
  overflow-y: auto;
  border: 1px solid var(--accent-color);
  box-shadow: inset 0 0 10px var(--shadow);
 background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 255, 0.3);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
  border-radius: 15px;
  padding: 10px;
  transition: all 0.3s ease;
}
/* ===== MESSAGE ITEM STYLES ===== */
.message-item {
  max-width: 70%;
  padding: 0.8rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  box-shadow: var(--glow);
  position: relative;
  transition: transform 0.2s;
}

.message-item:hover {
  transform: scale(1.02);
}

.message-item.me {
  background: var(--bubble-me);
  align-self: flex-end;
  margin-left: auto;
  text-align: right;
  border-top-right-radius: 0;
}

.message-item.them {
  background: var(--bubble-them);
  align-self: flex-start;
  text-align: left;
  border-top-left-radius: 0;
}

.message-item strong {
  color: var(--accent-color);
}

/* ===== HOVER ACTIONS ===== */
.message-actions, .reactions {
  display: none;
  gap: 8px;
  margin-top: 6px;
}

.message-item:hover .message-actions,
.message-item:hover .reactions {
  display: flex;
}

.message-actions button,
.reactions button {
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.9rem;
}

.reaction-btn:hover,
.message-actions button:hover {
  text-shadow: 0 0 8px var(--accent-color);
}

/* ===== INPUT AREA ===== */
.input-area {
  display: flex;
  margin-top: 1rem;
  gap: 10px;
  z-index: 3;
}

.input-area input {
  flex: 1;
  padding: 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--accent-color);
  background: var(--card-bg);
  color: var(--text-color);
  box-shadow: var(--glow);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  position: fixed;
  top: 15px;
  left: 15px;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  box-shadow: var(--glow);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.edited-label {
  font-size: 0.8em;
  color: #999;
  margin-left: 6px;
  opacity: 0.7;
}


.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

#searchBar {
  width: 40%;
  padding: 8px 10px;
  border: 2px solid var(--accent-color);
  border-radius: 20px;
  background: var(--bg-secondary);
  color: var(--text-color);
  transition: all 0.3s ease;
}

#searchBar:focus {
  outline: none;
  box-shadow: 0 0 8px var(--accent-color);
}

.highlighted {
  animation: pulseGlow 0.6s ease;
  background-color: rgba(255, 255, 255, 0.05);
}

@keyframes pulseGlow {
  from {
    background-color: rgba(255, 255, 255, 0.15);
  }
  to {
    background-color: transparent;
  }
}
