* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #0a0a0a;
  color: #e5e5e5;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 640px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #0f0f0f;
  border-left: 1px solid #1a1a1a;
  border-right: 1px solid #1a1a1a;
}

/* ---- HEADER ---- */

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #1a1a1a;
  background: #0f0f0f;
}

#logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  color: #8b5cf6;
  font-size: 20px;
}

.logo-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

#resetBtn {
  background: none;
  border: 1px solid #2a2a2a;
  color: #888;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

#resetBtn:hover {
  color: #e5e5e5;
  border-color: #444;
  background: #1a1a1a;
}

/* ---- CHAT ---- */

#chat {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* ---- MENSAGENS ---- */

.msg {
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

.msg-content {
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 14px;
}

.msg.user {
  align-self: flex-end;
}

.msg.user .msg-content {
  background: #8b5cf6;
  color: white;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
}

.msg.bot .msg-content {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-bottom-left-radius: 4px;
}

/* ---- TYPING INDICATOR ---- */

.typing {
  align-self: flex-start;
}

.typing .msg-content {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 5px;
  padding: 16px 20px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #555;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- POST CARD ---- */

.post-card {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  overflow: hidden;
  max-width: 100%;
}

.post-card-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #1a1a1a;
}

.post-card-image.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 13px;
}

.post-card-body {
  padding: 16px;
}

.post-card-section {
  margin-bottom: 12px;
}

.post-card-section:last-child {
  margin-bottom: 0;
}

.post-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8b5cf6;
  margin-bottom: 6px;
}

.post-card-text {
  font-size: 14px;
  line-height: 1.6;
  color: #ccc;
}

.post-card-hashtags {
  font-size: 13px;
  color: #8b5cf6;
  line-height: 1.8;
}

.post-card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #2a2a2a;
}

.post-card-actions button {
  flex: 1;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  background: #1a1a1a;
  color: #ccc;
  cursor: pointer;
  transition: all 0.2s;
}

.post-card-actions button:hover {
  background: #252525;
  border-color: #444;
  color: #fff;
}

.post-card-actions button.primary {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: white;
}

.post-card-actions button.primary:hover {
  background: #7c4fe0;
}

/* ---- INPUT AREA ---- */

#input-area {
  padding: 16px 20px 12px;
  border-top: 1px solid #1a1a1a;
  background: #0f0f0f;
}

#input-wrapper {
  display: flex;
  align-items: center;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s;
}

#input-wrapper:focus-within {
  border-color: #8b5cf6;
}

#msg {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #e5e5e5;
  font-size: 14px;
  font-family: inherit;
  padding: 10px 0;
}

#msg::placeholder {
  color: #555;
}

#sendBtn {
  background: #8b5cf6;
  border: none;
  color: white;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

#sendBtn:hover {
  background: #7c4fe0;
}

#sendBtn:disabled {
  background: #333;
  color: #555;
  cursor: not-allowed;
}

#footer {
  text-align: center;
  padding: 10px 0 2px;
  font-size: 12px;
  color: #444;
}

#footer strong {
  color: #555;
}

/* ---- SCROLLBAR ---- */

#chat::-webkit-scrollbar {
  width: 4px;
}

#chat::-webkit-scrollbar-track {
  background: transparent;
}

#chat::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border-radius: 4px;
}

#chat::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* ---- MOBILE ---- */

@media (max-width: 640px) {
  #app {
    max-width: 100%;
    border: none;
  }

  #chat {
    padding: 16px;
  }

  .msg {
    max-width: 90%;
  }

  .post-card-actions {
    flex-wrap: wrap;
  }

  .post-card-actions button {
    min-width: calc(50% - 4px);
  }
}
