/* autoAAP Styles */

:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --sidebar-width: 280px;
  --header-height: 60px;
  --chat-bar-height: 80px;
}

/* Layout */
body.has-sidebar {
  padding-left: var(--sidebar-width);
}

@media (max-width: 991.98px) {
  body.has-sidebar {
    padding-left: 0;
    padding-top: var(--header-height);
  }
}

/* Sidebar */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #1e1e2e;
  color: #cdd6f4;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    display: none;
  }
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 600;
}

.sidebar-brand i {
  color: var(--primary-color);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: #a6adc8;
  border-radius: 0;
  transition: all 0.15s;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: #fff;
  border-left: 3px solid var(--primary-color);
}

.sidebar-nav .nav-link-primary {
  background: var(--primary-color);
  color: #fff;
  margin: 0.5rem 1rem;
  border-radius: 0.5rem;
  justify-content: center;
}

.sidebar-nav .nav-link-primary:hover {
  background: var(--primary-hover);
}

.sidebar-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-title {
  padding: 0 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c7086;
}

.nav-link-conversation {
  padding: 0.5rem 1rem;
}

.nav-link-conversation .conv-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Mobile header */
.app-header-mobile {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: #1e1e2e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 1020;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

/* Main content */
.app-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.section-content {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.section-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

@media (max-width: 991.98px) {
  .section-header {
    top: var(--header-height);
  }
}

.conv-header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.conv-back-link {
  color: #6b7280;
  text-decoration: none;
}

.conv-back-link:hover {
  color: var(--primary-color);
}

.conv-header-icon {
  opacity: 0.7;
}

.conv-title-wrapper {
  flex: 1;
  min-width: 0;
}

.conv-meta-row {
  font-size: 0.875rem;
}

.section-body {
  flex: 1;
  padding: 1.5rem 0;
}

/* Context bar (chat page) */
.context-bar {
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 0;
}

/* Chat */
.chat-body {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.chat-output {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  padding-bottom: calc(var(--chat-bar-height) + 2rem);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state-hints {
  max-width: 400px;
  margin: 0 auto;
  text-align: left;
}

/* Chat messages */
.chat-message {
  margin-bottom: 1.5rem;
  max-width: 85%;
}

.chat-message.user {
  margin-left: auto;
}

.chat-message.assistant {
  margin-right: auto;
}

.message-content {
  padding: 1rem;
  border-radius: 1rem;
  background: #f3f4f6;
}

.chat-message.user .message-content {
  background: var(--primary-color);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.chat-message.assistant .message-content {
  border-bottom-left-radius: 0.25rem;
}

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

/* Chat input bar */
.chat-bar-container {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 1rem 0;
  z-index: 100;
}

@media (max-width: 991.98px) {
  .chat-bar-container {
    left: 0;
  }
}

.chat-bar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 1.5rem;
  padding: 0.5rem 0.75rem;
}

.chat-input-wrapper {
  flex: 1;
}

.chat-input {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  padding: 0.5rem;
  font-size: 1rem;
  line-height: 1.5;
  max-height: 150px;
  overflow-y: auto;
}

.chat-input:focus {
  outline: none;
}

.chat-send-btn,
.chat-cancel-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.chat-send-btn {
  background: var(--primary-color);
  color: #fff;
}

.chat-send-btn:hover {
  background: var(--primary-hover);
}

.chat-send-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.chat-cancel-btn {
  background: #ef4444;
  color: #fff;
}

.chat-cancel-btn:hover {
  background: #dc2626;
}

/* Cards */
.compagnie-card {
  transition: transform 0.15s, box-shadow 0.15s;
}

.compagnie-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* AAP fields */
.aap-field-item {
  background: #f8fafc;
}

/* Markdown content */
.markdown-content {
  line-height: 1.7;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child {
  margin-top: 0;
}

.markdown-content table {
  width: 100%;
  margin: 1rem 0;
  border-collapse: collapse;
}

.markdown-content th,
.markdown-content td {
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  text-align: left;
}

.markdown-content th {
  background: #f8fafc;
  font-weight: 600;
}

/* Loading */
.loading-indicator {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

/* Copyable response blocks */
.response-block {
  position: relative;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid var(--primary-color);
  border-radius: 0.5rem;
  padding: 1rem;
  padding-right: 3rem;
  margin: 0.75rem 0;
  white-space: pre-wrap;
  font-family: inherit;
}

.response-content {
  line-height: 1.6;
}

.copy-btn-inline {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 0.375rem;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 1rem;
}

.copy-btn-inline:hover {
  background: var(--primary-color);
  color: #fff;
}

.copy-btn-inline.copied {
  background: #10b981;
  color: #fff;
}

.copy-btn-inline.copied:hover {
  background: #059669;
}

/* AskUserQuestion UI */
.ask-user-questions {
  margin-top: 1rem;
}

.ask-question-block {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.ask-question-header {
  margin-bottom: 0.5rem;
}

.ask-question-text {
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.ask-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ask-option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}

.ask-option-btn:hover {
  border-color: var(--primary-color);
  background: #f0f0ff;
}

.ask-option-btn.selected {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.ask-option-btn strong {
  font-size: 0.95rem;
  color: #1f2937;
}

.ask-option-btn small {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* Utilities */
.font-monospace {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875rem;
}
