* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: #111b21;
}

.whatsapp-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  margin: 0 auto;
  background: #efeae2;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

@media(min-width: 481px) {
  .whatsapp-container {
    height: 95vh;
    margin-top: 2.5vh;
    border-radius: 12px;
  }
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #efeae2;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  transform: translateX(100%);
  z-index: 1;
}

.screen.active {
  transform: translateX(0);
  z-index: 2;
}

/* TELA DE LOGIN */
#loginScreen {
  background: #ffffff;
  justify-content: center;
  align-items: center;
  padding: 30px;
}

.login-box {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.login-box h2 {
  font-size: 28px;
  color: #00a884;
  margin-bottom: 8px;
}

.login-box p {
  color: #667781;
  font-size: 14px;
  margin-bottom: 24px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

/* CABEÇALHOS */
.wa-header {
  background-color: #00a884;
  color: #ffffff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand-area {
  display: flex;
  flex-direction: column;
}

.wa-header h2 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.1;
}

.visitor-counter {
  font-size: 10px;
  color: #e0f2f1;
}

.user-profile-trigger {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  background: rgba(0,0,0,0.1);
  padding: 4px 10px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile-trigger:hover {
  background: rgba(0,0,0,0.2);
}

/* Alerta de Perfil Incompleto (Vermelho) */
.alert-badge {
  background: #ff4d4d;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulseRed 1.5s infinite;
}

.alert-badge.hidden {
  display: none;
}

@keyframes pulseRed {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(255, 77, 77, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(255, 77, 77, 0); }
}

.wa-header-actions {
  display: flex;
  gap: 8px;
}

.wa-icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* Chat Room Header */
.chat-room-header {
  background-color: #f0f2f5;
  color: #333;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dfe2e5;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-avatar.small {
  width: 35px;
  height: 35px;
  font-size: 12px;
}

.room-user-details {
  flex: 1;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.clickable-profile {
  font-size: 15px;
  font-weight: 600;
  color: #111;
  cursor: pointer;
}

.room-sub-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.user-status-text {
  font-size: 11px;
  color: #667781;
}

.catalog-badge-btn {
  background: #00a884;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

/* LISTA DE CONTATOS */
.wa-search-bar {
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #f0f2f5;
}

.wa-search-bar input {
  width: 100%;
  padding: 8px 14px;
  background: #f0f2f5;
  border: none;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
}

.chats-list {
  flex: 1;
  background: #ffffff;
  overflow-y: auto;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
}

.chat-item:hover {
  background: #f5f6f6;
}

.chat-info {
  flex: 1;
  margin-left: 15px;
}

.chat-title-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
}

.chat-title-row h4 {
  font-size: 16px;
  color: #111;
}

.chat-time {
  font-size: 11px;
  color: #667781;
}

.chat-snippet {
  font-size: 13px;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

/* MENSAGENS E FOOTER */
.messages-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  background: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  max-width: 80%;
  font-size: 14px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
  align-self: flex-start;
  word-break: break-word;
}

.wa-chat-footer {
  background: #f0f2f5;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-chat-footer input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
}

.wa-send-btn {
  background: #00a884;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* MODAIS */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: white;
  width: 90%;
  max-width: 400px;
  max-height: 85vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.modal-header {
  background: #00a884;
  color: white;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
}

.catalog-body, .admin-body, .profile-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Perfil Modal Styles */
.profile-body label {
  font-size: 13px;
  font-weight: bold;
  color: #333;
  display: block;
  margin-bottom: 4px;
}

.profile-body input, .profile-body textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.profile-body textarea {
  height: 70px;
  resize: vertical;
}

.profile-warning-banner {
  background: #ffe6e6;
  color: #cc0000;
  border: 1px solid #ff4d4d;
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 15px;
  text-align: center;
}

.profile-warning-banner.hidden {
  display: none;
}

/* Estado de alerta vermelho no botão caso perfil esteja vazio */
.user-profile-trigger.incomplete {
  border: 2px solid #ff4d4d;
  background-color: rgba(255, 77, 77, 0.2);
}

.admin-body input, .admin-body textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.wa-primary-btn {
  background: #00a884;
  color: white;
  border: none;
  padding: 10px;
  width: 100%;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.admin-prod-list, .catalog-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.catalog-card, .admin-card {
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  padding: 12px;
  border-radius: 8px;
}

.catalog-card h4, .admin-card h4 {
  color: #00a884;
  margin-bottom: 4px;
}

/* VÍDEOS EMBARCADOS */
.ch-video-embed {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  max-width: 100%;
}
.ch-video-embed iframe, 
.ch-video-embed video {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  border: 0;
  background: #000;
}
.ch-video-note {
  margin-top: 6px;
  padding: 8px;
  border-radius: 8px;
  background: #eef3f0;
  color: #315345;
  font-size: 12px;
}
.ch-video-note a {
  font-weight: bold;
  color: inherit;
}