/* =========================
   GLOBAL
========================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

html,
body {
  height: 100%;
}

body {
  background: #0f172a;
  color: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

button {
  cursor: pointer;
  transition: 0.2s;
}

/* =========================
   LOGIN / REGISTER
========================= */

.authContainer {
  width: 100%;
  max-width: 400px;
  margin: 80px auto;
  background: #1e293b;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.authContainer h1 {
  text-align: center;
  margin-bottom: 25px;
  color: #38bdf8;
}

.authContainer input {
  width: 100%;
  padding: 14px;
  margin-bottom: 15px;
  border: none;
  border-radius: 12px;
  background: #334155;
  color: white;
  font-size: 15px;
}

.authContainer input::placeholder {
  color: #cbd5e1;
}

.authContainer button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #38bdf8;
  color: white;
  font-size: 15px;
}

.authContainer button:hover {
  background: #0ea5e9;
}

/* =========================
   DASHBOARD
========================= */

.dashboardHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin: 15px;
  padding: 20px;

  background: #1e293b;
  border-radius: 16px;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.dashboardHeader h1 {
  color: #38bdf8;
}

.headerButtons {
  display: flex;
  gap: 10px;
}

#settings {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: #38bdf8;
  color: white;
}

#settings:hover {
  background: #0ea5e9;
}

#logout {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: #ef4444;
  color: white;
}

#logout:hover {
  background: #dc2626;
}

/* =========================
   ADD CONTACT
========================= */

.addContactBox {
  margin: 15px;
  padding: 15px;

  display: flex;
  gap: 10px;

  background: #1e293b;
  border-radius: 16px;
}

#contactInput {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #334155;
  color: white;
}

#contactInput::placeholder {
  color: #cbd5e1;
}

#addContactBtn {
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: #22c55e;
  color: white;
}

#addContactBtn:hover {
  background: #16a34a;
}

/* =========================
   USER LIST / CHAT LIST
========================= */

#userList {
  padding: 15px;
}

#userList div {
  background: #1e293b;

  margin-bottom: 12px;

  padding: 18px;

  border-radius: 16px;

  cursor: pointer;

  transition: all 0.2s ease;

  position: relative;
}

#userList div:hover {
  background: #334155;
  transform: translateY(-2px);
}

#userList strong {
  font-size: 16px;
}

#userList small {
  color: #cbd5e1;
}

/* =========================
   UNREAD BADGE
========================= */

.badge {
  position: absolute;
  right: 15px;
  top: 18px;

  background: #22c55e;
  color: white;

  border-radius: 50%;

  min-width: 22px;
  height: 22px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  font-weight: bold;
}

/* =========================
   CHAT PAGE
========================= */

.chatHeader {
  background: #1e293b;
  padding: 18px;

  display: flex;
  align-items: center;
  gap: 15px;
}

.chatHeader h1 {
  font-size: 20px;
  color: #38bdf8;
}

/* =========================
   MESSAGES
========================= */

#messages {
  height: calc(100vh - 170px);

  overflow-y: auto;

  padding: 15px;

  display: flex;
  flex-direction: column;

  background: #0f172a;
}

.message {
  max-width: 75%;

  padding: 12px 15px;

  margin-bottom: 10px;

  border-radius: 18px;

  word-wrap: break-word;
  line-height: 1.4;

  position: relative;

  animation: fadeIn 0.2s ease;
}

.myMessage {
  align-self: flex-end;

  background: #22c55e;
  color: white;

  border-bottom-right-radius: 5px;
}

.otherMessage {
  align-self: flex-start;

  background: #334155;
  color: white;

  border-bottom-left-radius: 5px;
}

/* =========================
   MESSAGE TIME
========================= */

.time {
  display: block;

  font-size: 10px;

  opacity: 0.7;

  margin-top: 5px;

  text-align: right;
}

/* =========================
   CHAT INPUT
========================= */

.chatInputArea {
  display: flex;

  gap: 10px;

  padding: 15px;

  background: #1e293b;
}

#input {
  flex: 1;

  padding: 14px;

  border: none;

  border-radius: 14px;

  background: #334155;

  color: white;

  font-size: 15px;
}

#input::placeholder {
  color: #cbd5e1;
}

#sendBtn {
  padding: 14px 18px;

  border: none;

  border-radius: 14px;

  background: #38bdf8;

  color: white;
}

#sendBtn:hover {
  background: #0ea5e9;
}

/* =========================
   BACK BUTTON
========================= */

.backBtn {
  margin: 10px;

  padding: 10px 14px;

  border: none;

  border-radius: 10px;

  background: #475569;

  color: white;
}

.backBtn:hover {
  background: #64748b;
}

/* =========================
   CHAT IMAGES
========================= */

.chatImage {
  max-width: 250px;
  border-radius: 12px;
  margin-top: 5px;
}

/* =========================
   FOOTER
========================= */

footer {
  margin-top: auto;

  padding: 20px;

  text-align: center;

  background: #1e293b;

  border-top: 1px solid #334155;
}

footer a {
  color: #cbd5e1;

  margin: 0 10px;

  text-decoration: none;

  font-weight: bold;
}

footer a:hover {
  color: #38bdf8;
}

/* =========================
   SCROLLBAR
========================= */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 10px;
}

/* =========================
   ANIMATION
========================= */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 600px) {
  .authContainer {
    margin: 40px 15px;
  }

  .dashboardHeader {
    flex-direction: column;
    gap: 15px;
  }

  .headerButtons {
    width: 100%;
    justify-content: center;
  }

  .message {
    max-width: 90%;
  }

  .dashboardHeader h1 {
    font-size: 20px;
  }
}