/* ====== GLOBAL ====== */

body {
  margin: 0;
  background-color: #0f0f10;
  color: #e8e8e8;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

button {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ====== SIDEBAR ====== */

.sidebar {
  width: 260px;
  background-color: #1a1a1c;
  border-right: 1px solid #2a2a2d;
  display: flex;
  flex-direction: column;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
}

.brand-block {
  margin-bottom: 16px;
}

.brand-row-outer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background-color: #000;
  flex-shrink: 0;
}

.brand-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-topline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
  color: #fff;
  gap: 4px;
}

.brand-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #16a34a;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-text {
  color: #16a34a;
  font-size: 12px;
  font-weight: 500;
}

.user-inline {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar-wrap {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background-color: #2a2a2d;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.user-email {
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 150px;
}

.signin-btn {
  margin-top: 8px;
  background-color: #2f2f32;
  color: #fff;
  border: 1px solid #3a3a3f;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 8px;
  cursor: pointer;
}

.signin-btn:hover {
  background-color: #3b3b40;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  background-color: #2e2e32;
  color: #fff;
  border: 1px solid #3a3a3f;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  cursor: pointer;
}

.new-chat-btn:hover {
  background-color: #3a3a41;
}

.new-chat-plus {
  font-size: 14px;
  line-height: 1;
}

.list-block {
  margin-bottom: 20px;
}

.list-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.list-header {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.mini-add-btn {
  background-color: #2e2e32;
  color: #fff;
  border: 1px solid #3a3a3f;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.mini-add-btn:hover {
  background-color: #3a3a41;
}

.list-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-row {
  background-color: #2a2a2d;
  border: 1px solid #3a3a3f;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  line-height: 1.4;
  color: #fff;
  position: relative;
}

.list-row-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.list-row-title {
  font-weight: 500;
  color: #fff;
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row-delete {
  background: none;
  border: 0;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.list-row-delete:hover {
  color: #f87171;
}

.list-row-bottomline {
  color: #6b7280;
  font-size: 11px;
  line-height: 1.3;
  margin-top: 2px;
}

/* ====== MAIN AREA ====== */

.main-pane {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: #0f0f10;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.topbar {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px;
  box-sizing: border-box;
}

.top-menu-btn {
  appearance: none;
  background: none;
  border: 0;
  color: #9ca3af;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.top-menu-btn:hover {
  background-color: rgba(255,255,255,0.07);
  color: #fff;
}

.top-menu-card {
  position: absolute;
  right: 16px;
  top: 44px;
  background-color: #1e1e21;
  border: 1px solid #2f2f32;
  border-radius: 8px;
  min-width: 180px;
  box-shadow: 0 20px 50px rgba(0,0,0,.8);
  display: none;
  flex-direction: column;
  z-index: 1000;
}

.top-menu-card.show {
  display: flex;
}

.top-menu-item {
  appearance: none;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  padding: 10px 12px;
  cursor: pointer;
}
.top-menu-item:hover {
  background-color: #2a2a2f;
}

/* message list */
.messages-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* each bubble group */
.msg-bubble {
  max-width: min(700px, 90%);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.msg-user {
  align-self: flex-end;
  background-color: #2563eb;
  color: #fff;
  border: 1px solid rgba(255,255,255,.07);
}

.msg-ai {
  align-self: flex-start;
  background-color: rgba(32,32,36,.9);
  color: #e8e8e8;
  border: 1px solid rgba(255,255,255,.06);
}

/* row under AI for copy */
.msg-tools-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.msg-copy-btn {
  border: 1px solid #3a3a3f;
  background-color: #2a2a2d;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.msg-copy-btn:hover {
  background-color: #3a3a41;
}

/* typing dots bubble */
.typing-bubble {
  align-self: flex-start;
  background-color: rgba(32,32,36,.9);
  color: #e8e8e8;
  border: 1px solid rgba(255,255,255,.06);
  max-width: min(700px, 90%);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  line-height: 1.4;
}
.dot-seq {
  display: inline-flex;
  gap: 4px;
}
.dot {
  width: 6px;
  height: 6px;
  background-color: #9ca3af;
  border-radius: 50%;
  animation: blink 1s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 20%   { opacity: 0.2; }
  50%       { opacity: 1; }
  80%, 100% { opacity: 0.2; }
}

/* pending image preview under messages */
.pending-image-area {
  padding: 0 16px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pending-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid #3a3a3f;
  background-color: #000;
  overflow: hidden;
  flex-shrink: 0;
}
.pending-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pending-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: rgba(0,0,0,.6);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 4px;
}

/* composer footer */
.composer {
  flex-shrink: 0;
  border-top: 1px solid #2a2a2d;
  background-color: rgba(15,15,16,.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px;
  box-sizing: border-box;
}

.plus-wrapper {
  position: relative;
}

.composer-plus-btn {
  background-color: #2a2a2d;
  color: #fff;
  border: 1px solid #3a3a3f;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.composer-plus-btn:hover {
  background-color: #3a3a41;
}

.plus-menu-card {
  position: absolute;
  bottom: 40px;
  left: 0;
  background-color: #1e1e21;
  border: 1px solid #2f2f32;
  border-radius: 8px;
  min-width: 160px;
  box-shadow: 0 20px 50px rgba(0,0,0,.8);
  display: none;
  flex-direction: column;
  z-index: 1000;
}

.plus-menu-card.show {
  display: flex;
}

.plus-menu-item {
  appearance: none;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  padding: 10px 12px;
  cursor: pointer;
}

.plus-menu-item:hover {
  background-color: #2a2a2f;
  color: #fff;
}

/* label acts like a button */
.file-label {
  cursor: pointer;
}

/* input area */
.composer-input {
  flex: 1;
  background-color: #1e1e21;
  border: 1px solid #2f2f32;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  padding: 10px 12px;
  min-height: 44px;
  outline: none;
  box-sizing: border-box;
}
.composer-input::placeholder {
  color: #6b6b70;
}

/* send arrow */
.send-btn {
  background-color: #2563eb;
  border: 0;
  color: #fff;
  min-width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 20px 60px rgba(37,99,235,.5);
}
.send-btn:hover {
  background-color: #1d4ed8;
}

/* ====== MODALS / OVERLAYS ====== */

.overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.modal-card {
  background-color: #1a1a1c;
  border: 1px solid #2a2a2d;
  box-shadow: 0 40px 120px rgba(0,0,0,.9);
  border-radius: 12px;
  width: 360px;
  max-width: calc(100% - 32px);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.modal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.modal-close-btn {
  background: none;
  border: 0;
  color: #9ca3af;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 0 16px 16px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #d1d5db;
}

.modal-desc {
  font-size: 13px;
  line-height: 1.4;
  color: #d1d5db;
  margin: 0 0 12px 0;
}

/* AUTH MODAL bits */
.google-auth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #fff;
  color: #000;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px 12px;
  cursor: pointer;
  justify-content: center;
}
.google-auth-btn .google-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.auth-divider {
  text-align: center;
  margin: 16px 0 12px;
  font-size: 11px;
  line-height: 1.2;
  color: #6b6b70;
}

.field-label {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 4px;
  display: block;
  font-weight: 500;
}

.field-input {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #2f2f32;
  background-color: #1e1e21;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  padding: 9px 10px;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.field-input::placeholder {
  color: #6b6b70;
}

.primary-solid-btn {
  width: 100%;
  background-color: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 30px 80px rgba(37,99,235,.5);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px 12px;
  cursor: pointer;
  margin-top: 4px;
  text-align: center;
}
.primary-solid-btn:hover {
  background-color: #1d4ed8;
}

.policy-hint {
  margin-top: 12px;
  font-size: 11px;
  line-height: 1.4;
  color: #6b6b70;
}

/* BACKGROUND PICKER */
.bg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.bg-choice {
  width: 100%;
  padding-bottom: 60%;
  border-radius: 8px;
  border: 1px solid #2f2f32;
  background-color: #000;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.3;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bg-choice.bg-none {
  background-color: #2a2a2d;
  color: #fff;
  text-align: center;
  font-weight: 500;
}

.bg-choice:hover {
  outline: 2px solid #2563eb;
  outline-offset: 0;
}

.upload-bg-block {
  text-align: center;
}

.upload-bg-label {
  background-color: #2a2a2d;
  border: 1px solid #3a3a3f;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  padding: 10px 12px;
  cursor: pointer;
  display: inline-block;
}
.upload-bg-label:hover {
  background-color: #3a3a41;
}

/* HELP MODAL TEXT */
#help-body {
  font-size: 13px;
  line-height: 1.5;
  color: #d1d5db;
}
#help-body .help-title {
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}
#help-body .help-line {
  margin-bottom: 6px;
}
#help-body .help-foot {
  font-size: 11px;
  color: #6b6b70;
  margin-top: 12px;
}
