html, body {
  background: #25272b;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #c7c9cc;
}

#chat-widget {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
  z-index: 9999;
  background: #25272b;
  display: flex;
  flex-direction: column;
}

.agent-header-avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-header-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #e5e7ef;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.agent-header-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  background: #2ecc71;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #25272b;
}

.agent-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.agent-header-name {
  font-weight: 700;
  font-size: 1.18rem;
  color: #fff;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.agent-header-profile {
  color: #ffe9b2;
  font-size: 0.97rem;
  margin-bottom: 2px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.agent-header-role {
  font-size: 0.97rem;
  color: #e0e7ef;
  opacity: 0.85;
}

@media (max-width: 600px) {
  .widget-header {
    min-height: 60px;
    padding: 0 0.7rem;
    gap: 10px;
  }
  .agent-header-avatar-wrap {
    width: 38px;
    height: 38px;
  }
  .agent-header-avatar {
    width: 38px;
    height: 38px;
  }
  .agent-header-status {
    width: 10px;
    height: 10px;
  }
  .agent-header-name {
    font-size: 1rem;
  }
  .agent-header-profile {
    font-size: 0.92rem;
  }
  .agent-header-role {
    font-size: 0.92rem;
  }
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #6b5e4f, #25272b) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  padding: 0 1.5rem;
  min-height: 72px;
  border-radius: 0;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  background: #25272b url('https://camo.githubusercontent.com/ebf18cd85f7aa9dc79fb74c58dc94febf3a6441d8d689cd5a400b2707e19ec0e/68747470733a2f2f7765622e77686174736170702e636f6d2f696d672f62672d636861742d74696c652d6461726b5f61346265353132653731393562366237333364393131306234303866303735642e706e67');
  background-image: linear-gradient(rgba(37, 39, 43, 0.95), rgba(37, 39, 43, 0.95)), url('https://camo.githubusercontent.com/ebf18cd85f7aa9dc79fb74c58dc94febf3a6441d8d689cd5a400b2707e19ec0e/68747470733a2f2f7765622e77686174736170702e636f6d2f696d672f62672d636861742d74696c652d6461726b5f61346265353132653731393562366237333364393131306234303866303735642e706e67');
  background-blend-mode: overlay;
  background-repeat: repeat;
  background-position: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 200px;
  max-height: calc(100vh - 180px);
  scrollbar-width: thin;
  scrollbar-color: #6b5e4f #25272b;
  border-radius: 8px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}

#chat-messages::-webkit-scrollbar {
  width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
  background: #25272b;
  border-radius: 4px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #6b5e4f;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#chat-messages::-webkit-scrollbar-thumb:hover {
  background: #7f7363;
}

@media (max-width: 600px) {
  #chat-messages {
    padding: 16px;
    gap: 10px;
  }
}

@media (max-width: 400px) {
  #chat-messages {
    padding: 12px;
    gap: 8px;
  }
}

.bubble {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 18px;
  max-width: 75%;
  word-break: break-word;
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 4px;
  white-space: pre-line;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bubble:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.bubble.visitor {
  background: #2c2e33;
  color: #c7c9cc;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  border: 1px solid #3c3f45;
}

.bubble.agent {
  background: linear-gradient(135deg, #4a4135 0%, #5a5246 50%, #4a4135 100%);
  color: #fff;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.bubble.system {
  background: #e0b107;
  color: #fff;
  align-self: center;
  border-radius: 14px;
  font-size: 0.95rem;
}

.bubble img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid #3c3f45;
  display: block;
  margin: 6px 0;
  background: #2c2e33;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bubble img:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

#chat-form-section, #chat-section {
  padding: 20px;
  background: #25272b;
  border-top: 1px solid #3c3f45;
}

#chat-input-group {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

#chat-input {
  flex: 1;
  border-radius: 14px;
  border: 1px solid #3c3f45;
  padding: 14px 18px;
  font-size: 1.05rem;
  transition: all 0.2s ease;
  background: #ffffff;
  color: #000000;
}

#chat-input:focus {
  border-color: #6b5e4f;
  box-shadow: 0 0 0 3px rgba(107, 94, 79, 0.2);
  outline: none;
}

#chat-send-btn {
  border-radius: 14px;
  background: linear-gradient(135deg, #6b5e4f, #7f7363);
  color: #fff;
  border: none;
  padding: 14px 28px;
  font-size: 1.05rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

#chat-send-btn:hover {
  background: linear-gradient(135deg, #7f7363, #6b5e4f);
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(107, 94, 79, 0.3);
}

#chat-image-btn {
  border-radius: 14px;
  background: #2c2e33;
  border: 1px solid #3c3f45;
  padding: 14px 18px;
  font-size: 1.2rem;
  color: #c7c9cc;
  transition: all 0.2s ease;
}

#chat-image-btn:hover {
  background: #3c3f45;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.typing-indicator {
  font-size: 0.95rem;
  color: #8e9297;
  margin: 0 0 8px 12px;
  font-style: italic;
  min-height: 18px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.typing-indicator:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

#visitor-info-form input {
  border-radius: 14px;
  padding: 14px 18px;
  border: 1px solid #3c3f45;
  transition: all 0.2s ease;
  margin-bottom: 14px;
  background: #ffffff;
  color: #000000;
  font-size: 1.05rem;
}

#visitor-info-form input:focus {
  border-color: #6b5e4f;
  box-shadow: 0 0 0 3px rgba(107, 94, 79, 0.2);
  outline: none;
}

#visitor-info-form button {
  border-radius: 14px;
  background: linear-gradient(135deg, #6b5e4f, #7f7363);
  padding: 14px;
  font-weight: 600;
  color: #fff;
  transition: all 0.2s ease;
  font-size: 1.05rem;
}

#visitor-info-form button:hover {
  background: linear-gradient(135deg, #7f7363, #6b5e4f);
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(107, 94, 79, 0.3);
}

@media (max-width: 600px) {
  #chat-widget {
    font-size: 0.95rem;
    height: 100dvh;
    max-height: 100dvh;
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
  }
  .widget-header {
    min-height: 56px;
    padding: 0 1rem;
  }
  #chat-messages {
    max-height: calc(100dvh - 160px);
    padding: 14px;
    gap: 10px;
  }
  .bubble {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 0.95rem;
  }
  .bubble img {
    max-width: 160px;
    max-height: 160px;
  }
  #chat-form-section, #chat-section {
    padding: 1px;
  }
  #chat-input-group {
    gap: 8px;
    margin-top: 10px;
  }
  #chat-input {
    padding: 12px 14px;
    font-size: 0.95rem;
  }
  #chat-send-btn {
    padding: 12px 20px;
    font-size: 0.95rem;
  }
  #chat-image-btn {
    padding: 12px 14px;
    font-size: 1.1rem;
  }
  #visitor-info-form input {
    padding: 12px 14px;
    font-size: 0.95rem;
    margin-bottom: 12px;
  }
  #visitor-info-form button {
    padding: 12px;
    font-size: 0.95rem;
  }
}

@media (min-width: 600px) and (max-width: 1024px) {
  #chat-widget {
    width: 90vw;
    max-width: 600px;
    height: 90dvh;
    max-height: 90dvh;
    border-radius: 14px;
    top: 5%;
    left: 5%;
    font-size: 1rem;
  }
  .widget-header {
    min-height: 60px;
    padding: 0 1.5rem;
  }
  #chat-messages {
    max-height: calc(90dvh - 170px);
    padding: 20px;
    gap: 12px;
  }
  .bubble {
    max-width: 80%;
    padding: 12px 16px;
    font-size: 1rem;
  }
  .bubble img {
    max-width: 200px;
    max-height: 200px;
  }
  #chat-form-section, #chat-section {
    padding: 16px;
  }
  #chat-input-group {
    gap: 10px;
    margin-top: 10px;
  }
  #chat-input {
    padding: 14px 16px;
    font-size: 1rem;
  }
  #chat-send-btn {
    padding: 14px 24px;
    font-size: 1rem;
  }
  #chat-image-btn {
    padding: 14px 16px;
    font-size: 1.2rem;
  }
  #visitor-info-form input {
    padding: 14px 16px;
    font-size: 1rem;
    margin-bottom: 14px;
  }
  #visitor-info-form button {
    padding: 14px;
    font-size: 1rem;
  }
}

@media (max-width: 400px) {
  #chat-widget {
    font-size: 0.9rem;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .bubble {
    max-width: 95%;
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  .bubble img {
    max-width: 140px;
    max-height: 140px;
  }
  #chat-input-group {
    gap: 6px;
  }
  #chat-send-btn {
    padding: 10px 16px;
  }
  #chat-image-btn {
    padding: 10px 12px;
  }
}

/* Desktop styles */
.video-bubble-thumb {
  position: relative;
  display: inline-block;
  cursor: pointer;
  max-width: 100%;
}

.video-bubble-thumb video {
  width: 100%;
  max-width: 480px;
  max-height: 360px;
  border-radius: 8px;
  background: #222;
  display: block;
  object-fit: cover;
}

.video-bubble-thumb div[style*="position:absolute"] {
  pointer-events: none;
}

/* Mobile styles */
@media (max-width: 400px) {
  .video-bubble-thumb video {
    max-width: 280px;
    max-height: 180px;
  }
}

#agent-select {
  margin-bottom: 14px;
  border-radius: 14px;
  padding: 14px 18px;
  border: 1px solid #3c3f45;
  background: #fff;
  color: #000;
  font-size: 1.05rem;
  transition: all 0.2s ease;
}
#agent-select:focus {
  border-color: #6b5e4f;
  box-shadow: 0 0 0 3px rgba(107, 94, 79, 0.2);
  outline: none;
}


#global-loading {
  position: fixed;
  z-index: 99999;
  inset: 0;
  background: rgba(37,39,43,0.98);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s cubic-bezier(.4,2,.6,1);
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 7px solid #e5e7ef;
  border-top: 7px solid #6b5e4f;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

@keyframes spin {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
}
