/* Admin Assistants Tab Enhancements */
.cgpt-assist-list {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.cgpt-assist-card {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 18px 18px 12px 18px;
  margin-bottom: 0;
  min-width: 320px;
  max-width: 420px;
  flex: 1 1 340px;
  position: relative;
  transition: box-shadow 0.2s, border 0.2s;
}
.cgpt-assist-card:hover {
  box-shadow: 0 4px 18px rgba(13,110,253,0.10);
  border-color: #0d6efd;
}
.cgpt-assist-card label {
  font-size: 13px;
  color: #222;
  margin-right: 10px;
  margin-bottom: 6px;
  display: inline-block;
}
.cgpt-assist-card input[type="text"],
.cgpt-assist-card input[type="number"],
.cgpt-assist-card textarea {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  margin-right: 8px;
  margin-bottom: 4px;
  background: #f9fafb;
  width: auto;
  max-width: 100%;
}
.cgpt-assist-card textarea {
  min-height: 38px;
  resize: vertical;
}
.cgpt-assist-card .button {
  font-size: 13px;
  border-radius: 6px;
  padding: 4px 14px;
  margin-top: 6px;
  margin-right: 4px;
  background: #f3f4f6;
  color: #dc2626;
  border: 1px solid #dc2626;
  transition: background 0.2s, color 0.2s;
}
.cgpt-assist-card .button:hover {
  background: #fee2e2;
}
.cgpt-assist-card .as-short {
  background: #f3f4f6;
  color: #0d6efd;
  border: none;
  font-weight: 600;
}
.cgpt-assist-card .as-short:focus {
  outline: 1.5px solid #0d6efd;
}
#cgpt-add-assistant {
  margin-top: 10px;
  font-size: 14px;
  border-radius: 8px;
  background: #0d6efd;
  color: #fff;
  border: none;
  padding: 8px 22px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(13,110,253,0.08);
  transition: background 0.2s;
}
#cgpt-add-assistant:hover {
  background: #0b5ed7;
}
@media (max-width: 700px) {
  .cgpt-assist-list { flex-direction: column; gap: 10px; }
  .cgpt-assist-card { min-width: 0; max-width: 100%; }
}
/* Admin Data Table Enhancements */
.cgpt-admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  overflow: hidden;
  margin-bottom: 18px;
}
.cgpt-admin-table th, .cgpt-admin-table td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.cgpt-admin-table th {
  background: #f3f4f6;
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
  color: #222;
  box-shadow: 0 2px 0 #e5e7eb;
}
.cgpt-admin-table tr:nth-child(even) {
  background: #f9fafb;
}
.cgpt-admin-table tr:hover {
  background: #e6f4ff;
  transition: background 0.2s;
}
.cgpt-admin-table .cgpt-query-row.selected {
  background: #dbeafe !important;
}
.cgpt-admin-table input[type="checkbox"] {
  transform: scale(1.2);
  accent-color: var(--ffj-accent, #0d6efd);
}
.cgpt-admin-table .cgpt-edit-query, .cgpt-admin-table .cgpt-save-query, .cgpt-admin-table .cgpt-cancel-query {
  font-size: 13px;
  border-radius: 6px;
  padding: 4px 12px;
  margin-right: 4px;
  transition: background 0.2s, color 0.2s;
}
.cgpt-admin-table .cgpt-edit-query {
  background: #f3f4f6;
  color: #0d6efd;
  border: 1px solid #0d6efd;
}
.cgpt-admin-table .cgpt-edit-query:hover {
  background: #e6f4ff;
}
.cgpt-admin-table .cgpt-save-query {
  background: #0d6efd;
  color: #fff;
  border: none;
}
.cgpt-admin-table .cgpt-save-query:hover {
  background: #0b5ed7;
}
.cgpt-admin-table .cgpt-cancel-query {
  background: #f3f4f6;
  color: #dc2626;
  border: 1px solid #dc2626;
}
.cgpt-admin-table .cgpt-cancel-query:hover {
  background: #fee2e2;
}
.cgpt-admin-table .cgpt-query-details {
  background: #f8fafc !important;
}
.cgpt-admin-table textarea {
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  padding: 6px 8px;
  width: 100%;
  box-sizing: border-box;
}
.cgpt-admin-table .cgpt-save-status {
  font-size: 12px;
  color: #555;
  margin-left: 8px;
}
/*
 * ChatGPT Messenger FFJ – Frontend Stylesheet
 * Chat container, message bubbles, quota pills, responsive layout.
 * Version: 8.0
 * Author: Pierre RICHE and GPT 5
 * Date: 2025-08-09
 */
.cgpt-ffj-chatbox{
  --ffj-bg:#fff; --ffj-border:#e5e7eb; --ffj-muted:#6b7280; --ffj-shadow:0 2px 8px rgba(0,0,0,.06);
  --ffj-accent:#0d6efd; --ffj-accent-hover:#0b5ed7; --ffj-user:#e6f4ff; --ffj-assistant:#f3f4f6;
  --ffj-warn:#d97706; --ffj-danger:#dc2626;
  width:100%; background:var(--ffj-bg); border:1px solid var(--ffj-border);
  border-radius:10px; box-shadow:var(--ffj-shadow); display:flex; flex-direction:column; overflow:hidden;
}

.cgpt-ffj-messages{ flex:1; min-height:220px; max-height:60vh; overflow:auto; padding:12px; background:#fafafa }
.cgpt-ffj-messages::-webkit-scrollbar{ width:8px }
.cgpt-ffj-messages::-webkit-scrollbar-thumb{ background:rgba(0,0,0,.15); border-radius:4px }

.cgpt-ffj-message{ padding:10px 12px; border-radius:8px; margin:6px 0; line-height:1.5; font-size:14px; box-sizing:border-box; max-width:90%; width:fit-content; width:-moz-fit-content; word-break:break-word; overflow-wrap:anywhere; }
/* User bubble: right aligned, shrink-to-content until max-width (90% container) */
.cgpt-ffj-message.user{
  background:var(--ffj-user); color:#111; margin-left:auto; text-align:right; width:fit-content; width:-moz-fit-content;
}
/* Assistant bubble: left aligned shrink-to-content */
.cgpt-ffj-message.assistant{ background:var(--ffj-assistant); color:#222; margin-right:auto; text-align:left; width:fit-content; width:-moz-fit-content; }
/* Ensure very short one-word messages aren't too tiny */
.cgpt-ffj-message.user span, .cgpt-ffj-message.assistant span{ display:inline }
/* Safari fallback (fit-content issues): allow flex growth when streaming */
.cgpt-ffj-streaming .cgpt-ffj-message{ width:auto; }

.cgpt-ffj-meta {
  font-size: 12px;
  color: #888;
  margin-bottom: 2px;
}
.cgpt-ffj-meta strong {
  color: #222;
}
.cgpt-ffj-bubbletext {
  font-size: 14px;
  color: inherit;
  white-space: pre-line;
}

/* Zone sous le prompt pour quotas */
.cgpt-ffj-remaining{ color:#111827; font-size:12px; padding:6px 12px; display:block }
.cgpt-ffj-remaining .label{ color:var(--ffj-muted); margin-right:6px }
.cgpt-ffj-remaining .pill{
  display:inline-block; border:1px solid #e5e7eb; border-radius:999px; padding:2px 8px; margin-right:6px
}
.cgpt-ffj-remaining .pill .title{ font-weight:600; margin-right:4px }
.cgpt-ffj-remaining .pill.warn{ border-color:var(--ffj-warn); color:var(--ffj-warn) }
.cgpt-ffj-remaining .pill.danger{ border-color:var(--ffj-danger); color:var(--ffj-danger) }

.cgpt-ffj-inputrow{ display:flex; gap:8px; align-items:flex-end; padding:10px; border-top:1px solid var(--ffj-border); background:#fff }
.cgpt-ffj-input{ flex:1; min-height:44px; max-height:160px; padding:10px 12px; border:1px solid var(--ffj-border); border-radius:8px; resize:vertical; font-size:14px }
.cgpt-ffj-send{
  white-space:nowrap; height:40px; padding:0 14px; border-radius:8px; font-weight:600; cursor:pointer;
  transition:transform .05s ease, background .2s ease, box-shadow .2s ease;
  background:var(--ffj-accent, #0d6efd);
  color:#fff; border:none; box-shadow:0 2px 4px rgba(0,0,0,0.15);
}
.cgpt-ffj-send:hover{ background:var(--ffj-accent-hover,#0b5ed7); }
.cgpt-ffj-send:active{ transform:translateY(1px) }
.cgpt-ffj-send[disabled], .cgpt-ffj-input[disabled]{ opacity:.6; cursor:not-allowed }

/* Feedback thumbs */
.cgpt-ffj-feedback{ margin-top:6px; display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.cgpt-ffj-feedback-prompt{ font-size:12px; color:#555; margin-right:4px; }
.cgpt-ffj-thumb{ background:#f1f5f9; border:1px solid #d1d5db; padding:4px 10px; border-radius:6px; cursor:pointer; font-size:14px; line-height:1; }
.cgpt-ffj-thumb.cgpt-ffj-up.active{ background:#16a34a; border-color:#15803d; color:#fff; }
.cgpt-ffj-thumb.cgpt-ffj-down.active{ background:#dc2626; border-color:#b91c1c; color:#fff; }
.cgpt-ffj-thumb:hover{ background:#e2e8f0; }

/* Survey (thumbs-down) modal */
#cgpt-ffj-survey-overlay.cgpt-ffj-survey-overlay{position:fixed;inset:0;z-index:99999;background:rgba(0,0,0,0.5);display:none;align-items:center;justify-content:center;padding:16px;}
#cgpt-ffj-survey-overlay.cgpt-ffj-open{display:flex;}
.cgpt-ffj-survey-dialog{background:#fff;color:#222;border-radius:8px;max-width:480px;width:100%;box-shadow:0 4px 18px rgba(0,0,0,0.25);font-size:14px;line-height:1.4;}
.cgpt-ffj-survey-header{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid #ddd;font-weight:600;}
.cgpt-ffj-survey-header button{background:none;border:none;font-size:18px;cursor:pointer;line-height:1;color:#666;}
.cgpt-ffj-survey-header button:hover{color:#000;}
.cgpt-ffj-survey-form{padding:14px;}
.cgpt-ffj-survey-reasons label{cursor:pointer;}
.cgpt-ffj-survey-reasons input{margin-right:6px;}
.cgpt-ffj-survey-notes textarea{width:100%;resize:vertical;margin-top:10px;font-size:13px;}
.cgpt-ffj-survey-actions{margin-top:14px;display:flex;gap:8px;}
.cgpt-ffj-survey-actions .button{cursor:pointer;}
.cgpt-ffj-survey-reasons.cgpt-ffj-missing{animation:cgptPulse 0.4s linear 0s 3;outline:2px solid #dc2626;outline-offset:2px;border-radius:4px;padding:4px;background:#fff5f5;}
@keyframes cgptPulse{0%,100%{outline-color:#dc2626;}50%{outline-color:#fca5a5;}}

/* Blinking cursor for thinking message */
.cgpt-ffj-thinking-inline{display:inline-block;position:relative;}
.cgpt-ffj-thinking-inline .cgpt-ffj-cursor{display:inline-block;width:7px;margin-left:4px;border-right:2px solid #555;animation:cgptBlink 0.9s steps(2,start) infinite;height:1em;vertical-align:baseline;}
@keyframes cgptBlink{0%,49%{border-color:#555;}50%,100%{border-color:transparent;}}
/* Streaming reveal fade-in for each chunk (optional subtle) */
.cgpt-ffj-streaming .cgpt-ffj-bubbletext{min-height:1em;}
@media (max-width:640px){
  .cgpt-ffj-chatbox{ border-radius:8px }
  .cgpt-ffj-message{ font-size:13px }
}
