/* ============================================================
   AMATOTECH — app.css  (Global Base)
============================================================ */

html, body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #f0f4f8;
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
}

/* ── Focus ring ── */
.btn:focus, .btn:active:focus,
.form-control:focus, .form-check-input:focus,
.form-select:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  outline: none;
}

/* ── Links ── */
a { color: #2563eb; }
a:hover { color: #1d4ed8; }

/* ── Utility ── */
.fs-7 { font-size: 0.75rem !important; }
.fs-8 { font-size: 0.68rem !important; }

/* ── Validation ── */
.valid.modified:not([type=checkbox]) { outline: 1.5px solid #059669; border-radius: 6px; }
.invalid { outline: 1.5px solid #dc2626; border-radius: 6px; }
.validation-message { color: #dc2626; font-size: 0.8rem; margin-top: 0.25rem; }

/* ── Blazor error boundary ── */
.blazor-error-boundary {
  background: #fef2f2;
  border-top: 2px solid #dc2626;
  color: #991b1b;
  padding: 0.85rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.blazor-error-boundary::after {
  content: "Une erreur inattendue est survenue.";
}

/* ── Checkbox ── */
.darker-border-checkbox.form-check-input { border-color: #94a3b8; }

/* ── Content padding ── */
.content { padding-top: 1rem; }

h1:focus { outline: none; }

/* ── Chat Room ── */
.chat-whatsapp {
  display: flex;
  height: calc(100vh - 120px);
  max-width: 1200px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.chat-sidebar {
  width: 320px;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
}

.chat-sidebar-header {
  padding: 1.25rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.chat-sidebar-header h5 {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
}

.chat-user-list {
  flex: 1;
  overflow-y: auto;
}

.chat-user-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.15s;
}

.chat-user-item:hover {
  background: #e2e8f0;
}

.chat-user-item.active {
  background: #dbeafe;
  border-left: 3px solid #2563eb;
}

.chat-user-item.ai-assistant {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-left: 3px solid #0ea5e9;
}

.chat-user-item.ai-assistant:hover {
  background: #e0f2fe;
}

.chat-user-item.ai-assistant .chat-user-avatar {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 2px 4px rgba(14, 165, 233, 0.25);
}

.chat-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.chat-user-info {
  min-width: 0;
  flex: 1;
}

.chat-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-user-email {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.chat-main-header {
  padding: 1rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  color: #1e293b;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-placeholder {
  color: #94a3b8;
  font-weight: 400;
  font-size: 0.95rem;
}

.chat-contact-name {
  color: #1e293b;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-message {
  display: flex;
  max-width: 75%;
}

.chat-message-me {
  align-self: flex-end;
  justify-content: flex-end;
}

.chat-message-other {
  align-self: flex-start;
  justify-content: flex-start;
}

.chat-bubble {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  word-break: break-word;
}

.chat-message-me .chat-bubble {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message-other .chat-bubble {
  background: #fff;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

.chat-message-ai .chat-bubble {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  color: #0c4a6e;
  border: 1px solid #bae6fd;
  border-bottom-left-radius: 4px;
}

.chat-ai-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #0ea5e9;
  margin-left: 0.35rem;
  background: #e0f2fe;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.chat-sender {
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  opacity: 0.75;
}

.chat-text {
  font-size: 0.95rem;
  line-height: 1.5;
}

.chat-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.chat-time {
  font-size: 0.65rem;
  opacity: 0.7;
}

.chat-status {
  font-size: 0.65rem;
  font-weight: 600;
}

.chat-status-sent {
  opacity: 0.7;
}

.chat-status-read {
  color: #4ade80;
}

.chat-delete-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.15rem;
  line-height: 1;
  transition: color 0.15s;
}

.chat-delete-btn:hover {
  color: #ef4444;
}

.chat-message-other .chat-status-read {
  color: #86efac;
}

.chat-system-message {
  align-self: center;
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
  margin: 0.5rem 0;
  background: #e2e8f0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  align-items: center;
}

.chat-input-area input {
  flex: 1;
  border-radius: 24px;
  border: 1px solid #e2e8f0;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-input-area input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.chat-action-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 1.15rem;
}

.chat-action-btn:hover {
  background: #f1f5f9;
  color: #2563eb;
  border-color: #2563eb;
}

.chat-send-btn {
  width: auto;
  border-radius: 24px;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
}

.chat-recipient-picker {
  position: absolute;
  bottom: 70px;
  right: 20px;
  width: 320px;
  max-height: 380px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.chat-recipient-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: #1e293b;
}

.chat-close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
}

.chat-recipient-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.chat-recipient-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s;
}

.chat-recipient-item:hover {
  background: #f1f5f9;
}

.chat-recipient-item.selected {
  background: #dbeafe;
}

.chat-recipient-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

.chat-selected-recipients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  min-height: 44px;
  align-items: center;
}

.chat-recipient-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #dbeafe;
  color: #1e293b;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.chat-recipient-remove {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.chat-emoji-picker,
.chat-sticker-picker {
  position: absolute;
  bottom: 70px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 0.75rem;
  z-index: 50;
}

.chat-emoji-picker {
  right: 80px;
  width: 320px;
  max-height: 280px;
}

.chat-sticker-picker {
  right: 140px;
  width: 320px;
  max-height: 280px;
}

.chat-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
  max-height: 240px;
  overflow-y: auto;
}

.chat-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  max-height: 240px;
  overflow-y: auto;
}

.chat-emoji-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 8px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-emoji-btn:hover {
  background: #e2e8f0;
}

.chat-sticker-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 8px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-sticker-btn:hover {
  background: #e2e8f0;
}

.chat-sticker-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  pointer-events: none;
}

.chat-media-image {
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
  display: block;
  margin-top: 0.35rem;
}

.chat-media-video {
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
  display: block;
  margin-top: 0.35rem;
  background: #000;
}

.chat-media-audio {
  width: 100%;
  margin-top: 0.35rem;
}

.chat-media-document {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
  padding: 0.6rem 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}

.chat-media-document i {
  font-size: 1.6rem;
}

.chat-media-document span {
  font-size: 0.85rem;
  font-weight: 600;
}

.chat-media-size {
  font-size: 0.75rem;
  opacity: 0.8;
}

.chat-loading {
  padding: 1rem;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
}
