/* ==================== GLOBAL RESET ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", "Poppins", sans-serif;
}

/* ==================== BODY & BACKGROUND ==================== */
body {
  background: linear-gradient(135deg, #1f1c2c, #928dab);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  color: #e5e7eb;
  overflow-x: hidden;
  position: relative;
}

/* Auth page enhancements */
body:has(#Container) {
  background: linear-gradient(135deg, #0f0c1c, #5a4fcf, #928dab);
  animation: bgShift 10s ease-in-out infinite;
}

body:has(#Container)::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 10%;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, rgba(116, 235, 213, 0.3), transparent);
  border-radius: 50%;
  animation: floatParticles 8s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

body:has(#Container)::after {
  content: '';
  position: absolute;
  bottom: 30%;
  right: 15%;
  width: 15px;
  height: 15px;
  background: radial-gradient(circle, rgba(154, 206, 230, 0.4), transparent);
  border-radius: 50%;
  animation: floatParticles 6s ease-in-out infinite reverse;
  pointer-events: none;
  z-index: -1;
}

/* Chat page enhancements */
body:has(.chat-container) {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  animation: bgShift 12s ease-in-out infinite;
}

body:has(.chat-container)::before {
  content: '';
  position: absolute;
  top: 15%;
  left: 20%;
  width: 25px;
  height: 25px;
  background: radial-gradient(circle, rgba(255, 107, 107, 0.3), transparent);
  border-radius: 50%;
  animation: floatParticles 10s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

body:has(.chat-container)::after {
  content: '';
  position: absolute;
  bottom: 25%;
  right: 10%;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.4), transparent);
  border-radius: 50%;
  animation: floatParticles 7s ease-in-out infinite reverse;
  pointer-events: none;
  z-index: -1;
}

/* Particle and background animations */
@keyframes floatParticles {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.5; }
  50% { transform: translateY(-25px) rotate(180deg); opacity: 1; }
}

@keyframes bgShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ==================== MAIN CONTAINER ==================== */
#Container,
#container,
.container {
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  background-color: rgba(17, 25, 40, 0.65);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3rem 2.5rem;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(116, 235, 213, 0.1);
  animation: fadeInGlow 0.8s ease-in-out;
  color: #f1f5f9;
  position: relative;
  overflow: hidden;
}

@keyframes fadeInGlow {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    box-shadow: 0 0 0 rgba(116, 235, 213, 0);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(116, 235, 213, 0.1);
  }
}

/* ==================== HEADING ==================== */
h1 {
  font-size: 2rem;
  margin-bottom: 1.8rem;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #9face6, #74ebd5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  position: relative;
}

h1 img {
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), 0 0 20px rgba(116, 235, 213, 0.3);
  animation: logoPulse 3s ease-in-out infinite;
  transition: transform 0.3s ease;
}

h1 img:hover {
  transform: scale(1.1) rotate(5deg);
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1) rotate(0deg); box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), 0 0 20px rgba(116, 235, 213, 0.3); }
  50% { transform: scale(1.05) rotate(2deg); box-shadow: 0 0 15px rgba(255, 255, 255, 0.3), 0 0 30px rgba(116, 235, 213, 0.5); }
}

/* ==================== INPUT FIELDS ==================== */
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #f9fafb;
  font-size: 1rem;
  outline: none;
  transition: 0.3s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

input:focus {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.2), inset 0 0 0 1px rgba(116, 235, 213, 0.5);
  transform: translateY(-2px);
}

/* ==================== BUTTONS ==================== */
button {
  width: 100%;
  padding: 0.9rem;
  margin: 0.6rem 0;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

button:hover::before {
  left: 100%;
}

#signup,
#login,
#user-btn,
#sendMessage {
  background: linear-gradient(135deg, #74ebd5, #9face6);
  color: #111827;
  box-shadow: 0 4px 15px rgba(116, 235, 213, 0.2);
}

#signup:hover,
#login:hover,
#user-btn:hover,
#sendMessage:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(116, 235, 213, 0.4), 0 0 20px rgba(116, 235, 213, 0.2);
}

#google-btn {
  background: linear-gradient(135deg, #4285f4, #34a853);
  color: #fff;
  box-shadow: 0 4px 15px rgba(66, 133, 244, 0.2);
}

#google-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(66, 133, 244, 0.4), 0 0 20px rgba(52, 168, 83, 0.2);
}

#Logout-btn {
  background: linear-gradient(135deg, #ff6a6a, #ff4d4d);
  color: white;
  border-radius: 8px;
  padding: 0.6rem 1.4rem;
  margin-bottom: 0.8rem;
  float: right;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(255, 106, 106, 0.2);
}

#Logout-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 106, 106, 0.4);
}

/* ==================== INFO TEXT ==================== */
p {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
  animation: textFade 1s ease-in-out;
}

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

/* ==================== CHAT CONTAINER ==================== */
.chat-container {
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  background-color: rgba(17, 25, 40, 0.7);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2rem;
  width: 90%;
  max-width: 680px;
  text-align: center;
  color: #f1f5f9;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 25px rgba(108, 92, 231, 0.1);
  animation: fadeInGlow 0.8s ease-in-out;
  position: relative;
  overflow: hidden;
}

/* ==================== MESSAGES BOX ==================== */
.message-box {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.message-box::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.message-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

/* ==================== MESSAGE ITEMS ==================== */
.msg-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 12px;
  margin: 10px 0;
  max-width: 100%;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  animation: msgSlideIn 0.5s ease-out;
  position: relative;
}

.msg-item.own {
  margin-left: 20%;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.3), 0 0 15px rgba(79, 70, 229, 0.1);
}

.msg-item.other {
  margin-right: 20%;
  background: rgba(255, 255, 255, 0.04);
  color: #e6eef8;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 15px rgba(108, 92, 231, 0.1);
}

.msg-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 20px rgba(108, 92, 231, 0.2);
}

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tailPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.msg-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.msg-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  flex: 0 0 44px;
  font-size: 14px;
  animation: avatarFloat 4s ease-in-out infinite;
}

@keyframes avatarFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.msg-content {
  min-width: 0;
}

.msg-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-size: 0.85rem;
  color: #d1d5db;
  margin-bottom: 6px;
}

.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  font-size: 0.98rem;
  line-height: 1.25;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.msg-actions-holder {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.msg-item:hover .msg-actions-holder {
  opacity: 1;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.03);
  border: none;
  color: #fff;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.12s;
}

.icon-btn:hover {
  transform: scale(1.08);
}

.edited-badge {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-left: 8px;
}

/* ==================== INPUT AREA (CHAT) ==================== */
div.input-area{
  padding: 0px 15px;
}
.input-area {
  display: flex;
  gap: 12px;
  align-items: center; /* Changed from flex-end to center for better vertical alignment */
  justify-content: center; /* Added to center horizontally within the container */
  padding: 1rem 0;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: box-shadow 0.3s ease;
}
.input-area:focus-within {
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.2);
}
textarea#message{
      margin: 0px 10px;
    width: 500%;
    /* height: 78px; */
    padding: 10px;
    border-radius: 10px;
    height: 48px;
}

/* ============ Custom Modals ============ */

.glass-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 25, 40, 0.6);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.glass-modal-card {
  background: rgba(30, 41, 59, 0.85);
  border-radius: 16px;
  padding: 1.8rem;
  width: 320px;
  text-align: center;
  color: #f1f5f9;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}
.glass-modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0.8rem;
}
.glass-modal-icon {
  font-size: 1.5rem;
}
.glass-modal-input{
  background-color: rgb(242, 11, 11);
}
.glass-modal-icon.danger { color: #f87171; }
.glass-modal-icon.edit { color: #60a5fa; }

.glass-modal-text { color: #cbd5e1; font-size: 0.95rem; margin-bottom: 1rem; }

.glass-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 1.2rem;
}
.glass-btn.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}
.glass-btn.danger:hover {
  background: linear-gradient(135deg, #f87171, #ef4444);
}

/* Animations */
.fade-in { opacity: 1 !important; }
.fade-out { opacity: 0 !important; }
.scale-in { transform: scale(1) !important; }
.scale-out { transform: scale(0.9) !important; opacity: 0 !important; 
}

/* === Clean Dark Input for Edit Message Modal === */
.glass-modal-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  font-size: 15px;
  color: #f1f5f9; /* light text */
  background: rgba(30, 41, 59, 0.8); /* dark bluish-gray */
  outline: none;
  transition: border 0.2s ease, background 0.2s ease;
}

.glass-modal-input::placeholder {
  color: rgba(241, 245, 249, 0.4);
}

.glass-modal-input:focus {
  border-color: rgba(94, 234, 212, 0.6);
  background: rgba(30, 41, 59, 0.9);
}

.glass-btn.primary {
  background: #22d3ee; /* cyan-like accent */
  color: #0f172a;
  font-weight: 600;
}

.glass-btn.primary:hover {
  background: #06b6d4;
}

.glass-btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

.glass-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}
