/* Custom styles to complement Tailwind CSS */
body {
  font-family: 'Inter', sans-serif;
}

nav {
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -256px;
    top: 0;
    width: 256px;
    height: 100%;
    transition: left 0.3s ease;
  }
  #sidebar.active {
    left: 0;
  }
  main {
    margin-left: 0 !important;
    padding: 1rem;
  }
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 600;
  color: #d1d5db;
}

tbody tr {
  border-bottom: 1px solid #374151;
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: #2d3748;
}

input:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

button {
  transition: all 0.3s ease;
}

.active-nav {
  background-color: #4f46e5;
  color: white;
}

/* Chat window / bubble styles */
.chat-window {
  direction: rtl;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Single message wrapper */
.message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  max-width: 95%;
}

/* User message: align to right (side for user) */
.message.user {
  justify-content: flex-end;
  margin-left: 10%;
}

/* Assistant message: align to left */
.message.assistant {
  justify-content: flex-start;
  margin-right: 10%;
}

/* Avatar circles */
.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Bubble */
.bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 14px;
  position: relative;
  box-shadow: 0 6px 18px rgba(2,6,23,0.6);
  word-break: break-word;
  white-space: pre-wrap;
  text-align: right; /* RTL text */
}

/* User bubble style (right) */
.message.user .bubble {
  background: linear-gradient(180deg, rgba(90,72,219,1), rgba(79,70,229,1));
  color: white;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 14px;
}

/* Assistant bubble style (left) */
.message.assistant .bubble {
  background: #111827; /* darker */
  border: 1px solid rgba(255,255,255,0.04);
  color: #d1d5db;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 14px;
}

/* Timestamp small */
.msg-ts {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 6px;
  text-align: right;
}

/* image inside bubble */
.bubble img {
  max-width: 100%;
  border-radius: 8px;
}

/* Slight animation on new message */
.message.new {
  transform: translateY(6px);
  opacity: 0;
  animation: popIn .26s ease forwards;
}
@keyframes popIn {
  to { transform: translateY(0); opacity: 1; }
}

/* make scrollbar thin and match theme */
.chat-window::-webkit-scrollbar {
  width: 10px;
}
.chat-window::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  border-left: 2px solid rgba(255,255,255,0.02);
}

/* mobile tweaks for chat */
@media (max-width: 640px) {
  .bubble { max-width: 85%; }
  .msg-avatar { width: 36px; height: 36px; }
  .chat-window { height: 50vh; }
}

/* Responsive table adjustments */
@media (max-width: 768px) {
  th, td {
    padding: 8px 12px;
    font-size: 0.875rem;
  }
}

/* Assistant tab buttons */
.assistant-tab-btn {
  transition: all 0.2s ease;
}

.assistant-tab-btn:hover {
  background-color: #4b5563 !important;
}
