* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #0f0f0f;
  color: #ececec;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.main-container {
  flex: 1;
  display: flex;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  align-items: center;
  padding: 0 16px;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.logo-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.logo-img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.mobile-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #ececec;
  margin: 0;
  flex: 1;
  text-align: center;
  letter-spacing: -0.5px;
}

.mobile-header .q-red {
  color: #ffffff;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  color: #ececec;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-menu-btn:active,
.mobile-menu-btn:hover {
  background: #2a2a2a;
}

.mobile-header-spacer {
  width: 40px;
}

.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.mobile-overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* Left Column - Past Reports */
.reports-panel {
  width: 320px;
  background: #1a1a1a;
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease;
  z-index: 999;
}

.reports-header {
  padding: 20px;
  border-bottom: 1px solid #2a2a2a;
  background: #1a1a1a;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reports-header h2 {
  display: none !important;
}

.logo-container-drawer {
  display: flex;
  align-items: center;
  flex: 1;
}

.logo-img-drawer {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.new-chat-btn {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ececec;
  font-size: 20px;
  transition: all 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.new-chat-btn:hover {
  background: #3a3a3a;
  border-color: #4a4a4a;
}

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

.close-reports-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #9ca3af;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.close-reports-btn:active,
.close-reports-btn:hover {
  background: #2a2a2a;
  color: #ececec;
}


.reports-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.report-item {
  background: #252525;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.report-item:hover {
  background: #2a2a2a;
  border-color: #3a3a3a;
  transform: translateY(-1px);
}

.report-item.active {
  background: #2a2a2a;
  border-color: #ffffff;
  border-width: 1.5px;
}

.report-query {
  font-weight: 500;
  color: #ececec;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.report-summary {
  color: #9ca3af;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.report-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
}

.report-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

.report-status {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}

.report-status.success {
  background: #1f2937;
  color: #9ca3af;
  border: 1px solid #374151;
}

.report-status.error {
  background: #1f2937;
  color: #ef4444;
  border: 1px solid #374151;
}

.empty-reports {
  text-align: center;
  color: #6b7280;
  padding: 40px 20px;
}

.empty-reports h3 {
  color: #9ca3af;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 500;
}

.empty-reports p {
  font-size: 14px;
  line-height: 1.5;
  color: #6b7280;
}

/* Right Column - Chat Interface */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f0f0f;
  overflow: hidden;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-box {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #0f0f0f;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  animation: slideIn 0.3s ease-out;
  padding: 0 8px;
}

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

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

.message.bot {
  flex-wrap: wrap;
}

.message.bot .message-content {
  flex: 0 1 auto;
  max-width: 75%;
}

.message.bot .message-content .data-table {
  max-width: 100%;
  width: 100%;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: #ffffff;
  color: #0f0f0f;
}

.message.bot .message-avatar {
  background: #2a2a2a;
  color: #ececec;
  border: 1px solid #3a3a3a;
}

.message-content {
  background: #1a1a1a;
  padding: 14px 18px;
  border-radius: 12px;
  max-width: 75%;
  word-wrap: break-word;
  border: 1px solid #2a2a2a;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.message.user .message-content {
  background: #ffffff;
  color: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-bottom-right-radius: 4px;
}

.message.bot .message-content {
  border-bottom-left-radius: 4px;
  color: #ececec;
}

.message.error .message-content {
  background: #1a1a1a;
  border-color: #ef4444;
  color: #ef4444;
}

.message-feedback {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  opacity: 1;
  transition: opacity 0.2s ease;
  padding-top: 12px;
  border-top: 1px solid #2a2a2a;
}

.export-button {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #9ca3af;
  -webkit-tap-highlight-color: transparent;
}

.export-button:hover {
  background: #2a2a2a;
  border-color: #3a3a3a;
  color: #ececec;
}

.export-button:active {
  transform: scale(0.95);
}

.feedback-button {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #9ca3af;
  -webkit-tap-highlight-color: transparent;
}

.feedback-button:hover {
  background: #2a2a2a;
  border-color: #3a3a3a;
  color: #ececec;
}

.feedback-button.positive:hover {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.feedback-button.negative:hover {
  background: #1f2937;
  border-color: #374151;
  color: #ef4444;
}

.feedback-button.selected {
  background: #2a2a2a;
  border-color: #ffffff;
  color: #ececec;
}

.feedback-button.selected.positive {
  background: #1f2937;
  border-color: #9ca3af;
  color: #ececec;
}

.feedback-button.selected.negative {
  background: #1f2937;
  border-color: #ef4444;
  color: #ef4444;
}

.input-container {
  padding: 20px 24px;
  background: #0f0f0f;
  border-top: 1px solid #2a2a2a;
}

.input-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.input-field {
  flex: 1;
  padding: 14px 20px;
  border: 1px solid #2a2a2a;
  border-radius: 24px;
  font-size: 16px;
  outline: none;
  transition: all 0.2s ease;
  background: #1a1a1a;
  color: #ececec;
  -webkit-appearance: none;
  appearance: none;
}

.input-field::placeholder {
  color: #6b7280;
}

.input-field:focus {
  border-color: #ffffff;
  background: #1a1a1a;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Prevent zoom on iOS input focus */
@media screen and (max-width: 768px) {
  .input-field {
    font-size: 16px !important;
  }
}

.send-button {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: #0f0f0f;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
}

.send-button:hover {
  background: #ececec;
  transform: scale(1.05);
}

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

.send-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.send-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  background: #2a2a2a;
  color: #6b7280;
}

.typing-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-style: italic;
  padding: 0 24px;
  font-size: 14px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #6b7280;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.welcome-message {
  text-align: center;
  color: #9ca3af;
  padding: 48px 24px;
  background: transparent;
  border-radius: 12px;
  margin: 24px auto;
  max-width: 600px;
  border: 1px solid #2a2a2a;
}

.logo-container-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.logo-img-welcome {
  height: 80px;
  width: auto;
  object-fit: contain;
}

.welcome-message h3 {
  color: #ececec;
  margin-bottom: 12px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.welcome-message h3 .q-red {
  color: #ffffff;
}

.welcome-message p {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 24px;
  color: #9ca3af;
}

.example-queries {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

.example-query {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #ececec;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 400;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.example-query:hover {
  background: #2a2a2a;
  border-color: #3a3a3a;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Scrollbar styling */
.chat-box::-webkit-scrollbar,
.reports-list::-webkit-scrollbar,
.data-table::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.chat-box::-webkit-scrollbar-track,
.reports-list::-webkit-scrollbar-track,
.data-table::-webkit-scrollbar-track {
  background: #0f0f0f;
  border-radius: 2px;
}

.chat-box::-webkit-scrollbar-thumb,
.reports-list::-webkit-scrollbar-thumb,
.data-table::-webkit-scrollbar-thumb {
  background: #3a3a3a;
  border-radius: 2px;
  border: none;
}

.chat-box::-webkit-scrollbar-thumb:hover,
.reports-list::-webkit-scrollbar-thumb:hover,
.data-table::-webkit-scrollbar-thumb:hover {
  background: #4a4a4a;
}

.chat-box::-webkit-scrollbar-thumb:active,
.reports-list::-webkit-scrollbar-thumb:active,
.data-table::-webkit-scrollbar-thumb:active {
  background: #5a5a5a;
}

/* Firefox scrollbar styling */
.chat-box,
.reports-list,
.data-table {
  scrollbar-width: thin;
  scrollbar-color: #3a3a3a #0f0f0f;
}

/* Responsive design */
@media (max-width: 1024px) {
  .main-container {
    max-width: 100%;
    margin: 0;
  }
  
  .reports-panel {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .main-container {
    flex-direction: column;
    padding-top: 56px;
  }
  
  .reports-panel {
    position: fixed;
    top: 56px;
    left: 0;
    width: 280px;
    height: calc(100vh - 56px);
    transform: translateX(-100%);
    border-right: 1px solid #2a2a2a;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
  }

  .reports-panel.mobile-open {
    transform: translateX(0);
  }

  .reports-header {
    padding: 16px 20px;
  }

  .close-reports-btn {
    display: flex;
  }

  .chat-panel {
    width: 100%;
    height: calc(100vh - 56px);
  }

  .chat-box {
    padding: 16px;
  }

  .message-content {
    max-width: 85%;
    font-size: 14px;
  }

  .input-container {
    padding: 16px;
  }

  .input-wrapper {
    gap: 8px;
  }

  .send-button {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .welcome-message {
    margin: 16px;
    padding: 32px 20px;
  }

  .welcome-message h3 {
    font-size: 24px;
  }

  .example-queries {
    flex-direction: column;
  }

  .example-query {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .mobile-header {
    height: 52px;
    padding: 0 12px;
  }

  .mobile-header h2 {
    font-size: 16px;
  }

  .main-container {
    padding-top: 52px;
  }

  .reports-panel {
    top: 52px;
    width: 85%;
    max-width: 320px;
    height: calc(100vh - 52px);
  }

  .chat-panel {
    height: calc(100vh - 52px);
  }

  .message-content {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 13px;
  }

  .message-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .input-container {
    padding: 12px;
  }

  .input-field {
    padding: 10px 14px;
    font-size: 16px;
  }

  .send-button {
    width: 40px;
    height: 40px;
  }

  .welcome-message {
    margin: 12px;
    padding: 24px 16px;
  }

  .welcome-message h3 {
    font-size: 20px;
  }

  .welcome-message p {
    font-size: 14px;
  }
}

/* Data Table Styles */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: #1a1a1a;
  border-radius: 12px;
  border: 1px solid #2a2a2a;
  font-size: 14px;
  max-height: 500px;
  display: block;
  overflow-y: auto;
  overflow-x: auto;
  max-width: 100%;
}

.data-table thead,
.data-table tbody {
  display: block;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tbody {
  max-height: 450px;
  overflow-y: auto;
}

.data-table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.table-header {
  background: #252525;
  color: #ececec;
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  border-bottom: 1px solid #2a2a2a;
}

.table-cell {
  padding: 12px;
  border-bottom: 1px solid #2a2a2a;
  color: #ececec;
  font-size: 14px;
  vertical-align: top;
}

.data-table tbody tr:hover {
  background: #252525;
  transition: background-color 0.2s ease;
}

.data-table tbody tr:last-child .table-cell {
  border-bottom: none;
}

/* Number formatting in tables */
.table-cell[data-type="number"] {
  text-align: right;
  font-family: 'Courier New', monospace;
  font-weight: 500;
}

/* Responsive table */
@media (max-width: 768px) {
  .data-table {
    font-size: 11px;
    max-height: 400px;
    display: block;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin: 12px 0;
    border-radius: 8px;
    position: relative;
  }

  .data-table thead,
  .data-table tbody {
    display: block;
  }

  .data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #252525;
  }

  .data-table tbody {
    display: block;
    max-height: none;
    overflow: visible;
  }

  .data-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
    min-width: 600px; /* Ensure minimum width for readability */
  }
  
  .table-header {
    display: table-cell;
    padding: 10px 6px;
    font-size: 10px;
    white-space: nowrap;
    font-weight: 600;
  }
  
  .table-cell {
    display: table-cell;
    padding: 10px 6px;
    font-size: 11px;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Make message content handle overflow better on mobile */
  .message-content {
    overflow: visible !important;
    max-width: 100%;
    padding: 12px 14px;
  }

  .message-content .data-table {
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
  }
  
  /* Ensure table container doesn't create double scroll */
  .message.bot .message-content {
    max-width: 100%;
    overflow: visible !important;
  }
  
  /* Prevent chat box from scrolling horizontally */
  .chat-box {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  .data-table {
    font-size: 10px;
    max-height: 350px;
    margin: 10px 0;
    overflow-x: auto;
    overflow-y: auto;
  }

  .table-header {
    padding: 8px 4px;
    font-size: 9px;
  }
  
  .table-cell {
    padding: 8px 4px;
    font-size: 10px;
  }
  
  .data-table tr {
    min-width: 500px; /* Smaller minimum width for very small screens */
  }
  
  .data-table tbody {
    overflow: visible;
  }
  
  .message-content {
    padding: 10px 12px;
    overflow: visible !important;
  }
  
  .chat-box {
    overflow-x: hidden !important;
    overflow-y: auto;
  }
}

/* Summary text styling */
.summary-text {
  margin-bottom: 16px;
  line-height: 1.7;
  color: #ececec;
  font-size: 15px;
}

.summary-text + .data-table {
  margin-top: 0;
}





