body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.wrapper {
  display: flex;
  background: #1f2937;
  color: white;
}

.sidebar {
  width: 250px;
  background-color: #111827;
  color: #fff;
  height: 100vh;
  position: fixed;
  transition: all 0.3s ease;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar .toggle-btn {
  text-align: right;
  padding: 1rem;
}
.sidebar .toggle-btn i {
  border: solid 1px white;
  padding: 5px;
  border-radius: 2px;
  cursor: pointer;
}

.sidebar .toggle-btn i:hover {
  background-color: white;
  color: #1f2937;
  padding: 5px;
  border-radius: 2px;
  cursor: pointer;
}

#logoutBtn {
  cursor: pointer;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar ul li {
  padding: 15px 20px;
}

.sidebar ul li a {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: 0.3s;
}

.sidebar ul li a:hover {
  background-color: #1f2937;
  border-radius: 8px;
}

.sidebar.collapsed ul li a span {
  display: none;
}

.sidebar.collapsed ul li a {
  justify-content: center;
}

.content {
  margin-left: 250px;
  padding: 1rem;
  transition: all 0.3s ease;
  width: 100%;
}

.content.shifted {
  margin-left: 70px;
}

.tooltip-text {
  position: absolute;
  left: 70px;
  background-color: #333;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s ease;
}

.sidebar.collapsed ul li:hover .tooltip-text {
  opacity: 1;
  margin-left: 10px;
}

#displayWelUsername {
  width: fit-content;
  padding: 10px 0px;
  font-weight: bold;
  font-size: 24px;

  /* Gradient Text */
  background: linear-gradient(90deg, #007bff, #ff6a00);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;

  /* Bottom Border Animation */
  position: relative;
  overflow: hidden;
}
/* ---------------------------change password */
#oldPassword,
#newPassword {
  background-color: #1f2937;
  width: 200px;
  color: white;
}

#account-balance .btn {
  border-radius: 30px;
  transition: all 0.3s ease;
}

#account-balance .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 255, 255, 0.15);
}

#displayWelUsername::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(to right, #007bff, #ff6a00);
  transform: scaleX(0);
  transform-origin: left;
  animation: borderGrow 1.5s ease forwards;
}

@keyframes borderGrow {
  to {
    transform: scaleX(1);
  }
}

/* ============================account balance */
#userInfo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.sophisticated-card {
  background: #111827;
  color: #f3f4f6;
  padding: 24px;
  border-radius: 18px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, border 0.3s ease;
}

@media screen and (max-width: 500px) {
  .sophisticated-card {
    background: #111827;
    color: #f3f4f6;
    padding: 24px;
    border-radius: 18px;
    max-width: 280px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border 0.3s ease;
  }
}

.sophisticated-card::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #007bff, #ff6a00);
  z-index: -1;
}

.sophisticated-card:hover {
  transform: translateY(-4px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-header h6 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: #9ca3af;
  text-transform: uppercase;
}

.icon-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #f9fafb;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.icon-success {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.icon-warning {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

.card-body {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 160px;
}

.stat h5 {
  margin: 0;
  font-size: 1.4rem;
  color: #f3f4f6;
}

.stat p {
  margin: 0;
  font-size: 0.85rem;
  color: #9ca3af;
}

.card-footer {
  text-align: right;
  font-size: 0.75rem;
  color: #6b7280;
  border-top: 1px solid #374151;
  padding-top: 12px;
}

/* Already existing classes from before remain */

.icon-cash {
  background: rgba(59, 130, 246, 0.1); /* soft blue */
  color: #3b82f6;
}

/* Ensure reward section looks same as stat layout */
.reward-section {
  border-top: 1px solid #374151;
  padding-top: 16px;
  margin-top: 12px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* -------- User Chat Widget -------- */

/* Floating chat icon */
#chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #007bff, #17a2b8);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1001;
}

/* Modal container hidden by default; show by adding .show */
#chat-modal {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 320px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  font-family: Arial, sans-serif;
  z-index: 1000;
  display: none;
  max-height: 80vh;
  height: auto;
}
#chat-modal.show {
  display: flex;
  flex-direction: column;
}

/* Header */
#chat-modal .chat-header {
  background: #007bff;
  color: #fff;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#chat-modal .chat-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

/* Typing indicator */
#user-typing-indicator {
  padding: 4px 12px;
  font-style: italic;
  color: #666;
}

/* Messages window */
#chat-window {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f7f9fc;
  display: flex;
  flex-direction: column;
}

/* Message bubbles */
.msg {
  max-width: 70%;
  padding: 8px 12px;
  margin: 4px 0;
  border-radius: 12px;
  word-wrap: break-word;
}
.msg.incoming {
  background: #e2e3e5;
  align-self: flex-start;
  border-top-left-radius: 0;
  color: #2a2a3d;
}
.msg.outgoing {
  background: #007bff;
  color: #fff;
  align-self: flex-end;
  border-top-right-radius: 0;
}
.msg .timestamp {
  display: block;
  font-size: 0.7rem;
  color: rgba(0, 0, 0, 0.5);
  margin-top: 4px;
  text-align: right;
}

/* Input area */
#chat-modal .chat-input-group {
  display: flex;
  border-top: 1px solid #ddd;
  padding: 8px;
}
#chat-modal .chat-input-group input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding: 8px 12px;
  font-size: 0.9rem;
}
#chat-modal .chat-input-group button {
  background: #17a2b8;
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Online/offline status */
#online-status {
  text-align: center;
  font-size: 0.8rem;
  color: #666;
  padding: 6px 0;
}

@media (max-width: 768px) {
  #chat-modal.show {
    position: fixed;
    inset: 0; /* shorthand for top:0; right:0; bottom:0; left:0 */
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    display: flex; /* ensure flex column */
    flex-direction: column;
  }

  #chat-modal.show .chat-header,
  #chat-modal.show .chat-input-group {
    flex-shrink: 0;
  }

  #chat-modal.show #chat-window {
    flex: 1;
    min-height: 100px;
  }
}
