/* ============================================================
   TamedBlox — Chat System (FINAL PATCHED VERSION)
   ✔ Admin panel z-index fixed
   ✔ Mobile landscape mode fixed
   ✔ Fully responsive chat UI
============================================================ */

/* ============================================================
   FLOATING CHAT BUTTON
============================================================ */
.chat-circle {
  position: fixed;
  bottom: 26px;
  right: 26px;
  width: 55px;
  height: 55px;

  background: #4ef58a;
  color: #0b0f14;

  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 0 16px rgba(78, 245, 138, 0.5);
  cursor: pointer;

  z-index: 999999 !important;
  transition: 0.2s ease;
}

.chat-circle:hover {
  opacity: 0.9;
}

.hidden {
  display: none !important;
}

/* ============================================================
   ADMIN PANEL (RIGHT SIDEBAR)
============================================================ */
.admin-panel {
  position: fixed !important;
  top: 80px;
  right: 20px;

  width: 360px;
  height: 72vh;

  background: #0f141a;
  border: 1px solid rgba(78,245,138,0.25);
  border-radius: 14px;

  padding: 16px;

  overflow-y: auto;
  scrollbar-width: thin;

  box-shadow: 0 0 18px rgba(78,245,138,0.25);

  z-index: 999999 !important;
}

.admin-panel-header {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 12px;
}

.admin-chat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-chat-item {
  background: #10161d;
  border: 1px solid rgba(78,245,138,0.25);
  border-radius: 10px;

  padding: 12px;
  cursor: pointer;

  transition: 0.2s ease;
}

.admin-chat-item:hover {
  border-color: #4ef58a;
  box-shadow: 0 0 12px rgba(78,245,138,0.25);
}

/* ============================================================
   MAIN CHAT WINDOW
============================================================ */
.chat-window {
  position: fixed !important;
  bottom: 26px;
  right: 96px;

  width: 370px;
  height: 520px;

  background: #0f141a;
  border: 1px solid rgba(78,245,138,0.25);
  border-radius: 14px;

  display: flex;
  flex-direction: column;

  overflow: hidden;

  box-shadow: 0 0 18px rgba(78,245,138,0.35);

  z-index: 999999 !important;
}

.chat-order-summary {
  padding: 14px;
  font-size: 13px;
  color: #b7bec9;
  background: rgba(78,245,138,0.07);
  border-bottom: 1px solid rgba(78,245,138,0.25);
}

/* ============================================================
   MESSAGES AREA
============================================================ */
.chat-messages {
  flex: 1;
  overflow-y: auto;

  padding: 14px;
  scroll-behavior: smooth;

  font-size: 14px;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  margin-bottom: 12px;

  border-radius: 12px;
  line-height: 1.3;
}

/* User (Me) */
.msg.me {
  background: #4ef58a;
  color: #0b0f14;
  margin-left: auto;
}

/* Them */
.msg.them {
  background: #1a222c;
  border: 1px solid rgba(255,255,255,0.07);
  color: #dce2ea;
}

/* System messages */
.msg.system {
  opacity: 0.6;
  font-size: 12px;
  text-align: center;
}

/* ============================================================
   INPUT ROW
============================================================ */
.chat-input-row {
  display: flex;
  padding: 12px;
  gap: 8px;

  background: #0b0f14;
  border-top: 1px solid rgba(78,245,138,0.18);
}

#chatInput {
  flex: 1;
  padding: 12px;

  background: #10161d;
  border: 1px solid rgba(78,245,138,0.25);
  border-radius: 10px;

  color: white;
  font-size: 15px;
}

#chatInput:focus {
  outline: 1px solid #4ef58a;
}

.chat-send-btn {
  width: 55px;
  height: 55px;

  background: #4ef58a;
  border: none;
  border-radius: 12px;

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

  transition: 0.2s ease;
}

.chat-send-btn:hover {
  opacity: 0.85;
}

/* ============================================================
   RESPONSIVE FIXES — MOBILE & LANDSCAPE MODE
============================================================ */
@media (max-width: 768px) {
  .chat-window {
    right: 20px;
    bottom: 20px;
    width: 92%;
  }

  .admin-panel {
    width: 92%;
    right: 4%;
    top: 70px;
  }

  .chat-circle {
    right: 20px;
  }
}

/* ============================================================
   LANDSCAPE MODE FIX (short screens / horizontal phones)
============================================================ */
@media (max-height: 500px) {
  .chat-window {
    top: 10px !important;
    bottom: 10px !important;

    right: 10px !important;
    left: 10px !important;

    height: auto !important;
    max-height: calc(100vh - 20px) !important;

    border-radius: 14px;
  }

  .chat-messages {
    max-height: calc(100vh - 200px) !important;
    overflow-y: auto !important;
  }
}
