/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: #0f0f10;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* Main Messenger Container */
.messenger {
  width: 360px;          /* default width for desktop */
  max-width: 95vw;       /* fills almost full width on mobile */
  min-width: 280px;      
  height: 650px;         /* desktop default height */
  max-height: 90vh;      /* prevent overflow on small screens */
  background: #1c1c1e;
  border-radius: 40px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 15px 50px rgba(0,0,0,0.6);
  position: relative;
}

/* Header */
.header {
  padding: 16px;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  color: white;
  background: #242426;
  border-bottom: 1px solid #2f2f32;
}

/* Chat Area */
.chat-area {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Message Bubble */
.message {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: fadeIn 0.25s ease-in-out;
}

.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, #ff00cc, #3333ff);
  color: white;
}

.received {
  align-self: flex-start;
  background: rgba(255,255,255,0.1);
  color: white;
}

/* Input Area */
.input-area {
  padding: 12px 15px;
  background: #242426;
  border-top: 1px solid #2f2f32;
}

form {
  display: flex;
  gap: 10px;
}

input {
  flex: 1;
  padding: 12px 15px;
  border-radius: 20px;
  border: none;
  outline: none;
  background: #2c2c2e;
  color: white;
  font-size: 14px;
}

input::placeholder {
  color: #888;
}

button {
  padding: 12px 18px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, #ff00cc, #3333ff);
}

button:hover {
  opacity: 0.9;
}

.link-box {
  margin-top: 8px;
  font-size: 12px;
  color: #aaa;
}

.hide {
  display: none;
}

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

/* ======================= */
/* RESPONSIVE DESIGN START */
/* ======================= */

/* Mobile Phones (≤ 480px) - fill most of screen */
@media (max-width: 480px) {
  .messenger {
    width: 95vw;
    height: 95vh;       /* fills phone screen */
    border-radius: 30px;
  }
  .chat-area {
    padding: 12px;
  }
  input {
    font-size: 14px;
    padding: 10px 12px;
  }
  button {
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* Tablets (481px – 768px) - fill most of screen, slightly smaller than phones */
@media (min-width: 481px) and (max-width: 768px) {
  .messenger {
    width: 80vw;
    height: 90vh;       /* fills tablet screen nicely */
    border-radius: 35px;
  }
  .chat-area {
    padding: 14px;
  }
  input {
    font-size: 15px;
    padding: 11px 14px;
  }
  button {
    padding: 11px 16px;
    font-size: 15px;
  }
}

/* Laptops & Small Desktops (769px – 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .messenger {
    width: 400px;
    height: 600px;
  }
}

/* Large Desktops (1025px – 1440px) */
@media (min-width: 1025px) {
  .messenger {
    width: 450px;
    height: 650px;
  }
}