/* AyurChat - Brutal Design Theme */

/* Import Inter font */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

/* Import Bebas Neue font for titles */
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap");

/* Essential CSS Variables */
:root {
  --brutal-primary: #28a745;
  --brutal-secondary: #f7931e;
  --brutal-success: #28a745;
  --brutal-danger: #dc3545;
  --brutal-warning: #ffc107;
  --brutal-info: #17a2b8;
  --brutal-dark: #2c3e50;
  --brutal-light: #ffffff;
  --brutal-shadow: 4px 4px 0px rgba(0, 0, 0, 0.8);
  --brutal-shadow-hover: 6px 6px 0px rgba(0, 0, 0, 0.8);
  --bg-primary: #f8f9fa;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: linear-gradient(45deg, #fff 25%, transparent 25%),
    linear-gradient(-45deg, #fff 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #fff 75%),
    linear-gradient(-45deg, transparent 75%, #fff 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow: hidden; /* Prevent body scrolling */
}

/* Brutal Design Button Styling */
.btn {
  border: 3px solid black !important;
  font-weight: 700 !important;
  border-radius: 0 !important;
  box-shadow: var(--brutal-shadow) !important;
  transition: all 0.1s ease !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:hover {
  transform: translate(-2px, -2px) !important;
  box-shadow: var(--brutal-shadow-hover) !important;
}

.btn:active {
  transform: translate(1px, 1px) !important;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8) !important;
}

.btn-primary {
  background-color: var(--brutal-primary) !important;
  border-color: black !important;
  color: white !important;
}

.btn-primary:hover {
  background-color: #218838 !important;
  color: white !important;
}

.btn-secondary {
  background-color: var(--brutal-secondary) !important;
  border-color: black !important;
  color: white !important;
}

.btn-secondary:hover {
  background-color: #e5840a !important;
  color: white !important;
}

.btn-success {
  background-color: var(--brutal-success) !important;
  border-color: black !important;
  color: white !important;
}

.btn-success:hover {
  background-color: #218838 !important;
  color: white !important;
}

.btn-outline-primary {
  background-color: white !important;
  border-color: black !important;
  color: var(--brutal-primary) !important;
}

.btn-outline-primary:hover {
  background-color: var(--brutal-primary) !important;
  color: white !important;
}

/* Login button with Google icon styling */
#loginBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#loginBtn img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Authentication Required Modal Styling */
#authRequiredModal .modal-dialog {
  max-width: 400px;
  margin: 1rem auto;
}

#authRequiredModal .modal-content {
  border: 3px solid black;
  border-radius: 0;
  box-shadow: var(--brutal-shadow);
}

#authRequiredModal .modal-header {
  background-color: var(--brutal-primary);
  color: white;
  border-bottom: 3px solid black;
  text-align: center;
  padding: 1rem 1.5rem;
  position: relative;
}

#authRequiredModal .modal-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--brutal-primary);
  z-index: 1;
}

#authRequiredModal .modal-title {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 1.1rem;
  margin: 0;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#authRequiredModal .modal-body {
  padding: 1.5rem;
  background-color: white;
}

#authRequiredModal .auth-icon {
  margin-bottom: 1rem;
}

#authRequiredModal .auth-icon i {
  font-size: 2.5rem;
}

#authRequiredModal .modal-body h6 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

#authRequiredModal .modal-body p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

#authRequiredModal .modal-footer {
  background-color: #f8f9fa;
  border-top: 3px solid black;
  padding: 1rem 1.5rem;
}

#authRequiredModal .btn-primary {
  font-size: 1rem;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: white !important;
  color: black !important;
  border: 3px solid black !important;
  width: 100%;
  justify-content: center;
}

#authRequiredModal .btn-primary:hover {
  background-color: #f8f9fa !important;
  color: black !important;
  transform: translate(-2px, -2px);
  box-shadow: var(--brutal-shadow-hover);
}

#authRequiredModal .btn-primary:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
}

#authRequiredModal .btn-primary img {
  width: 18px;
  height: 18px;
}

#authRequiredModal .alert-info {
  background-color: var(--brutal-warning);
  border: 2px solid black;
  border-radius: 0;
  color: black;
  font-weight: 600;
  box-shadow: var(--brutal-shadow);
  font-size: 0.85rem;
  padding: 0.75rem;
  margin-bottom: 0;
}

/* Responsive Design for Authentication Modal */

/* Large screens (PCs) */
@media (min-width: 1025px) {
  #authRequiredModal .modal-dialog {
    max-width: 380px;
  }

  #authRequiredModal .modal-body {
    padding: 1.25rem;
  }

  #authRequiredModal .modal-header {
    padding: 0.875rem 1.25rem;
  }

  #authRequiredModal .modal-title {
    font-size: 1.1rem;
  }

  #authRequiredModal .modal-footer {
    padding: 0.875rem 1.25rem;
  }
}

/* Tablets */
@media (max-width: 1024px) and (min-width: 769px) {
  #authRequiredModal .modal-dialog {
    max-width: 360px;
    margin: 0.75rem auto;
  }

  #authRequiredModal .modal-body {
    padding: 1.25rem;
  }

  #authRequiredModal .modal-header {
    padding: 0.875rem 1.25rem;
  }

  #authRequiredModal .modal-title {
    font-size: 1rem;
  }

  #authRequiredModal .modal-footer {
    padding: 0.875rem 1.25rem;
  }

  #authRequiredModal .auth-icon i {
    font-size: 2.25rem;
  }
}

/* Mobile devices */
@media (max-width: 768px) {
  #authRequiredModal .modal-dialog {
    max-width: 320px;
    margin: 0.5rem auto;
  }

  #authRequiredModal .modal-content {
    border: 2px solid black;
  }

  #authRequiredModal .modal-header {
    padding: 0.75rem 1rem;
    border-bottom: 2px solid black;
  }

  #authRequiredModal .modal-title {
    font-size: 0.95rem;
  }

  #authRequiredModal .modal-body {
    padding: 1rem;
  }

  #authRequiredModal .auth-icon {
    margin-bottom: 0.75rem;
  }

  #authRequiredModal .auth-icon i {
    font-size: 2rem;
  }

  #authRequiredModal .modal-body h6 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  #authRequiredModal .modal-body p {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }

  #authRequiredModal .modal-footer {
    padding: 0.75rem 1rem;
    border-top: 2px solid black;
  }

  #authRequiredModal .btn-primary {
    font-size: 0.9rem;
    padding: 8px 16px;
  }

  #authRequiredModal .btn-primary img {
    width: 16px;
    height: 16px;
  }

  #authRequiredModal .alert-info {
    font-size: 0.8rem;
    padding: 0.6rem;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  #authRequiredModal .modal-dialog {
    max-width: 280px;
    margin: 0.25rem auto;
  }

  #authRequiredModal .modal-header {
    padding: 0.6rem 0.8rem;
  }

  #authRequiredModal .modal-title {
    font-size: 0.85rem;
  }

  #authRequiredModal .modal-body {
    padding: 0.8rem;
  }

  #authRequiredModal .auth-icon i {
    font-size: 1.75rem;
  }

  #authRequiredModal .modal-body h6 {
    font-size: 0.85rem;
  }

  #authRequiredModal .modal-body p {
    font-size: 0.75rem;
  }

  #authRequiredModal .modal-footer {
    padding: 0.6rem 0.8rem;
  }

  #authRequiredModal .btn-primary {
    font-size: 0.85rem;
    padding: 6px 12px;
  }

  #authRequiredModal .btn-primary img {
    width: 14px;
    height: 14px;
  }

  #authRequiredModal .alert-info {
    font-size: 0.75rem;
    padding: 0.5rem;
  }
}

/* Book Selection Buttons - Layout only */
.btn[data-book] {
  text-align: left;
  justify-content: flex-start;
  width: 100%;
}

.btn[data-book] i {
  margin-right: 0.75rem;
}

/* Chat Messages - Brutal Design Styling */
.message {
  margin-bottom: 20px;
  animation: messageSlide 0.3s ease-out;
}

.message:first-child {
  margin-top: 10px; /* Extra top margin for first message */
}

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

.message-bot,
.message-ai {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.message-user {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 50px;
  height: 50px;
  background: var(--brutal-primary);
  color: white;
  border-radius: 0;
  border: 3px solid black;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 900;
  box-shadow: var(--brutal-shadow);
  flex-shrink: 0;
}

.user-avatar {
  background: var(--brutal-secondary);
}

.message-content {
  max-width: 60%;
  background: white;
  border: 3px solid black;
  padding: 15px 20px;
  box-shadow: var(--brutal-shadow);
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.message-user .message-content {
  background: var(--brutal-secondary);
  color: white;
}

.message-content::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: 20px;
  border: 10px solid transparent;
}

.message-bot .message-content::before {
  left: -23px;
  border-right-color: black;
}

.message-bot .message-content::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: 20px;
  left: -17px;
  border: 10px solid transparent;
  border-right-color: white;
}

.message-user .message-content::before {
  right: -23px;
  border-left-color: black;
}

.message-user .message-content::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: 20px;
  right: -17px;
  border: 10px solid transparent;
  border-left-color: var(--brutal-secondary);
}

.message-time {
  font-size: 0.8rem;
  color: #333;
  margin-top: 5px;
  text-align: right;
  font-weight: 600;
}

.message-user .message-time {
  color: rgba(255, 255, 255, 0.9);
  text-align: left;
}

/* Quick Replies Styling */
.quick-replies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.quick-reply-btn {
  background: white;
  border: 3px solid black;
  padding: 12px 18px;
  font-weight: 700;
  color: black;
  text-decoration: none;
  transition: all 0.1s ease;
  box-shadow: var(--brutal-shadow);
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
  border-radius: 0;
  width: 100%;
}

.quick-reply-btn:hover {
  background: var(--brutal-success);
  transform: translate(-2px, -2px);
  box-shadow: var(--brutal-shadow-hover);
  color: white;
  text-decoration: none;
}

.quick-reply-btn:hover i {
  color: white;
}

.quick-reply-btn:active,
.quick-reply-btn.clicked {
  background: var(--brutal-success);
  color: white;
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
}

.quick-reply-btn:active i,
.quick-reply-btn.clicked i {
  color: white;
}

.quick-reply-btn i {
  margin-right: 8px;
  color: var(--brutal-shadow);
}

/* Follow-up Message Styling - Now uses standard message styling */
.follow-up-message {
  margin-top: 10px;
}

/* Follow-up question button styling - same as quick reply buttons */
.follow-up-message .quick-reply-btn:hover {
  background: var(--brutal-primary);
  transform: translate(-2px, -2px);
  box-shadow: var(--brutal-shadow-hover);
  color: white;
  text-decoration: none;
}

.follow-up-message .quick-reply-btn:hover i {
  color: white;
}

.follow-up-message .quick-reply-btn:active,
.follow-up-message .quick-reply-btn.clicked {
  background: var(--brutal-primary);
  color: white;
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
}

.follow-up-message .quick-reply-btn:active i,
.follow-up-message .quick-reply-btn.clicked i {
  color: white;
}

/* Markdown Content Styling - Brutal Design */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  color: inherit;
}

.message-text h1 {
  font-size: 1.5rem;
  border-bottom: 3px solid black;
  padding-bottom: 0.5rem;
}

.message-text h2 {
  font-size: 1.3rem;
  border-bottom: 2px solid black;
  padding-bottom: 0.3rem;
}

.message-text h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.message-text h4,
.message-text h5,
.message-text h6 {
  font-size: 1rem;
  font-weight: 700;
}

.message-text {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

.message-text p {
  margin-bottom: 1rem;
  line-height: 1.6;
  font-weight: 600;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message-text strong,
.message-text b {
  font-weight: 900;
}

.message-text em,
.message-text i {
  font-style: italic;
  font-weight: 600;
}

.message-text code {
  background-color: var(--brutal-warning);
  border: 2px solid black;
  border-radius: 0;
  padding: 0.125rem 0.25rem;
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
  color: black;
  font-weight: 700;
}

.message-text pre {
  background-color: var(--brutal-warning);
  border: 3px solid black;
  border-radius: 0;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: var(--brutal-shadow);
}

.message-text pre code {
  background: none;
  border: none;
  padding: 0;
  color: black;
}

.message-text ul,
.message-text ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.message-text li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
  font-weight: 600;
}

.message-text ul li {
  list-style-type: disc;
}

.message-text ol li {
  list-style-type: decimal;
}

.message-text blockquote {
  border-left: 4px solid var(--brutal-primary);
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background-color: var(--brutal-warning);
  font-style: italic;
  border: 2px solid black;
  box-shadow: var(--brutal-shadow);
}

.message-text a {
  color: var(--brutal-primary);
  text-decoration: none;
  font-weight: 700;
}

.message-text a:hover {
  color: var(--brutal-secondary);
  text-decoration: underline;
}

.message-text img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
  margin: 1rem 0;
  border: 3px solid black;
  box-shadow: var(--brutal-shadow);
}

.message-text table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
  border: 3px solid black;
  box-shadow: var(--brutal-shadow);
}

.message-text th,
.message-text td {
  padding: 0.75rem;
  text-align: left;
  border: 2px solid black;
  font-weight: 600;
}

.message-text th {
  background-color: var(--brutal-primary);
  color: white;
  font-weight: 900;
}

.message-text hr {
  border: none;
  border-top: 3px solid black;
  margin: 2rem 0;
}

.message-time {
  font-size: 0.75rem;
  opacity: 1;
  margin-top: 0.5rem;
  text-align: right;
}

.message-ai .message-time {
  text-align: left;
}

/* Loading Indicator - Brutal Design */
.typing-indicator {
  display: none;
  margin-bottom: 20px;
}

.typing-indicator .message-content {
  min-width: 120px;
  max-width: 150px;
  padding: 15px 20px;
  background: white;
  border: 3px solid black;
  box-shadow: var(--brutal-shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.typing-indicator .message-content::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: 25px;
  left: -23px;
  border: 10px solid transparent;
  border-right-color: black;
  z-index: 1;
  pointer-events: none;
}

.typing-indicator .message-content::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: 25px;
  left: -17px;
  border: 10px solid transparent;
  border-right-color: white;
  z-index: 2;
  pointer-events: none;
}

.typing-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brutal-dark);
  text-align: center;
}

.typing-dots {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--brutal-primary);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Status Messages - Bootstrap validation feedback styling */

.valid-feedback,
.invalid-feedback {
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.valid-feedback {
  color: #198754;
}

.invalid-feedback {
  color: #dc3545;
}

/* Brutal Design Card Styling */
.card {
  border: 4px solid black !important;
  border-radius: 0 !important;
  box-shadow: var(--brutal-shadow) !important;
  background-color: white !important;
}

.card-header {
  background-color: var(--brutal-primary) !important;
  color: white !important;
  border-bottom: 4px solid black !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-body {
  background-color: white !important;
}

/* Brutal Design Navbar Styling */
.navbar {
  border-bottom: 4px solid black !important;
  box-shadow: var(--brutal-shadow) !important;
}

.navbar-brand {
  font-weight: 900 !important;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5) !important;
  font-size: 1.5rem !important;
}

/* Brutal Design Form Styling */
.form-control {
  border: 3px solid black !important;
  border-radius: 0 !important;
  font-weight: 600 !important;
  box-shadow: inset 2px 2px 0px rgba(0, 0, 0, 0.1) !important;
}

.form-control:focus {
  border-color: black !important;
  box-shadow: inset 2px 2px 0px rgba(0, 0, 0, 0.1), 0 0 0 3px var(--brutal-info) !important;
}

/* Chat Container */
.chat-container {
  max-width: 900px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: white;
  border: 4px solid black;
  box-shadow: var(--brutal-shadow);
  position: relative;
}

/* Chat Header */
.chat-header {
  background: var(--brutal-primary);
  color: white;
  padding: 12px 20px;
  border-bottom: 4px solid black;
  text-align: left;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-credits-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid white;
}

.credits-btn {
  padding: 6px 12px;
  font-size: 0.9rem;
  min-width: auto;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Ensure logout button matches credits button size */
#logoutBtn {
  padding: 6px 12px;
  font-size: 0.9rem;
  min-width: auto;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.user-name {
  font-weight: 600;
  font-size: 1rem;
}

.chat-header h1 {
  flex: 1;
  text-align: center;
  margin: 0;
  font-size: 1.8rem;
  font-weight: 900;
  text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5);
}

.chat-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 300%;
  height: 100%;
  /* background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 15px,
    rgba(255, 255, 255, 0.15) 15px,
    rgba(255, 255, 255, 0.15) 30px
  );
  animation: slideStripes 8s linear infinite; */
}

@keyframes slideStripes {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(33.333%);
  }
}

.chat-header h1 {
  font-size: 1.8rem;
  font-weight: 900;
  text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5);
  margin: 0;
  position: relative;
  z-index: 2;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #fefefe;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-subtitle {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 10px;
  position: relative;
  z-index: 2;
}

/* Chat Input Container */
.chat-input-container {
  padding: 20px;
  border-top: 4px solid black;
  background: white;
  flex-shrink: 0;
}

.chat-input-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

/* Chat input styling */
.chat-input {
  font-size: 1rem;
  padding: 0.875rem 1rem;
  min-height: 76px;
  resize: none;
  overflow: hidden;
  max-height: 200px;
}

/* Terms and Privacy Policy Footer */
.terms-footer {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 0;
  padding: 0 1rem;
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease,
    margin 0.3s ease, padding 0.3s ease;
  max-height: 50px;
  overflow: hidden;
}

.terms-footer.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.terms-text {
  color: #333;
  font-size: 0.75rem;
  line-height: 1.4;
  margin: 0;
  font-weight: 500;
}

.terms-link {
  color: #1e7e34;
  text-decoration: underline;
  font-weight: 600;
  transition: color 0.2s ease;
}

.terms-link:hover {
  color: #d17a0a;
  text-decoration: underline;
}

.terms-link:focus {
  outline: 2px solid var(--brutal-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Text Streaming Animation Styles */
.streaming-container {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.streaming-text {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  max-width: 100%;
}

.streaming-cursor {
  color: var(--brutal-primary);
  font-weight: 900;
  animation: cursorBlink 1s infinite;
  margin-left: 2px;
  flex-shrink: 0;
}

@keyframes cursorBlink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0.3;
  }
}

.streaming-controls {
  margin-top: 10px;
  text-align: center;
}

.post-response-controls {
  margin-top: 10px;
  text-align: center;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.post-response-controls .btn {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 0;
  border: 2px solid black;
  font-weight: 600;
  transition: all 0.2s ease;
}

.post-response-controls .btn:hover {
  transform: translateY(-1px);
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.3);
}

/* Version Navigation Styles */
.version-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
  padding: 4px 8px;
}

.version-navigation .btn {
  padding: 2px 6px;
  font-size: 0.7rem;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.version-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brutal-dark);
  min-width: 40px;
  text-align: center;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

/* Thinking indicator within message */
.thinking-indicator-in-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  color: var(--brutal-dark);
}

.thinking-indicator-in-message .typing-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--brutal-dark);
}

.thinking-indicator-in-message .typing-dots {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.thinking-indicator-in-message .typing-dots span {
  width: 8px;
  height: 8px;
  background-color: var(--brutal-primary);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.thinking-indicator-in-message .typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.thinking-indicator-in-message .typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.thinking-indicator-in-message .typing-dots span:nth-child(3) {
  animation-delay: 0s;
}

.new-content-indicator {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.new-content-indicator .btn {
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--brutal-shadow);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Input state during generation */
.chat-input.generating {
  background-color: #f8f9fa;
  border-color: #495057;
  color: #495057;
}

.send-button.generating {
  background-color: #495057 !important;
  border-color: #495057 !important;
  color: white !important;
  cursor: not-allowed;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .streaming-cursor {
    animation: none;
    opacity: 1;
  }

  .new-content-indicator .btn {
    animation: none;
  }

  .post-response-controls .btn {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .streaming-cursor {
    color: #000;
    font-weight: 900;
  }

  .post-response-controls .btn {
    border-width: 3px;
  }
}

/* .chat-input:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
} */

.send-button {
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  font-size: 1.1rem;
}

/* Message Styling - Updated for Brutal Design */
.message-user,
.message-ai,
.message-bot {
  width: 100%;
  max-width: 800px; /* Match input field width */
  margin-bottom: 1rem;
}

.message-ai,
.message-bot {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.message-user {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  flex-direction: row-reverse;
}

/* Loading indicator for infinite scroll */
.loading-messages {
  text-align: center;
  padding: 1rem;
  color: #495057;
}

.loading-messages .spinner-border {
  width: 1.5rem;
  height: 1.5rem;
}

/* Error Pages Styling */
.error-container {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.error-content {
  text-align: center;
  max-width: 600px;
  background: white;
  border: 4px solid black;
  padding: 40px;
  box-shadow: var(--brutal-shadow);
}

.error-icon {
  font-size: 8rem;
  color: var(--brutal-primary);
  margin-bottom: 2rem;
  text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5);
}

.error-icon.error {
  color: var(--brutal-danger);
}

.error-title {
  font-size: 4rem;
  font-weight: 900;
  color: var(--brutal-dark);
  margin-bottom: 1rem;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.3);
}

.error-subtitle {
  font-size: 1.5rem;
  color: var(--brutal-secondary);
  margin-bottom: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.error-description {
  font-size: 1.1rem;
  color: var(--brutal-dark);
  margin-bottom: 3rem;
  line-height: 1.6;
  font-weight: 600;
}

.btn-home {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  border-radius: 0;
  margin: 0.5rem;
}

.footer {
  background-color: var(--brutal-dark);
  border-top: 4px solid black;
  padding: 2rem 0;
  margin-top: auto;
  color: white;
  text-align: center;
  font-weight: 600;
}

.footer small {
  color: white;
  font-weight: 600;
}

/* Brutal Design Progress Bar */
.progress {
  border: 3px solid black;
  border-radius: 0;
  box-shadow: var(--brutal-shadow);
}

.progress-bar {
  background-color: var(--brutal-primary);
  border-radius: 0;
}

/* Brutal Design Alert Styling */
.alert {
  border: 3px solid black;
  border-radius: 0;
  box-shadow: var(--brutal-shadow);
  font-weight: 600;
}

.alert-primary {
  background-color: var(--brutal-primary);
  color: white;
  border-color: black;
}

.alert-secondary {
  background-color: var(--brutal-secondary);
  color: white;
  border-color: black;
}

.alert-success {
  background-color: var(--brutal-success);
  color: white;
  border-color: black;
}

.alert-danger {
  background-color: var(--brutal-danger);
  color: white;
  border-color: black;
}

.alert-warning {
  background-color: var(--brutal-warning);
  color: black;
  border-color: black;
}

.alert-info {
  background-color: var(--brutal-info);
  color: white;
  border-color: black;
}

/* Page Container for other pages */
.page-container {
  max-width: 900px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: white;
  border: 4px solid black;
  box-shadow: var(--brutal-shadow);
  position: relative;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  background: #fefefe;
  scroll-behavior: smooth;
}

/* Custom scrollbar for page content */
.page-content::-webkit-scrollbar {
  width: 12px;
}

.page-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border: 2px solid black;
}

.page-content::-webkit-scrollbar-thumb {
  background: var(--brutal-primary);
  border: 2px solid black;
}

.page-content::-webkit-scrollbar-thumb:hover {
  background: #218838;
}

/* Responsive Design */

/* Large screens (laptops and PCs) - horizontal credit packages */
@media (min-width: 1025px) {
  .credit-packages {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
  }

  .credit-package {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
  }

  /* Center Current Balance for large screens */
  .modal-body .row .col-md-6:first-child {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .credits-balance {
    margin: 0 auto;
  }

  /* Ensure credit packages display horizontally on large screens */
  .modal-body .row .col-md-6:last-child {
    width: 100%;
  }

  /* Center the entire Current Balance section */
  .modal-body .row {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .modal-body .row .col-md-6:first-child {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
  }

  .credit-packages {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
  }
}

/* Large tablets and small desktops */
@media (max-width: 1024px) {
  .chat-container {
    margin: 10px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .page-container {
    padding: 10px;
  }
}

/* Tablets and mobile devices */
@media (max-width: 1024px) {
  /* Enhanced touch handling for tablets */
  .chat-input {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: text;
    user-select: text;
  }

  .chat-input:focus {
    -webkit-tap-highlight-color: transparent;
  }

  /* Ensure buttons are touch-friendly on tablets */
  .btn,
  .quick-reply-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
  }

  /* Credit packages horizontal layout for tablets */
  .credit-packages {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }

  .credit-package {
    flex: 0 1 auto;
    min-width: 180px;
    max-width: 220px;
  }

  /* Center Current Balance for tablets */
  .modal-body .row .col-md-6:first-child {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .credits-balance {
    margin: 0 auto;
  }

  /* Center the entire Current Balance section for tablets */
  .modal-body .row {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .modal-body .row .col-md-6:first-child {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
  }

  /* Ensure credit packages container takes full width */
  .modal-body .row .col-md-6:last-child {
    width: 100%;
  }
}

/* Tablets */
@media (max-width: 768px) {
  .chat-container {
    height: 100vh;
    border: none;
    box-shadow: none;
    margin: 0;
    max-width: 100vw;
    max-height: 100vh;
  }

  .page-container {
    height: 100vh;
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .chat-header {
    padding: 10px 15px;
  }

  .chat-header h1 {
    font-size: 1.4rem;
  }

  .chat-messages {
    padding: 15px;
  }

  .message-user,
  .message-ai,
  .message-bot {
    max-width: 100%;
    padding: 0 0.5rem;
    margin-bottom: 15px;
  }

  .message-content {
    max-width: 75%;
  }

  .message-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .typing-indicator .message-content {
    min-width: 100px;
    max-width: 130px;
  }

  .typing-indicator .message-content::before {
    left: -18px;
    top: 20px;
    border-width: 8px;
  }

  .typing-indicator .message-content::after {
    left: -12px;
    top: 20px;
    border-width: 8px;
  }

  .quick-replies {
    grid-template-columns: 1fr;
  }

  /* Credit packages vertical layout for mobile */
  .credit-packages {
    flex-direction: column;
    align-items: center;
  }

  .credit-package {
    max-width: 100%;
    width: 100%;
  }

  .chat-input-wrapper {
    max-width: 100%;
    padding: 0 0.5rem;
  }

  .chat-input-container {
    padding: 0.75rem;
  }

  .chat-input {
    min-height: 76px !important;
  }

  .terms-footer {
    padding: 0 0.5rem;
    margin-top: 6px;
  }

  .terms-text {
    font-size: 0.7rem;
    line-height: 1.3;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    border: none;
    box-shadow: none;
    z-index: 1000;
  }

  .page-container {
    height: 100vh;
    width: 100vw;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .chat-header {
    padding: 8px 12px;
    position: sticky;
    top: 0;
    z-index: 1001;
  }

  .chat-header h1 {
    font-size: 1rem;
  }

  .chat-messages {
    padding: 10px;
    height: calc(100vh - 140px); /* Account for header and input */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .message-user,
  .message-ai,
  .message-bot {
    max-width: 95%;
    padding: 0 0.25rem;
    margin-bottom: 12px;
  }

  .message-content {
    max-width: 80%;
  }

  .message-avatar {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }

  .chat-input-container {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 3px solid black;
    padding: 8px;
    z-index: 1001;
  }

  .chat-input {
    min-height: 60px !important;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .quick-replies {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .quick-reply-btn {
    padding: 10px;
    font-size: 0.85rem;
  }

  .terms-footer {
    padding: 0 0.25rem;
    margin-top: 4px;
  }

  .terms-text {
    font-size: 0.65rem;
    line-height: 1.2;
  }

  .post-response-controls {
    flex-wrap: wrap;
    gap: 4px;
  }

  .version-navigation {
    margin-right: 8px;
    padding: 2px 4px;
  }

  .version-navigation .btn {
    padding: 1px 4px;
    font-size: 0.6rem;
    min-width: 20px;
    height: 20px;
  }

  .action-buttons .btn {
    padding: 4px 6px;
    font-size: 0.7rem;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .chat-header h1 {
    font-size: 1rem;
  }

  .chat-messages {
    padding: 8px;
    height: calc(100vh - 120px);
  }

  .message-content {
    max-width: 85%;
  }

  .chat-input {
    min-height: 50px !important;
  }

  .quick-reply-btn {
    padding: 8px;
    font-size: 0.8rem;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .chat-messages {
    height: calc(100vh - 100px);
  }

  .chat-header {
    padding: 6px 12px;
  }

  .chat-header h1 {
    font-size: 1rem;
  }

  .chat-input-container {
    padding: 6px;
  }

  .chat-input {
    min-height: 50px !important;
  }
}

/* Fix for mobile keyboard issues */
@media (max-width: 768px) {
  .chat-container {
    /* Ensure proper viewport handling */
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
  }

  .page-container {
    height: 100vh;
    height: 100dvh;
  }

  .chat-messages {
    /* Use flexbox for better keyboard handling */
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    height: calc(100dvh - 140px);
  }

  .chat-input-container {
    /* Ensure input stays above keyboard */
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 3px solid black;
    margin-top: auto;
  }

  /* Prevent body scroll when keyboard is open */
  body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }

  /* Enhanced mobile input focus and interaction */
  .chat-input {
    /* Ensure proper touch handling */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: text;
    user-select: text;

    /* Improve focus visibility */
    outline: none;
    border: 3px solid black;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .chat-input:focus {
    outline: none;
    border: 3px solid var(--brutal-primary);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25);
    /* Ensure the input is properly focused */
    -webkit-tap-highlight-color: transparent;
  }

  /* Ensure input is always interactive on mobile */
  .chat-input:not(:disabled) {
    pointer-events: auto;
    cursor: text;
  }

  /* Improve touch target size */
  .chat-input-container {
    /* Ensure the entire input area is touchable */
    padding: 12px;
  }

  .chat-input-wrapper {
    /* Make the wrapper more touch-friendly */
    position: relative;
  }

  /* Add visual feedback for touch interactions */
  .chat-input:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  /* Ensure proper z-index for input */
  .chat-input-container {
    z-index: 1000;
  }

  /* Improve button touch handling */
  .btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* Ensure quick reply buttons work well on mobile */
  .quick-reply-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Improve touch target size */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }
}

/* Custom scrollbar for chat messages */
.chat-messages::-webkit-scrollbar {
  width: 12px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border: 2px solid black;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--brutal-primary);
  border: 2px solid black;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #218838;
}

/* Credits Modal Styles */
.credits-balance {
  text-align: center;
  padding: 20px;
  background: var(--brutal-warning);
  border: 3px solid black;
  border-radius: 0;
  margin-bottom: 20px;
}

.credits-amount {
  font-size: 3rem;
  font-weight: 900;
  color: var(--brutal-dark);
  display: block;
}

.credits-label {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brutal-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.credit-packages {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  justify-content: center;
}

.credit-package {
  background: white;
  border: 3px solid black;
  border-radius: 0;
  padding: 20px;
  text-align: center;
  transition: none;
  box-shadow: var(--brutal-shadow);
  flex: 0 1 auto;
  min-width: 200px;
  max-width: 250px;
}

.credit-package:hover {
  /* Remove hover effects for the container */
}

.credit-package.selected {
  /* Remove selection styling */
}

.package-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.package-credits {
  font-size: 2rem;
  font-weight: 900;
  color: var(--brutal-secondary);
  margin-bottom: 5px;
}

.package-price {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.package-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 15px;
}

.purchase-btn {
  width: 100%;
  padding: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.transaction-history {
  max-height: 300px;
  overflow-y: auto;
  border: 2px solid black;
  border-radius: 0;
}

.transaction-item {
  padding: 15px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.transaction-item:last-child {
  border-bottom: none;
}

.transaction-details {
  flex: 1;
}

.transaction-amount {
  font-weight: 700;
  color: var(--brutal-primary);
}

.transaction-status {
  padding: 4px 8px;
  border-radius: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.transaction-status.succeeded {
  background: var(--brutal-success);
  color: white;
}

.transaction-status.pending {
  background: var(--brutal-warning);
  color: black;
}

.transaction-status.failed {
  background: var(--brutal-danger);
  color: white;
}

/* Payment Modal Styles */
.payment-details {
  background: #f8f9fa;
  border: 2px solid black;
  border-radius: 0;
  padding: 20px;
  margin-bottom: 20px;
}

.payment-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.payment-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brutal-dark);
}

.payment-credits {
  font-size: 1.2rem;
  color: var(--brutal-primary);
  font-weight: 600;
}

.razorpay-container {
  text-align: center;
}

.razorpay-btn {
  background: #528ff0;
  color: white;
  border: none;
  padding: 15px 30px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--brutal-shadow);
}

.razorpay-btn:hover {
  background: #3d7bd6;
  transform: translate(-2px, -2px);
  box-shadow: var(--brutal-shadow-hover);
}

/* Tablet Responsive for Header */
@media (max-width: 1024px) and (min-width: 769px) {
  .header-right .btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    height: 36px;
  }

  .credits-btn {
    font-size: 0.9rem;
    padding: 6px 12px;
    height: 34px;
  }

  #logoutBtn {
    font-size: 0.9rem;
    padding: 6px 12px;
    height: 34px;
  }

  .user-avatar-img {
    width: 36px;
    height: 36px;
  }

  /* Credit packages horizontal layout for tablets */
  .credit-packages {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }

  .credit-package {
    flex: 0 1 auto;
    min-width: 180px;
    max-width: 220px;
  }

  /* Center Current Balance for tablets */
  .modal-body .row .col-md-6:first-child {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .credits-balance {
    margin: 0 auto;
  }

  /* Center the entire Current Balance section for tablets */
  .modal-body .row {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .modal-body .row .col-md-6:first-child {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
  }

  /* Ensure credit packages container takes full width */
  .modal-body .row .col-md-6:last-child {
    width: 100%;
  }
}

/* Mobile Responsive for Header */
@media (max-width: 768px) {
  .chat-header {
    flex-direction: row;
    gap: 10px;
    padding: 10px 15px;
    justify-content: space-between;
  }

  .header-left {
    order: 1;
    justify-content: flex-start;
    flex: 1;
  }

  .chat-header h1 {
    order: 1;
    font-size: 1.4rem;
    margin: 0;
    text-align: left;
  }

  .header-right {
    order: 2;
    justify-content: flex-end;
    flex: 1;
  }

  .user-info {
    flex-direction: row;
    gap: 6px;
    align-items: center;
  }

  .user-credits-container {
    gap: 4px;
  }

  .credits-btn {
    font-size: 0.8rem;
    padding: 6px 10px;
    height: 42px;
    min-width: auto;
  }

  #logoutBtn {
    font-size: 0.8rem;
    padding: 6px 10px;
    height: 42px;
    min-width: auto;
  }

  .user-name {
    font-size: 0.9rem;
    display: none; /* Hide username on mobile to save space */
  }

  .user-avatar-img {
    width: 42px;
    height: 42px;
  }

  /* Make all header buttons larger on mobile for better touch interaction */
  .header-right .btn {
    font-size: 0.8rem;
    padding: 8px 12px;
    height: 42px;
    min-width: auto;
  }

  .header-right .btn i {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .chat-header {
    padding: 8px 10px;
  }

  .header-left {
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-start;
  }

  .header-left .btn {
    font-size: 0.8rem;
    padding: 5px 10px;
  }

  .chat-header h1 {
    font-size: 1.2rem;
    text-align: left;
  }

  .header-right {
    justify-content: flex-end;
  }

  .user-info {
    gap: 4px;
  }

  .credits-btn {
    font-size: 0.7rem;
    padding: 4px 8px;
    height: 42px;
  }

  #logoutBtn {
    font-size: 0.7rem;
    padding: 4px 8px;
    height: 42px;
  }

  .user-avatar-img {
    width: 42px;
    height: 42px;
  }

  /* Larger buttons for very small screens for better touch interaction */
  .header-right .btn {
    font-size: 0.7rem;
    padding: 6px 10px;
    height: 42px;
  }

  .header-right .btn i {
    font-size: 0.6rem;
  }

  .credit-packages {
    flex-direction: column;
    align-items: center;
  }

  .credit-package {
    padding: 15px;
    max-width: 100%;
    width: 100%;
  }

  .package-credits {
    font-size: 1.5rem;
  }

  .package-price {
    font-size: 1.2rem;
  }
}

/* Extra small phones (320px and below) - Must be last to override other rules */
@media (max-width: 320px) {
  .chat-header h1 {
    font-size: 0.9rem !important;
  }
}

/* Load More Messages Button */
#loadMoreBtn {
  width: 100%;
  margin: 10px 0;
  padding: 8px 16px;
  font-size: 0.9rem;
  border: 2px solid var(--brutal-primary);
  background-color: white;
  color: var(--brutal-primary);
  transition: all 0.2s ease;
}

#loadMoreBtn:hover {
  background-color: var(--brutal-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#loadMoreBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Day Separator - WhatsApp Style */
.day-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  position: relative;
}

.day-separator::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: #e0e0e0;
  z-index: 1;
}

.day-separator-text {
  background-color: #f0f0f0;
  color: #666;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  position: relative;
  z-index: 2;
  border: 1px solid #e0e0e0;
}

/* Dark mode day separator */
@media (prefers-color-scheme: dark) {
  .day-separator::before {
    background-color: #404040;
  }

  .day-separator-text {
    background-color: #2a2a2a;
    color: #ccc;
    border-color: #404040;
  }
}

/* Balance Update Loading Styles */
.balance-loading {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  color: var(--brutal-secondary);
  font-weight: 500;
}

.balance-loading .spinner-border-sm {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
}

/* Animation for balance updates */
@keyframes balanceUpdate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.balance-updated {
  animation: balanceUpdate 0.3s ease-in-out;
}

/* Load More Button Styles */
#loadMoreBtn {
  position: sticky;
  bottom: 10px;
  z-index: 100;
  background: var(--brutal-light);
  border: 2px solid var(--brutal-primary);
  box-shadow: var(--brutal-shadow);
  transition: all 0.3s ease;
  max-width: 200px;
  padding: 0px 25px;
  border-radius: 25px;
  margin: 10px auto;
  display: block;
  min-height: 50px;
  line-height: 1.2;
}

#loadMoreBtn:hover {
  background: var(--brutal-primary);
  color: var(--brutal-light);
  box-shadow: var(--brutal-shadow-hover);
  transform: translateY(-2px);
}

#loadMoreBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#loadMoreBtn:disabled:hover {
  background: var(--brutal-light);
  color: var(--brutal-primary);
  box-shadow: var(--brutal-shadow);
  transform: none;
}

/* Mobile responsiveness for Load More button */
@media (max-width: 768px) {
  #loadMoreBtn {
    bottom: 5px;
    max-width: 150px;
    min-height: 45px;
    font-size: 0.8rem;
    padding: 0px 20px;
    margin: 5px auto;
  }
}
