/* Variables */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1d4ed8;
  --bg-color: #f3f4f6;
  --text-color: #111827;
  --border-color: #e5e7eb;
  --highlight-color: #eef2ff;
  --system-msg-color: #f8fafc;
  --user-msg-color: #dbeafe;
  --error-color: #ef4444;
  --success-color: #10b981;
  --transition-speed: 0.3s;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Réinitialisation */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* En-tête */
header {
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  padding: 1.25rem 2rem;
  box-shadow: var(--shadow);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
  font-weight: 700;
  font-size: 1.5rem;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Mise en page principale */
main {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1rem;
  flex: 1;
  padding: 1rem;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}

/* Navigation des tables */
.tables-nav {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.search-container {
  padding: 1rem;
  position: relative;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--system-msg-color);
}

#table-search {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
}

.search-icon {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
}

/* Accordéon */
.accordion {
  overflow-y: auto;
  flex: 1;
}

.accordion-item {
  border-bottom: 1px solid var(--border-color);
}

.accordion-header {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition-speed);
  border-left: 3px solid transparent;
  font-size: 13px;
}

.accordion-header:hover {
  background-color: var(--highlight-color);
  border-left: 3px solid var(--primary-color);
}

.accordion-header.active {
  background-color: var(--highlight-color);
  font-weight: 600;
  border-left: 3px solid var(--primary-color);
  color: var(--primary-color);
}

.accordion-header .accordion-icon {
  transition: transform var(--transition-speed);
}

.accordion-header.active .accordion-icon {
  transform: rotate(90deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-speed);
  background-color: #f9f9f9;
}

.accordion-content.active {
  max-height: 500px;
  overflow-y: auto;
}

.table-title {
  font-size: 13px;
}

.table-columns {
  padding: 8px 12px;
}

.table-column {
  padding: 6px 8px;
  margin-bottom: 4px;
  border-bottom: 1px dashed #e5e7eb;
  background-color: #fafafa;
  border-radius: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.column-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  margin-right: 6px;
}

.column-type {
  font-size: 11px;
  color: #4b5563;
  background-color: #f3f4f6;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 8px;
}

.column-key {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.primary-key, .foreign-key, .unique-key {
  font-size: 10px;
  padding: 2px 4px;
}

.primary-key {
  background-color: #e74c3c;
}

.foreign-key {
  background-color: #3498db;
  cursor: pointer;
}

.foreign-key:hover {
  background-color: #2980b9;
}

.unique-key {
  background-color: #27ae60;
}

.table-relations {
  padding: 8px 12px;
  border-top: 1px solid #e1e1e1;
}

.table-relations h4 {
  font-size: 12px;
  margin-bottom: 4px;
}

.relation {
  padding: 2px 0;
  font-size: 11px;
  display: flex;
  align-items: center;
}

.relation-table {
  font-weight: 600;
}

.relation-table[data-table] {
  cursor: pointer;
  color: var(--primary-color);
}

.relation-table[data-table]:hover {
  text-decoration: underline;
}

.relation-icon {
  margin: 0 5px;
  color: #777;
}

.relation-type {
  margin-left: 5px;
  color: #666;
  font-style: italic;
}

/* Container de chat */
.chat-container {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scroll-behavior: smooth;
}

.message {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  max-width: 80%;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.message h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: #2c3e50;
  font-size: 1.1rem;
}

.message strong {
  color: #2c3e50;
}

.message ol, .message ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.message li {
  margin-bottom: 0.5rem;
}

.message p {
  margin-bottom: 0.8rem;
}

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

.message th, .message td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

.message th {
  background-color: #f2f2f2;
  font-weight: 600;
}

.message tr:nth-child(even) {
  background-color: #f9f9f9;
}

.message a {
  color: var(--primary-color);
  text-decoration: none;
}

.message a:hover {
  text-decoration: underline;
}

.message.system {
  background-color: var(--system-msg-color);
  border-left: 4px solid var(--primary-color);
  align-self: flex-start;
}

.message.user {
  background-color: var(--user-msg-color);
  margin-left: auto;
  color: #444;
  align-self: flex-end;
  border-left: 4px solid var(--secondary-color);
}

.message.system.error {
  background-color: #fef2f2;
  color: var(--error-color);
  border-left: 4px solid var(--error-color);
}

.message.system.loading {
  background-color: #f3f4f6;
  color: #666;
  font-style: italic;
  position: relative;
}

.thinking-animation {
  display: inline-block;
  position: relative;
  min-width: 60px;
  font-weight: 500;
  color: #4b5563;
}

.thinking-animation span {
  display: inline-block;
  opacity: 0;
  animation: thinking 1.4s infinite;
  font-size: 20px;
  line-height: 10px;
  color: var(--primary-color);
}

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

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

@keyframes thinking {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  25% {
    opacity: 1;
    transform: translateY(-3px);
  }
  50% {
    opacity: 1;
    transform: translateY(0);
  }
  75% {
    opacity: 1;
    transform: translateY(3px);
  }
  100% {
    opacity: 0;
    transform: translateY(0);
  }
}

.message pre {
  margin: 0;
  background-color: #1e293b;
  color: #f8fafc;
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-x: auto;
  box-shadow: none;
  border-radius: 0;
}

/* Exemples de prompts */
.prompt-examples {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background-color: #f1f5f9;
}

.prompt-examples h3 {
  font-size: 14px;
  margin-bottom: 0.5rem;
  color: #334155;
  font-weight: 600;
}

.examples {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.example {
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  padding: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

.example:hover {
  background-color: var(--highlight-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.example:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
  border-color: var(--primary-color);
}

/* Input container */
.input-container {
  display: flex;
  border-top: 1px solid var(--border-color);
  padding: 1rem;
  background-color: #fff;
}

#user-input {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px 0 0 8px;
  resize: none;
  font-family: inherit;
  min-height: 55px;
  transition: border-color 0.3s;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

#user-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

#send-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0 8px 8px 0;
  padding: 0 1.5rem;
  transition: background-color 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#send-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-1px);
}

#send-btn:active {
  transform: translateY(1px);
}

#send-btn i {
  font-size: 18px;
}

/* Conteneur de configuration */
.config-container {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

.config-section h3 {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.api-config {
  margin-bottom: 1.5rem;
}

.api-config label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 14px;
}

.api-input-group {
  display: flex;
  margin-bottom: 0.5rem;
}

#api-key-input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px 0 0 4px;
}

#save-api-key {
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

.status {
  font-size: 12px;
  margin-top: 5px;
}

.status.success {
  color: var(--success-color);
}

.status.error {
  color: var(--error-color);
}

.refresh-btn {
  margin-bottom: 10px;
  width: 100%;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-speed), transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.refresh-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-1px);
}

.refresh-btn:active {
  transform: translateY(1px);
}

.refresh-btn i {
  font-size: 14px;
}

/* Pied de page */
footer {
  padding: 1rem;
  text-align: center;
  background-color: white;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: #6b7280;
}

footer a {
  color: var(--primary-color);
  font-weight: 500;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Controls container inside tables-nav */
.controls-container {
  padding: 15px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
}

.controls-container .refresh-btn {
  margin-bottom: 10px;
  width: 100%;
}

.controls-container .api-config {
  margin-top: 10px;
}

.controls-container .api-input-group {
  display: flex;
  margin-bottom: 5px;
}

.controls-container #api-key-input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px 0 0 4px;
  font-size: 12px;
}

.controls-container #save-api-key {
  padding: 8px 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 12px;
}

.controls-container .status {
  font-size: 11px;
  margin-top: 3px;
}

/* Media Queries */
@media (max-width: 1200px) {
  main {
    grid-template-columns: 250px 1fr 200px;
  }
}

@media (max-width: 992px) {
  main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  
  .tables-nav {
    height: 400px;
  }
  
  .chat-container {
    height: auto;
    margin: 1rem 0;
  }
  
  .config-container {
    order: -1;
  }
}

/* Améliorations des blocs de code */
.code-block {
  margin: 16px 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.code-header {
  background-color: #1a2234;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e2e8f0;
  font-size: 12px;
  font-family: "SF Mono", "Roboto Mono", monospace;
}

.code-language {
  font-weight: 500;
  display: flex;
  align-items: center;
}

.code-language::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: #f97316;
  border-radius: 50%;
  margin-right: 6px;
}

/* Style pour les tableaux de données */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.table-header {
  background-color: var(--primary-color);
  color: white;
  font-weight: 500;
  text-align: left;
  padding: 12px;
  font-size: 14px;
}

.table-cell {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background-color: white;
}

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

.data-table tr:nth-child(even) .table-cell {
  background-color: #f8fafc;
}

/* Style pour les listes */
.message ul, .message ol {
  margin: 12px 0;
  padding-left: 24px;
}

.message ul li, .message ol li {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Style pour les titres dans les messages */
.message h2 {
  font-size: 18px;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  color: var(--primary-color);
}

.message h3 {
  font-size: 16px;
  margin: 20px 0 10px;
  color: var(--secondary-color);
}

.message h4 {
  font-size: 15px;
  margin: 16px 0 8px;
  color: #334155;
}

.message p {
  margin: 12px 0;
  line-height: 1.6;
}

/* Classe utilitaire pour les lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Raffinement des boutons */
button {
  cursor: pointer;
  font-family: inherit;
} 