/* === SIGINT Chat Styles === */

/* --- Tab Bar (Grupos / Directos) --- */

.chat-tabs {
  display: flex;
  border-bottom: 1px solid #008f11;
}

.chat-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  color: #008f11;
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 18px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
}

.chat-tab.active {
  color: #00ff41;
  border-bottom-color: #00ff41;
}

/* --- Section Headers --- */

.section-header {
  padding: 10px 15px;
  color: #008f11;
  font-size: 16px;
  border-bottom: 1px solid #0a0a0a;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* --- Group List --- */

.group-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.group-item {
  padding: 12px 15px;
  border-bottom: 1px solid #0a0a0a;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.group-item:hover {
  background: #0a0a0a;
}

.group-icon {
  width: 40px;
  height: 40px;
  border: 1px solid #008f11;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 12px;
  color: #00ff41;
  flex-shrink: 0;
}

.group-info {
  flex: 1;
  min-width: 0;
}

.group-name {
  color: #00ff41;
  font-size: 20px;
}

.group-preview {
  color: #008f11;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.group-meta {
  text-align: right;
  flex-shrink: 0;
}

.group-badge {
  background: #ff0000;
  color: #000;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.group-time {
  color: #008f11;
  font-size: 14px;
}

/* --- Locked Groups --- */

.group-item.locked {
  pointer-events: none;
  opacity: 0.35;
}

.group-item.locked .group-icon {
  border-color: #333;
  color: #333;
}

.group-item.locked .group-name {
  background: linear-gradient(90deg, #1a1a1a 0%, #333 50%, #1a1a1a 100%);
  background-size: 200% 100%;
  color: transparent;
  user-select: none;
  animation: lockedScan 3s linear infinite;
}

.group-item.locked .group-preview {
  background: linear-gradient(90deg, #1a1a1a 0%, #222 50%, #1a1a1a 100%);
  background-size: 200% 100%;
  color: transparent;
  user-select: none;
  max-width: 120px;
  display: inline-block;
  animation: lockedScan 3s linear infinite;
  animation-delay: 0.5s;
}

@keyframes lockedScan {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Conversation Screen Layout --- */

.screen.flex-layout {
  display: flex !important;
  flex-direction: column;
}

/* --- Conversation Header --- */

.chat-header {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #008f11;
}

.back-btn {
  background: none;
  border: 1px solid #008f11;
  color: #00ff41;
  padding: 4px 12px;
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 18px;
}

.back-btn:hover {
  border-color: #00ff41;
}

.chat-header .group-name {
  flex: 1;
  text-align: center;
  font-size: 20px;
  color: #00ff41;
}

/* --- Messages Container --- */

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px 15px;
}

.message {
  margin-bottom: 15px;
  animation: fadeIn 0.3s;
}

.message-sender {
  color: #ffb000;
  font-size: 16px;
  margin-bottom: 2px;
  display: inline;
}

.message-time {
  color: #008f11;
  font-size: 14px;
  margin-left: 10px;
}

.message-text {
  color: #00ff41;
  font-size: 18px;
  line-height: 1.4;
}

.message-text a,
.message-link {
  color: #ffb000;
  text-decoration: underline;
  cursor: pointer;
}

.typing-indicator {
  opacity: 0.6;
}

.typing-dots::after {
  content: '...';
  animation: typingDots 1s steps(4) infinite;
}

@keyframes typingDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.message-sender.player {
  color: #ffb000;
}

.message-text.player {
  color: #ffb000;
}

/* --- Player Input Area --- */

.chat-input-area {
  position: fixed;
  bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  left: 0;
  width: 100%;
  padding: 10px;
  display: flex;
  background: #000;
  border-top: 1px solid #008f11;
  box-sizing: border-box;
  z-index: 50;
}

.chat-input {
  flex: 1;
  background: #0a0a0a;
  border: 1px solid #008f11;
  color: #00ff41;
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 8px;
  outline: none;
}

.chat-input:focus {
  border-color: #00ff41;
}

.send-btn {
  background: #008f11;
  color: #000;
  border: none;
  padding: 8px 16px;
  font-family: 'VT323', monospace;
  font-size: 18px;
  cursor: pointer;
  margin-left: 8px;
}

.send-btn:hover {
  background: #00ff41;
}

/* --- DM List --- */

.dm-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dm-item {
  padding: 12px 15px;
  border-bottom: 1px solid #0a0a0a;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.dm-item:hover {
  background: #0a0a0a;
}

.dm-item.unread {
  border-left: 3px solid #ffb000;
}

.dm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #ffb000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffb000;
  font-size: 18px;
  margin-right: 12px;
  flex-shrink: 0;
}

.dm-info {
  flex: 1;
  min-width: 0;
}

.dm-name {
  color: #ffb000;
  font-size: 20px;
}

.dm-preview {
  color: #008f11;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

/* --- RPG Choices --- */

.rpg-choices {
  padding: 10px 0;
}

.rpg-choices {
  border-top: 1px solid #008f11;
  padding-top: 15px;
  margin-top: 10px;
}

.rpg-choices::before {
  content: '▶ SELECCIONA UNA RESPUESTA';
  display: block;
  color: #008f11;
  font-size: 12px;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.rpg-choice {
  display: block;
  width: 100%;
  padding: 12px 12px 12px 20px;
  margin-bottom: 8px;
  background: transparent;
  border: 1px solid #008f11;
  border-left: 3px solid #008f11;
  color: #00ff41;
  font-family: 'VT323', monospace;
  font-size: 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  box-sizing: border-box;
}

.rpg-choice:hover {
  border-color: #ffb000;
  border-left-color: #ffb000;
  color: #ffb000;
  background: rgba(255, 176, 0, 0.05);
  padding-left: 25px;
}

.rpg-choice .choice-label {
  font-size: 13px;
  color: #008f11;
  display: block;
  margin-top: 6px;
  letter-spacing: 1px;
}

.rpg-choice:hover .choice-label {
  color: #ffb000;
}

.rpg-choice.selected {
  border-color: #ffb000;
  border-left-color: #ffb000;
  background: rgba(255, 176, 0, 0.1);
  pointer-events: none;
}

/* === Responsive === */

@media (max-width: 360px) {
  .group-name { font-size: 17px; }
  .group-preview { font-size: 14px; max-width: 180px; }
  .group-icon { width: 34px; height: 34px; font-size: 16px; margin-right: 10px; }
  .chat-tab { font-size: 16px; padding: 8px; }
  .message-text { font-size: 16px; }
  .message-sender { font-size: 14px; }
  .back-btn { font-size: 16px; padding: 3px 10px; }
  .chat-header .group-name { font-size: 17px; }
  .rpg-choice { font-size: 16px; padding: 10px; }
  .dm-avatar { width: 34px; height: 34px; font-size: 16px; margin-right: 10px; }
  .dm-name { font-size: 17px; }
  .dm-preview { font-size: 14px; max-width: 180px; }
  .chat-input { font-size: 16px; }
  .send-btn { font-size: 16px; padding: 8px 12px; }
}

@media (min-width: 481px) {
  .group-preview { max-width: 350px; }
  .dm-preview { max-width: 350px; }
}

@media (min-width: 769px) {
  .chat-input-area {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
}
