/**
 * ChatGPT-Style Home Interface
 * Network AI - Home Section
 * Exact replica of ChatGPT's UI/UX
 */

.chatgpt-home-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: var(--space-8);
  max-width: 768px;
  margin: 0 auto;
}

.chatgpt-hero {
  text-align: center;
  margin-bottom: var(--space-8);
}

/* Remove logo - ChatGPT doesn't have one on home */
.chatgpt-logo {
  display: none;
}

.chatgpt-title {
  font-size: 32px;
  font-weight: 400;
  color: #2d3748;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.chatgpt-subtitle {
  display: none; /* ChatGPT doesn't have subtitle */
}

/* Search Box - Exact ChatGPT Style */
.chatgpt-search-box {
  width: 100%;
  max-width: 680px;
  position: relative;
  margin-bottom: 0;
}

.chatgpt-input {
  width: 100%;
  padding: 14px 52px 14px 48px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 26px;
  background: #f9fafb;
  transition: all 0.15s ease;
  box-shadow: 0 0 0 0 transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.chatgpt-input:hover {
  background: #ffffff;
  border-color: #b4b4b4;
}

.chatgpt-input:focus {
  outline: none;
  background: #ffffff;
  border-color: #10a37f;
  box-shadow: 0 0 0 1px #10a37f;
}

.chatgpt-input::placeholder {
  color: #9ca3af;
}

/* Plus icon (left side) */
.chatgpt-search-box::before {
  content: '+';
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: #6b7280;
  font-weight: 300;
  pointer-events: none;
}

.chatgpt-send-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: #f4f4f4;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chatgpt-send-btn:hover:not(:disabled) {
  background: #ececec;
}

.chatgpt-send-btn:disabled {
  background: #f4f4f4;
  cursor: not-allowed;
  opacity: 0.5;
}

.chatgpt-send-btn svg {
  width: 16px;
  height: 16px;
  color: #6b7280;
}

/* Suggestions - Hidden on empty state like ChatGPT */
.chatgpt-suggestions {
  display: none;
}

/* Conversation View - ChatGPT Style */
.chatgpt-conversation-wrapper {
  position: fixed;
  top: 64px; /* Below header */
  left: 240px; /* After sidebar */
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.chatgpt-conversation {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-6) var(--space-4) 100px var(--space-4); /* Extra bottom padding for input */
}

/* Custom scrollbar to match ChatGPT */
.chatgpt-conversation::-webkit-scrollbar {
  width: 8px;
}

.chatgpt-conversation::-webkit-scrollbar-track {
  background: transparent;
}

.chatgpt-conversation::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.chatgpt-conversation::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Center messages in a max-width container like ChatGPT */
.chat-message {
  margin-bottom: var(--space-6);
  display: flex;
  gap: var(--space-4);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 var(--space-4);
}

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

.chat-message.assistant {
  justify-content: flex-start;
}

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 2px;
  background: #10a37f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 12px;
  font-weight: 600;
}

.chat-message.user .message-avatar {
  background: #5436da;
}

.message-content {
  flex: 1;
  max-width: 100%;
  font-size: 16px;
  line-height: 1.75;
  color: #374151;
}

.message-content p {
  margin: 0 0 1em 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.message-content li {
  margin: 0.25em 0;
}

/* Enhanced formatting for AI responses */
.message-content ul.chat-list {
  list-style: none;
  padding-left: 0;
  margin: 1em 0;
}

.message-content ul.chat-list li {
  padding-left: 1.5em;
  margin: 0.75em 0;
  position: relative;
  line-height: 1.6;
}

.message-content ul.chat-list li::before {
  content: "•";
  position: absolute;
  left: 0.5em;
  color: #5436da;
  font-weight: bold;
  font-size: 1.2em;
}

.message-content strong {
  font-weight: 600;
  color: #1f2937;
}

.message-content h3.chat-heading {
  font-size: 1.1em;
  font-weight: 600;
  color: #1f2937;
  margin: 1.5em 0 0.75em 0;
  padding-bottom: 0.5em;
  border-bottom: 2px solid #e5e7eb;
}

.message-content hr.chat-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.5em 0;
}

.message-content br + br {
  display: block;
  content: "";
  margin-top: 0.5em;
}

.chat-message.user .message-content {
  background: transparent;
  text-align: right;
}

.chat-message.assistant .message-content {
  background: transparent;
}

/* Result Cards (like in screenshot 2 & 3) */
.result-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: var(--space-4);
  margin: var(--space-3) 0;
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.result-card-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.result-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #6b7280;
}

.result-card-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.result-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
}

.result-card-details {
  font-size: 14px;
  line-height: 1.6;
  color: #4b5563;
}

.result-card-details strong {
  color: #1f2937;
  font-weight: 600;
}

/* Input at bottom (conversation mode) - Fixed like ChatGPT */
.chatgpt-input-bottom {
  position: fixed;
  bottom: 0;
  left: 240px; /* After sidebar */
  right: 0;
  background: #ffffff;
  padding: var(--space-4);
  border-top: 1px solid #e5e7eb;
  z-index: 100;
  display: flex;
  justify-content: center;
}

.chatgpt-input-bottom .chatgpt-search-box {
  max-width: 800px;
  width: 100%;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-2) 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

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

/* Responsive */
@media (max-width: 768px) {
  .chatgpt-home-container {
    padding: var(--space-4);
    min-height: calc(100vh - 150px);
  }
  
  .chatgpt-hero {
    margin-bottom: var(--space-6);
  }
  
  .chatgpt-title {
    font-size: 28px;
  }
  
  .chatgpt-conversation-wrapper {
    left: 0;
  }
  
  .chatgpt-input-bottom {
    left: 0;
  }
  
  .chat-message {
    max-width: 100%;
  }
}

/* Collapsed sidebar state */
.ap-sidebar.collapsed ~ .ap-main .chatgpt-conversation-wrapper {
  left: 70px;
}

.ap-sidebar.collapsed ~ .ap-main .chatgpt-input-bottom {
  left: 70px;
}

/* Discovery Result Cards */
.discovery-response {
  width: 100%;
}

.discovery-response .intro {
  font-size: 16px;
  font-weight: 500;
  color: #1f2937;
  margin-bottom: var(--space-4);
}

.result-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.expert-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: var(--space-4);
  transition: all 0.2s;
}

.expert-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.expert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.expert-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.expert-header .badge {
  background: #dbeafe;
  color: #1e40af;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.expert-card .bio {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
  margin: var(--space-2) 0;
}

.expert-card .meta {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-3) 0;
  font-size: 13px;
  color: #6b7280;
}

.expert-card .actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.expert-card .btn-primary,
.expert-card .btn-secondary {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.expert-card .btn-primary {
  background: #3b82f6;
  color: white;
}

.expert-card .btn-primary:hover {
  background: #2563eb;
}

.expert-card .btn-secondary {
  background: white;
  color: #3b82f6;
  border: 1px solid #3b82f6;
}

.expert-card .btn-secondary:hover {
  background: #eff6ff;
}

.discovery-response .cta {
  font-size: 14px;
  color: #6b7280;
  font-style: italic;
  margin-top: var(--space-4);
}
