/* public/style.css */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #1f2937, #020617);
  color: #e5e7eb;
  height: 100vh;
}

.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
}

.brand-title {
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(90deg, #22c55e, #06b6d4, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: 2rem;
  margin-top: 0rem;
}

/* Card (login) */
.card {
  background: #020617;
  border-radius: 1rem;
  padding: 2rem 2.5rem;
  width: 360px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.title {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: #9ca3af;
  font-size: 0.9rem;
}

.field-label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  color: #e5e7eb;
}

input,
textarea {
  margin-top: 0.35rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
  outline: none;
  resize: none;
}

input:focus,
textarea:focus {
  border-color: #22c55e;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  background: #22c55e;
  color: #020617;
  transition: transform 0.05s ease, box-shadow 0.1s ease,
    background 0.1s ease;
  box-shadow: 0 10px 20px rgba(34, 197, 94, 0.35);
}

.primary-btn:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.secondary-btn {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border-radius: 0.75rem;
  border: 1px solid #4b5563;
  background: transparent;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
}

.link-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  padding: 0;
}

/* Chat layout */
.chat-layout {
  width: 100%;
  height: 100%;
  display: flex;
}

.sidebar {
  width: 260px;
  border-right: 1px solid #111827;
  background: #020617;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.logo-dot {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: conic-gradient(
    from 45deg,
    #22c55e,
    #06b6d4,
    #8b5cf6,
    #22c55e
  );
}

.logo-text {
  font-weight: 600;
}

.spacer {
  flex: 1;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1.4rem;
}

/* Updated for admin button on the right */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid #111827;
  padding-bottom: 0.6rem;
  margin-bottom: 0.8rem;
}

.chat-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.chat-subtitle {
  margin: 0.2rem 0 0;
  color: #9ca3af;
  font-size: 0.85rem;
}

/* Make header’s secondary button not full width */
.chat-header .secondary-btn {
  width: auto;
  white-space: nowrap;
}

.followup-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #22c55e;
  margin-bottom: 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed #1f2937;
  font-weight: bold;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-row {
  display: flex;
  gap: 0.6rem;
  max-width: 720px;
}

.message-row.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  background: #111827;
  color: #e5e7eb;
  flex-shrink: 0;
}

.avatar-assistant {
  background: #0f172a;
}

.avatar-user {
  background: #22c55e;
  color: #020617;
}

.bubble {
  padding: 0.6rem 0.8rem;
  border-radius: 0.9rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.bubble-assistant {
  background: #020617;
  border: 1px solid #1f2937;
}

.bubble-user {
  background: #22c55e;
  color: #02120a;
}

.chat-input-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  margin-top: 0.8rem;
}

#chat-input {
  flex: 1;
  max-height: 160px;
}

.disclaimer {
  text-align: center;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.hidden {
  display: none;
}

/* Scrollbar */
.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 999px;
}

.error-text {
  color: #f97373;
  font-size: 0.8rem;
  margin-top: 0.6rem;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  width: 100%;
  padding-right: 3.5rem; /* space for the Show button */
}

.toggle-password {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}

.toggle-password:hover {
  color: #e5e7eb;
}

/* Admin panel + helper styles */
.admin-panel {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  background: #020617;
  border: 1px solid #1f2937;
}

.admin-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.success-text {
  color: #4ade80;
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

.switch-view {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.admin-panel input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Mobile top bar (hidden on desktop, shown in mobile media query) */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.2rem 0.8rem;
  border-bottom: 1px solid #111827;
}

.mobile-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mobile-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .app-container {
    height: auto;
    padding: 1.5rem 1rem;
    justify-content: flex-start;
  }

  .card {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem 1.3rem;
  }

  .brand-title {
    font-size: 2.4rem;
    margin-bottom: 1.2rem;
  }

  /* Hide desktop sidebar, use mobile top bar instead */
  .sidebar {
    display: none;
  }

  .chat-layout {
    flex-direction: column;
  }

  .chat-main {
    padding: 0.9rem 1rem;
  }

  .mobile-topbar {
    display: flex; /* only on mobile */
  }

  .messages {
    max-height: calc(100vh - 260px); /* keep input visible-ish */
  }

  .chat-input-row {
    margin-top: 0.5rem;
  }
}