/* Chat Experience Styling */

body.chat-body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
  color: #1f2a44;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  background: #023e8a;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.link-btn:hover {
  opacity: 0.85;
}

.link-btn.secondary {
  background: #ff6b6b;
}

/* Sidebar */
.chat-sidebar {
  width: 320px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-right: 1px solid rgba(2, 62, 138, 0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  z-index: 1000;
}

body.chat-body.sidebar-collapsed .chat-sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  transform: translateX(-100%);
  pointer-events: none;
  border-right: none;
}

body.chat-body.sidebar-collapsed .chat-main {
  padding-left: 16px;
  padding-right: 16px;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid rgba(2, 62, 138, 0.08);
  display: flex;
  gap: 8px;
  align-items: center;
}

.sidebar-toggle {
  background: transparent;
  border: 1px solid rgba(2, 62, 138, 0.3);
  border-radius: 8px;
  font-size: 1.1rem;
  padding: 10px 14px;
  cursor: pointer;
  color: #023e8a;
}

.new-chat-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: #0077b6;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.new-chat-btn:hover {
  transform: translateY(-1px);
}

.sidebar-content {
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tier-card {
  padding: 16px;
  border-radius: 12px;
  background: rgba(98, 182, 255, 0.12);
  border: 1px solid rgba(2, 62, 138, 0.08);
}

.tier-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  color: #023e8a;
}

.tier-card p {
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #1f2a44;
}

.sidebar-section h3 {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  margin-bottom: 8px;
  color: #0077b6;
}

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

.history-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(2, 62, 138, 0.08);
  background: rgba(255, 255, 255, 0.6);
  gap: 12px;
}

.history-title {
  flex: 1;
  text-align: left;
  background: transparent;
  border: none;
  font-weight: 500;
  color: #1f2a44;
  cursor: pointer;
}

.history-actions {
  display: flex;
  gap: 6px;
}

.history-icon {
  border: none;
  background: rgba(2, 62, 138, 0.08);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.history-icon:hover {
  background: rgba(2, 62, 138, 0.18);
}

.history-empty {
  font-size: 0.9rem;
  color: #5c6f87;
}

/* Main */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.chat-header {
  position: sticky;
  top: 0;
  z-index: 200;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(2, 62, 138, 0.08);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.collapse-sidebar-btn {
  background: transparent;
  border: 1px solid rgba(2, 62, 138, 0.3);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #023e8a;
  font-size: 1rem;
}

.collapse-sidebar-btn.active {
  background: #023e8a;
  color: #fff;
}

.chat-header.header-hidden {
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #0077b6;
  cursor: pointer;
}

.chat-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.chat-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #023e8a;
  margin-bottom: 4px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.welcome-message {
  text-align: center;
  margin: auto;
  max-width: 540px;
  padding: 32px;
  border-radius: 20px;
  background: rgba(98, 182, 255, 0.12);
  border: 1px solid rgba(98, 182, 255, 0.2);
}

.message {
  display: flex;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
}

.user-message .message-avatar {
  background: #ff6b6b;
}

.assistant-message .message-avatar {
  background: #023e8a;
}

.message-content {
  flex: 1;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(2, 62, 138, 0.08);
  border-radius: 16px;
  padding: 16px;
  color: #1f2a44;
  line-height: 1.6;
}

.assistant-message .message-content {
  background: #f4f9ff;
}

.attachment-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.attachment-grid img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(2, 62, 138, 0.08);
}

.attachment-grid a {
  padding: 8px;
  background: rgba(2, 62, 138, 0.05);
  border-radius: 8px;
  text-decoration: none;
  color: #023e8a;
}

/* Input area */
.chat-input-container {
  padding: 24px 0 28px;
  border-top: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.compose-hint {
  font-size: 0.85rem;
  color: #4f6487;
  text-align: center;
  width: 100%;
}

.compose-wrapper {
  position: relative;
  border: 1px solid rgba(2, 62, 138, 0.12);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  padding: 12px 18px 10px;
  overflow: hidden;
  box-shadow: 0 25px 55px rgba(2, 62, 138, 0.18);
  width: min(720px, calc(100% - 32px));
}

.selected-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(720px, calc(100% - 32px));
}

.file-chip {
  background: rgba(2, 62, 138, 0.12);
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.file-chip button {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.guest-limit {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.25);
  font-size: 0.95rem;
}

.drop-zone {
  position: absolute;
  inset: 3px;
  border: 1.5px dashed rgba(2, 62, 138, 0.25);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.85rem;
  color: #5c6f87;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.drop-zone.active {
  border-color: #023e8a;
  background: rgba(2, 62, 138, 0.05);
  opacity: 1;
}

.chat-input-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 4px 2px;
  position: relative;
  width: 100%;
}

#messageInput {
  flex: 1;
  min-height: 36px;
  border: none;
  background: transparent;
  font-size: 1rem;
  resize: none;
  outline: none;
  max-height: 120px;
  color: #1f2a44;
  padding: 6px 4px;
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #023e8a;
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.attach-link {
  background: none;
  border: none;
  color: #023e8a;
  font-weight: 600;
  cursor: pointer;
  padding: 0 4px;
}

.attach-link:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  background: #023e8a;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1200;
}

.toast.error {
  background: #ff6b6b;
}

/* Share view */
.share-view .chat-main {
  margin: auto;
  max-width: 900px;
  height: auto;
  box-shadow: 0 15px 40px rgba(2, 62, 138, 0.1);
}

.share-header {
  justify-content: space-between;
}

.share-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-brand img {
  width: 48px;
}

.share-title {
  font-weight: 700;
  color: #023e8a;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Responsive */
@media (max-width: 1024px) {
  .chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
  }

  .chat-sidebar.active {
    transform: translateX(0);
  }

  .menu-toggle {
    display: block;
  }
}

@media (max-width: 768px) {
  body.chat-body {
    flex-direction: column;
    overflow: visible;
  }

  .chat-main {
    min-height: calc(100vh - 40px);
  }

  .chat-messages {
    padding: 20px;
  }

  .chat-header {
    flex-wrap: wrap;
  }
}

