/* ============================================================
   COMPONENTS — Buttons, forms, tabs, chat list, emoji picker,
   recording bar, file preview, avatars, photo upload, etc.
   ============================================================ */

/* ----- Buttons ----- */
.btn {
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-primary { background-color: var(--primary); color: var(--white); }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-block { width: 100%; display: block; }
.btn-text { background: none; color: var(--text-muted); font-weight: 500; font-size: 13px; }
.btn-text:hover { color: var(--text-dark); }
.btn-outline {
  background: none;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { background: none; border: none; cursor: pointer; color: inherit; }
.btn-icon-soft {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
}

/* Icon circle buttons */
.btn-icon-circle-primary {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, opacity 0.2s, transform 0.15s;
}
.btn-icon-circle-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: scale(0.9);
}
.btn-icon-circle-primary:not(:disabled):hover {
  background: var(--primary-hover);
}
.btn-icon-circle-primary:not(:disabled):active {
  transform: scale(0.92);
}

.btn-icon-circle-secondary {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--text-muted);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.btn-icon-circle-secondary:hover {
  background: var(--gray-300);
  color: var(--text-dark);
}
.btn-icon-circle-secondary:active {
  transform: scale(0.92);
}

/* ----- Forms & Inputs ----- */
.subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.form-group { margin-bottom: 15px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  background: var(--white);
}

.phone-input-group { display: flex; gap: 8px; }
.country-code {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--white);
  font-size: 13px;
}

.country-select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 13px;
  background: var(--white);
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
  appearance: auto;
}

.alert-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 20px;
}
.alert-box.info {
  background-color: var(--notice-bg);
  border: 1px solid var(--notice-border);
  color: var(--amber-700);
}

.checkbox-card {
  background: var(--card-bg);
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}
.custom-checkbox { display: flex; gap: 10px; cursor: pointer; }
.checkbox-text strong { font-size: 12px; display: block; margin-bottom: 2px; }
.checkbox-text p { font-size: 11px; color: var(--text-muted); }

.security-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ----- Photo Circles ----- */
.photo-circles {
  display: flex;
  gap: 28px;
  justify-content: center;
}
.photo-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.photo-circle-inner {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 2px dashed var(--blue-200);
  background-color: var(--blue-light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-400);
  transition: all 0.25s ease;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}
.photo-circle-inner i {
  width: 30px;
  height: 30px;
  transition: transform 0.25s ease;
}
.photo-circle:hover .photo-circle-inner {
  border-style: solid;
  border-color: var(--blue-400);
  background-color: var(--blue-100);
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.18);
}
.photo-circle:active .photo-circle-inner {
  transform: scale(0.96);
}
.photo-circle-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.mt-sm { margin-top: 10px; }

/* ----- Avatar Upload ----- */
.avatar-upload-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin-bottom: 20px;
}

.avatar-placeholder {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px dashed var(--blue-400);
  background-color: var(--blue-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 10px;
  gap: 4px;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.avatar-placeholder:hover {
  border-color: var(--primary);
  background: var(--blue-100);
}

.avatar-placeholder.has-photo {
  border: 3px solid var(--primary);
  border-radius: 50%;
  overflow: hidden;
}

.avatar-preview-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

/* ----- Selfie Camera ----- */
.selfie-camera-container {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--black);
  position: relative;
}

.selfie-camera-container video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px 12px 0 0;
}

.selfie-actions {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--gray-700);
  border-radius: 0 0 12px 12px;
}

.selfie-actions .btn-text {
  color: var(--white);
}

.selfie-actions .btn-text:hover {
  color: var(--red-300);
}

.curved-arrow {
  text-align: center;
  font-size: 24px;
  color: var(--primary);
  margin-top: 8px;
  animation: bounce-arrow 1.5s ease-in-out infinite;
}

@keyframes bounce-arrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ----- Chat List ----- */
.chat-list {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  min-height: 100%;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 12px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
}
.chat-item:hover { background-color: var(--gray-50); }

.avatar-wrap { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: var(--green-500);
  border: 2px solid var(--white);
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  right: 0;
}
.status-dot.pending  { background: var(--amber-500); }
.status-dot.completed { background: var(--gray-500); }

.chat-info { flex: 1; }
.chat-header-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.chat-name { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.chat-time { font-size: 11px; color: var(--text-muted); }
.chat-message-row { display: flex; justify-content: space-between; align-items: center; }
.preview-text {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.unread-count {
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  font-size: 10px;
  padding: 2px 6px;
  font-weight: 600;
}
.read-icon { width: 14px; height: 14px; color: var(--blue-400); }

/* Search bar */
.search-bar {
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 20px;
  gap: 8px;
  width: 100%;
  color: var(--white);
}
.search-bar input {
  background: none;
  border: none;
  color: var(--white);
  outline: none;
  font-size: 13px;
  width: 100%;
}
.search-bar input::placeholder { color: rgba(255,255,255,0.7); }

.header-top { display: flex; width: 100%; justify-content: space-between; align-items: center; }
.header-actions { display: flex; gap: 10px; }

/* Tabs */
.tabs-bar {
  display: flex;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  padding: 10px 12px;
}

.tab {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tab:hover {
  background: var(--bg-color);
  color: var(--primary);
}
.tab.active {
  background: var(--primary);
  color: var(--white);
  font-weight: 600;
  border-color: var(--primary);
}
.tab .badge {
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 10px;
  margin-left: 4px;
}
.tab.active .badge {
  background: var(--white);
  color: var(--primary);
}

/* Loading spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.loading-spinner p { margin-top: 10px; font-size: 13px; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin-slow { animation: spin-slow 3s linear infinite; }

/* Pending approval bubble */
.pending-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  background: var(--primary-light);
  border: 1px dashed var(--primary);
}
.pending-bubble .pending-spinner {
  color: var(--primary);
  opacity: 0.6;
}
.pending-bubble .pending-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  color: var(--text-tertiary, var(--gray-500));
  text-align: center;
}
.empty-state p { font-size: 14px; margin: 0; }

/* ----- Emoji Picker ----- */
.emoji-picker {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  max-height: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emoji-categories {
  display: flex;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.emoji-cat-btn {
  background: none;
  border: none;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.emoji-cat-btn:hover,
.emoji-cat-btn.active {
  background: var(--primary-light);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}

.emoji-btn {
  background: none;
  border: none;
  font-size: 22px;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-btn:hover {
  background: var(--primary-light);
  transform: scale(1.3);
}

/* ----- Recording Bar ----- */
.recording-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  background: var(--red-50);
  border-top: 1px solid var(--red-200);
  gap: 12px;
}

.recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.recording-dot {
  width: 12px;
  height: 12px;
  background: var(--red-500);
  border-radius: 50%;
  animation: pulse-dot 1s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

.recording-timer {
  font-size: 15px;
  font-weight: 600;
  color: var(--red-500);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
}

.recording-cancel,
.recording-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.recording-cancel {
  background: var(--gray-200);
  color: var(--text-dark);
}

.recording-send {
  background: var(--primary);
  color: var(--white);
}

/* Transcription preview */
.transcription-preview {
  flex: 1;
  min-width: 0;
  text-align: center;
}
.transcription-text {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
}
.transcription-text:empty::after {
  content: '🎤 Parlez maintenant...';
  color: var(--gray-400);
}

/* ----- File Preview Bar ----- */
.file-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
}

.file-preview-list {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

.file-preview-item img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  object-position: center;
}

.file-preview-item .file-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.file-preview-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 14px;
  line-height: 1;
}

.file-preview-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
