/* =============================================
   Chat — Medieval style
   ============================================= */

/* ---- Full chat page ---- */

.chat-container {
  max-width: 800px;
  margin: 20px auto;
  padding: 28px 32px;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  color: var(--text);
}

.chat-container h1 {
  text-align: center;
  margin: 0 0 28px 0;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
  font-size: 1.8rem;
  letter-spacing: 1px;
}

/* Name setup panel */
.chat-name-setup {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  padding: 20px;
  margin-bottom: 20px;
}

.chat-name-setup h2 {
  margin: 0 0 14px 0;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.chat-name-setup form {
  display: flex;
  gap: 10px;
}

/* Shared input style */
.chat-name-setup input,
.chat-form input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-name-setup input:focus,
.chat-form input:focus {
  border-color: #c8960c;
}

/* Shared button style */
.chat-name-setup button,
.chat-form button {
  padding: 9px 20px;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  border-radius: 2px;
  color: #1a0a00;
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}

.chat-name-setup button:hover,
.chat-form button:hover {
  opacity: 0.85;
}

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

/* Message area */
.chat-messages {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  padding: 14px;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
}

.chat-message-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  background: rgba(0, 0, 0, 0.15);
  padding: 10px 12px;
  border-left: 3px solid #c8960c;
  border-radius: 0 2px 2px 0;
}

.chat-username {
  font-weight: 700;
  color: #c8960c;
  font-size: 0.88rem;
}

.chat-time {
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0.45;
  margin-left: 8px;
}

.chat-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(224, 200, 130, 0.15);
  color: #e0c882;
  border: 1px solid rgba(224, 200, 130, 0.3);
  vertical-align: middle;
}

.chat-message-admin {
  border-left-color: #e0c882;
}

.chat-text {
  margin: 6px 0 0 0;
  word-break: break-word;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

.chat-empty {
  text-align: center;
  color: var(--text);
  opacity: 0.45;
  margin: 50px 0;
  font-style: italic;
  font-size: 0.9rem;
}

.chat-form {
  display: flex;
  gap: 10px;
}

/* ---- Mini Chat ---- */

.chat-mini {
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  width: 300px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.chat-mini-cg {
  display: none;
}

@media (max-width: 1000px) {
  .chat-mini-cg {
    display: flex;
  }
}

@media (max-width: 1024px) {
  .chat-mini {
    width: 100%;
  }
}

.chat-mini-header {
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 6px;
}

.chat-mini-header h3 {
  margin: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
}

.chat-mini-messages {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
}

.chat-mini-message {
  background: rgba(0, 0, 0, 0.15);
  padding: 5px 8px;
  border-left: 2px solid #c8960c;
  border-radius: 0 2px 2px 0;
}

.chat-mini-username {
  font-weight: 700;
  color: #c8960c;
  font-size: 11px;
}

.chat-mini-text {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.3;
}

.chat-mini-empty {
  text-align: center;
  color: var(--text);
  opacity: 0.45;
  margin: 10px 0;
  font-size: 11px;
  font-style: italic;
}

.chat-mini-line {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.15);
  border-left: 2px solid #c8960c;
  border-radius: 0 2px 2px 0;
  text-align: left;
}

.chat-mini-user {
  font-weight: 700;
  color: #c8960c;
  font-size: 12px;
  margin-right: 5px;
  flex-shrink: 0;
}

.chat-mini-admin {
  border-left-color: #e0c882;
}

.chat-mini-admin-icon {
  color: #e0c882;
  font-size: 9px;
  margin-left: 3px;
}

.chat-mini-msg {
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
  flex: 1;
  max-width: 30vw;
}

.chat-mini-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  border-radius: 2px;
  color: #1a0a00;
  text-decoration: none;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  text-transform: uppercase;
}

.chat-mini-cta:hover {
  opacity: 0.85;
}

.chat-mini-title {
  margin: 0;
  font-size: 13px;
  font-family: "Cinzel", serif;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--papyrus-text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--surface-border);
}

@media (max-width: 800px) {
  .chat-mini {
    margin-top: 10px;
  }

  .chat-mini-msg {
    max-width: none;
  }
}
