:root {
  --main-color: #acc8e5;
  --mainText-color: #112a46;
  --primary-color: #097d3a;
  --secondary-color: #028dea;
  --accent-color: rgb(255, 193, 7);
  --fadeSecondaryColor: rgba(33, 150, 243, 0.8);
  --fadeAccent-color: rgba(255, 193, 7, 0.8);
  --text-color: #333;
  --light-text-color: #f4f4f4;
  --background-light: #f9f9f9;
  --background-dark: #2c3e50;
  --card-background: rgb(255, 255, 255);
  --border-color: #ddd;
  --body-color: rgb(208, 229, 240);

  --font-family-primary: "poppins", sans-serif;
  --font-family-headings: "arial", serif;
}

html,
body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Fonts and base styles */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

body {
  font-family: "Inter", sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.body-bg {
  background-image: url("../assets/chatRoom/chatRoomBg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chatRoomContainer {
  height: 100vh;
}

/* --- Utility Classes (for JavaScript) --- */
.hidden {
  display: none !important;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(17, 24, 39, 0.75); /* bg-gray-900 with opacity */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background-color: #1f2937; /* bg-gray-800 */
  padding: 2rem; /* p-8 */
  border-radius: 0.5rem; /* rounded-lg */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-xl */
  max-width: 24rem; /* max-w-sm */
  width: 100%;
  margin: 0 1rem; /* mx-4 */
}

.modal-content.large {
  max-width: 28rem; /* max-w-md */
}

.modal-title {
  font-size: 1.5rem; /* text-2xl */
  font-weight: 700; /* font-bold */
  margin-bottom: 1rem; /* mb-4 */
  text-align: center;
}

.modal-subtitle {
  font-size: 0.875rem; /* text-sm */
  color: #9ca3af; /* text-gray-400 */
  margin-bottom: 1.5rem; /* mb-6 */
  text-align: center;
}

.modal-input {
  width: 100%;
  padding: 0.75rem; /* p-3 */
  border-radius: 0.5rem; /* rounded-lg */
  background-color: #374151; /* bg-gray-700 */
  color: #fff;
  border: none;
  outline: none;
  transition: all 0.2s ease-in-out;
}

.modal-input::placeholder {
  color: #9ca3af; /* placeholder-gray-400 */
}

.modal-input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #6a9c89; /* focus:ring-2 and ring-[#6a9c89] */
}

.error-message {
  color: #fca5a5; /* text-red-400 */
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.875rem; /* text-sm */
}

.success-message {
  color: #b4d4c8;
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

/* --- Disclaimer Specific Styles --- */
.disclaimer-text {
  font-size: 0.875rem; /* text-sm */
  color: #d1d5db; /* text-gray-300 */
  line-height: 1.5; /* space-y-4 */
  max-height: 24rem; /* max-h-96 */
  overflow-y: auto;
  padding-right: 0.5rem; /* pr-2 */
}

.disclaimer-list {
  list-style-type: disc;
  list-style-position: inside;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.disclaimer-list li {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.disclaimer-agreement {
  margin-top: 1rem;
  text-align: center;
  font-weight: 600; /* font-semibold */
  color: #9ca3af; /* text-gray-400 */
}

/* --- Loading State --- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.spinner {
  animation: spin 1s linear infinite;
  height: 2.5rem; /* h-10 */
  width: 2.5rem; /* w-10 */
  color: #6a9c89;
}

.loading-text {
  margin-top: 1rem; /* mt-4 */
  font-size: 0.875rem; /* text-sm */
  color: #9ca3af; /* text-gray-400 */
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* --- Main UI Layout --- */
.main-content {
  display: flex;
  height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

.chat-ui {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
}

.online-sidebar {
  background-color: #1f2937;
  width: 8rem;
  padding: 1rem;
  overflow-y: auto;
}

.online-sidebar-title {
  font-size: 1.125rem; /* text-lg */
  font-weight: 700; /* font-bold */
  margin-bottom: 1rem; /* mb-4 */
}

.online-users-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Responsive Hide for sidebar */
@media (max-width: 767px) {
  .hidden-md {
    display: none;
  }
}

/* --- Header --- */
.header {
  padding: 1rem; /* p-4 */
  background-color: #1f2937; /* bg-gray-800 */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* space-x-3 */
}

.logo {
  width: 60px;
  height: auto;
  border-radius: 100px;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--main-color);
  text-shadow: #5c8a77 1px 1px 2px;
}

.header-buttons-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.online-count-container {
  font-size: 0.875rem; /* text-sm */
  font-weight: 600; /* font-semibold */
  color: #9ca3af; /* text-gray-400 */
}

/* Responsive Hide for online count */
@media (max-width: 767px) {
  .online-count-container {
    display: none;
  }
}

/* --- Room Selection & Buttons --- */
.room-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0.5rem;
  background-color: #374151; /* bg-gray-700 */
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06); /* shadow-inner */
}

.room-button {
  border-radius: 0.2rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease-in-out;
  background-color: transparent;
  border: none;
  cursor: pointer;
  color: #fff;
}

.room-button:hover {
  background-color: #4b5563; /* hover:bg-gray-600 */
}

.room-button.active {
  background-color: #6a9c89;
  color: #fff;
}

.online-user {
  padding: 0.5rem; /* p-2 */
  border-radius: 0.5rem; /* rounded-lg */
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
  font-size: 0.875rem; /* text-sm */
}

.online-user:hover {
  background-color: #4b5563; /* hover:bg-gray-600 */
}

.online-user.active {
  background-color: #6a9c89;
  color: #fff;
}

/* --- Message Container & Bubbles --- */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem; /* p-4 */
  display: flex;
  flex-direction: column;
  gap: 1rem; /* space-y-4 */
  padding-bottom: 5rem; /* pb-20 */
  background-image: url("../assets/chatRoom/chatMessageContainerBg.png");
}

.chat-container {
  height: calc(100vh - 8rem - 3.5rem);
  transition: all 0.3s ease;
}

.message-container {
  display: flex;
  align-items: flex-start;
}

.message-container.self {
  justify-content: flex-end; /* justify-end */
}

.message-container.other {
  justify-content: flex-start; /* justify-start */
}

.message-bubble {
  max-width: 80%;
  word-wrap: break-word;
  padding: 2px 18px;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.message-bubble.self-bubble {
  background-color: #6a9c89;
  color: #fff;
  border-top-right-radius: 0; /* rounded-tr-none */
}

.message-bubble.other-bubble {
  background-color: #374151; /* bg-gray-700 */
  color: #fff;
  border-top-left-radius: 0; /* rounded-tl-none */
}

.message-sender {
  font-weight: 700; /* font-bold */
  font-size: 0.75rem; /* text-xs */
  color: #81c2ab;
  margin-bottom: 0.25rem; /* mb-1 */
}

.message-text {
  font-size: 0.875rem;
  font-weight: 600;
}

.chat-placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.chat-placeholder p {
  color: #6b7280; /* text-gray-500 */
}

/* --- Message Form --- */
.message-form {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem; /* p-4 */
  background-color: #1f2937; /* bg-gray-800 */
  box-shadow: 0 -4px 6px -1px rgba(253, 234, 234, 0.1),
    0 -2px 4px -1px rgba(0, 0, 0, 0.06);
  max-width: 1167px;
  margin: 0 auto;
}

.message-input-container {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* space-x-2 */
}

.message-input {
  flex: 1;
  padding: 0.75rem; /* p-3 */
  border-radius: 9999px; /* rounded-full */
  background-color: #374151; /* bg-gray-700 */
  color: #fff;
  border: none;
  outline: none;
  transition: all 0.2s ease-in-out;
}

.message-input::placeholder {
  color: #9ca3af; /* placeholder-gray-400 */
}

.message-input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #6a9c89;
}

.send-button {
  padding: 0.75rem; /* p-3 */
  background-color: #6a9c89;
  color: #fff;
  border-radius: 9999px; /* rounded-full */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-lg */
  transition: all 0.2s ease-in-out;
  border: none;
  cursor: pointer;
}

.send-button:hover {
  background-color: #5c8a77; /* hover:bg-[#5c8a77] */
}

.send-button:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #6a9c89;
}

.send-icon {
  height: 1.5rem; /* h-6 */
  width: 1.5rem; /* w-6 */
}

/* --- Button base styles and hover effects --- */
.primary-button {
  width: 100%;
  margin-top: 1.5rem; /* mt-6 */
  padding: 0.75rem; /* p-3 */
  background-color: #6a9c89;
  color: #fff;
  border-radius: 0.5rem; /* rounded-lg */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-lg */
  transition: all 0.2s ease-in-out;
  border: none;
  cursor: pointer;
}

.primary-button:hover {
  background-color: #5c8a77; /* hover:bg-[#5c8a77] */
}

.primary-button:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #6a9c89;
}

.suggest-room-button {
  padding: 0.5rem; /* p-2 */
  border-radius: 0.5rem; /* rounded-lg */
  background-color: #6a9c89;
  color: #fff;
  font-size: 0.875rem; /* text-sm */
  font-weight: 600; /* font-medium */
  transition: background-color 0.2s ease-in-out;
  border: none;
  cursor: pointer;
  white-space: nowrap; /* whitespace-nowrap */
}

.suggest-room-button:hover {
  background-color: #5c8a77; /* hover:bg-[#5c8a77] */
}

.secondary-button {
  width: 100%;
  margin-top: 0.5rem; /* mt-2 */
  padding: 0.5rem; /* p-2 */
  color: #9ca3af; /* text-gray-400 */
  transition: color 0.2s ease-in-out;
  background: transparent;
  border: none;
  cursor: pointer;
}

.secondary-button:hover {
  color: #fff; /* hover:text-white */
}

.exit-button {
    background-color: transparent;
    color: #fca5a5; /* Red color for visual distinction */
    border: 1px solid #fca5a5;
    padding: 0.3rem 0.55rem;
    border-radius: 0.5rem;
    font-size: 0.675rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    margin-left: 1rem; /* Add some space between it and other elements */
    white-space: nowrap;
}

.exit-button:hover {
    background-color: #fca5a5;
    color: #1f2937; /* Dark text on hover */
}

/*MEDIA QUERIES*/
@media (max-width: 768px) {
  .header {
    padding: 0.7rem;
  }

  .header-title {
    font-size: 1.5rem;
  }

  .main-container {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .main-container {
    width: 100%;
  }

  .header-title {
    font-size: 1.35rem;
  }

  .room-selection {
    gap: 5px;
    padding: 20px 15px;
    line-height: 5px;
  }

  .header-buttons-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .online-count-container {
    display: block;
    gap: 0;
  }
}
