@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --bg-primary: #212121;
  --bg-secondary: #171717;
  --bg-tertiary: #2f2f2f;
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-tertiary: #8e8e8e;
  --border-color: #4d4d4d;
  --accent: #ff5fa2;
  --accent-hover: #ff2f74;
  --shadow: rgba(0, 0, 0, 0.3);
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.new-chat-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.new-chat-btn:hover {
  background: var(--bg-tertiary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.chat-history {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
}

.user-menu:hover {
  background: var(--bg-tertiary);
}

.logo-badge-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-badge-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

  .chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem;
  }

#chat-log {
  max-width: 48rem;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem;
}

.logo-badge-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255, 95, 162, 0.4);
}

.logo-badge-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.charity-tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 500px;
  line-height: 1.5;
}

.charity-tagline a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.charity-tagline a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.empty-state h1 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.seo-text {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  text-align: center;
  font-style: italic;
  margin-top: 0.5rem;
}

/* Chat messages */
.chat-msg {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  animation: fadeIn 0.3s ease;
}

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

.chat-msg.user {
  justify-content: flex-end;
}

.chat-msg.user .msg-content {
  background: var(--bg-tertiary);
  border-radius: 18px;
  padding: 0.875rem 1rem;
  max-width: 70%;
}

.chat-msg.bot {
  flex-direction: row;
}

.chat-msg.bot .msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.chat-msg.bot .msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-msg.bot .msg-content {
  flex: 1;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-msg.typing .msg-content {
  opacity: 0.6;
  font-style: italic;
}

/* ===== INPUT CONTAINER ===== */
.input-container {
  padding: 1rem 1rem 1.5rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

#chat-form {
  max-width: 48rem;
  margin: 0 auto;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 95, 162, 0.15);
}

#chat-input {
  flex: 1;
  min-height: 24px;
  max-height: 200px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
  padding: 0;
  margin-top: -4px;
  display: flex;
  align-items: center;
}

#chat-input::placeholder {
  color: var(--text-tertiary);
}

.send-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.input-footer {
  max-width: 48rem;
  margin: 0.75rem auto 0;
  text-align: center;
}

.input-footer p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ===== SIDEBAR AD CARD ===== */
.ad-card-sidebar {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.ad-card-sidebar:first-child {
  margin-top: 0.75rem;
}

.ad-card-small {
  padding: 0.5rem;
}

.ad-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: block;
}

.ad-slot {
  min-height: 160px;
  background: var(--bg-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-slot-small {
  min-height: 100px;
}

/* ===== CHAT HISTORY ===== */
.history-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 0.25rem;
}

.history-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.history-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.history-item span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== MOBILE ADS ===== */
.mobile-ads {
  display: none; /* Hidden on desktop */
  padding: 0.5rem 1rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.ad-card-mobile {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.ad-card-mobile .ad-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: block;
  }

.ad-card-mobile .ad-slot {
  min-height: 120px;
  background: var(--bg-primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    display: none; /* Hide sidebar completely on mobile */
  }

  .mobile-ads {
    display: block; /* Show mobile ads */
    padding: 0.5rem 1rem;
  }

  #chat-log {
    padding-bottom: 1rem;
  }

  .empty-state h1 {
    font-size: 1.5rem;
    margin-top: 0.5rem;
  }

  .chat-container {
    padding: 0.25rem 1rem 0.5rem;
  }

  .logo-badge-large {
    width: 48px;
    height: 48px;
    margin-top: 0.5rem;
  }

  .empty-state {
    padding: 0.5rem 1rem;
    gap: 0.75rem;
    min-height: auto;
  }
}

@media (max-width: 480px) {
  .chat-input-wrapper {
    padding: 0.5rem 0.75rem;
  }

  .input-container {
    padding: 0.75rem 0.75rem 1rem;
  }
}
