/* Home Page - Chat Interface Styles */

/* Guest Header */
.guest-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.guest-header-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guest-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.guest-actions {
  display: flex;
  gap: 12px;
}

/* Adjust main content when guest header is visible */
body.guest-mode .app-container {
  margin-top: 60px;
  padding-top: 0;
  height: calc(100vh - 60px);
}

body.guest-mode .main-content {
  width: 100%;
  max-width: 100%;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Welcome Screen */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  width: 100%;
  max-width: 900px;
}

.welcome-icon {
  font-size: 80px;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-icon:empty {
  display: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.welcome-screen h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-screen p {
  color: var(--text-secondary);
  font-size: 18px;
}

.welcome-subtitle {
  margin-top: 8px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Message Bubbles */
.message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease-out;
  padding: 12px 0;
}

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.message-avatar:empty {
  display: none;
}

.message.user .message-avatar {
  background: var(--accent-primary);
}

.message.ai .message-avatar {
  background: var(--bg-tertiary);
}

.message-content {
  max-width: 75%;
  background: var(--bg-secondary);
  padding: 7px 14px;
  border-radius: 7px;
  line-height: 1.6;
  position: relative;
}

.message.user .message-content {
  background: var(--accent-primary);
  color: white;
}

.message.ai .message-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.message-text {
  font-size: 14px;
  word-wrap: break-word;
}

.message-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  margin-bottom: 8px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.message.user .message-image {
  border-color: rgba(255, 255, 255, 0.2);
}

/* HTML content styling for AI messages */
.message.ai .message-text {
  line-height: 1.6;
}

/* Modern Info Sections */
.message.ai .message-text .info-section {
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 16px;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.message.ai .message-text .info-section:first-child {
  border-left-color: #3b82f6;
}

.message.ai .message-text .info-section:nth-child(2) {
  border-left-color: #f59e0b;
}

.message.ai .message-text .info-section:nth-child(3) {
  border-left-color: #10b981;
}

.message.ai .message-text .info-section:nth-child(4) {
  border-left-color: #8b5cf6;
}

.message.ai .message-text .info-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.message.ai .message-text .info-icon {
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 8px;
  flex-shrink: 0;
}

.message.ai .message-text .info-section:nth-child(2) .info-icon {
  background: rgba(245, 158, 11, 0.15);
}

.message.ai .message-text .info-section:nth-child(3) .info-icon {
  background: rgba(16, 185, 129, 0.15);
}

.message.ai .message-text .info-section:nth-child(4) .info-icon {
  background: rgba(139, 92, 246, 0.15);
}

.message.ai .message-text .info-title {
  font-size: 15px;
  font-weight: 600;
  color: #e5e7eb;
  letter-spacing: 0.3px;
}

.message.ai .message-text .info-content {
  color: #d1d5db;
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
  padding-left: 38px;
}

.message.ai .message-text .info-list {
  margin: 0;
  padding-left: 38px;
  list-style: none;
  color: #d1d5db;
}

.message.ai .message-text .info-list li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 20px;
  line-height: 1.6;
  font-size: 14px;
}

.message.ai .message-text .info-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #60a5fa;
  font-weight: bold;
  font-size: 16px;
}

.message.ai .message-text .info-section:nth-child(2) .info-list li::before {
  color: #fbbf24;
}

.message.ai .message-text .info-section:nth-child(3) .info-list li::before {
  color: #34d399;
}

.message.ai .message-text .info-section:nth-child(4) .info-list li::before {
  color: #a78bfa;
}

/* Legacy support for older format */
.message.ai .message-text ul:not(.info-list) {
  margin: 8px 0;
  padding-left: 20px;
}

.message.ai .message-text li:not(.info-list li) {
  margin-bottom: 6px;
}

.message.ai .message-text p {
  margin: 8px 0;
}

.message.ai .message-text strong {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.message-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}

.message-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.message.ai .message-time {
  color: var(--text-tertiary);
}

.message-actions {
  display: flex;
  flex-direction: row;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-action-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: 24px;
  height: 24px;
}

.message-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.message.user .message-action-btn {
  color: rgba(255, 255, 255, 0.7);
}

.message.user .message-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  width: fit-content;
  max-width: 75%;
  margin: 12px 0;
}

.typing-indicator.active {
  display: flex;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typing 1.4s ease-in-out infinite;
}

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

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

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Input Area */
.input-area {
  padding: 20px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  position: relative;
}

/* Disclaimer Text */
.disclaimer-text {
  font-size: 9px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 10px;
  line-height: 1.3;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0.7;
}

.chat-form {
  max-width: 900px;
  margin: 0 auto;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 4px 8px;
  transition: var(--transition);
  position: relative;
}

.input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.message-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  padding: 0;
  height: auto;
  line-height: 1.5;
}

.message-input::placeholder {
  color: var(--text-tertiary);
}

.char-counter {
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-tertiary);
  pointer-events: none;
  font-weight: 500;
}

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

.upload-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  flex-shrink: 0;
  padding: 0;
}

.upload-btn svg {
  width: 18px;
  height: 18px;
}

.upload-btn:hover {
  color: var(--accent-primary);
  background: rgba(16, 163, 127, 0.1);
  transform: scale(1.05);
}

.upload-btn:active {
  transform: scale(0.95);
}

.image-preview-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 8px;
  flex-shrink: 0;
}

.image-preview-container img {
  max-width: 60px;
  max-height: 60px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.remove-image-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.remove-image-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: scale(1.1);
}

.send-btn {
  background: var(--accent-primary);
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: var(--transition);
  flex-shrink: 0;
}

.send-btn svg {
  width: 16px;
  height: 16px;
}

.send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

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

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Scrollbar for chat */
.chat-container::-webkit-scrollbar {
  width: 8px;
}

.chat-container::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-menu-toggle:hover {
  background: var(--bg-hover);
  transform: scale(1.05);
}

.mobile-menu-toggle:active {
  transform: scale(0.95);
}

.mobile-menu-toggle.sidebar-open {
  left: calc(80% + 8px);
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.mobile-menu-toggle.sidebar-open .hamburger-icon {
  color: white;
  font-size: 28px;
  font-weight: bold;
}

.hamburger-icon {
  font-size: 24px;
  color: var(--text-primary);
  line-height: 1;
  transition: all 0.3s ease;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 80%;
    height: 100%;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

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

  .sidebar-overlay {
    display: block;
  }

  .main-content {
    width: 100%;
  }

  .message-content {
    max-width: 85%;
  }

  .welcome-screen {
    padding: 20px;
  }

  .welcome-icon {
    font-size: 60px;
  }

  .welcome-screen h1 {
    font-size: 24px;
  }
  .disclaimer-text {
    font-size: 8px;
  }
}
