/* ==========================================
   CARD ACTIONS - Boutons d'action sur les cartes email
   ========================================== */

/* La carte doit être en flex row pour placer les actions à droite */
.email-item {
  flex-direction: row !important;
  position: relative;
}

/* Le contenu prend tout l'espace disponible */
.email-item > .email-content {
  flex: 1;
  min-width: 0;
}

/* La checkbox reste en row aussi */
.email-item > .email-checkbox-wrapper {
  flex-shrink: 0;
}

/* Barre d'actions à droite de chaque carte */
.card-actions-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 6px 8px;
  border-left: 1px solid var(--border-light, #e5e7eb);
  background: var(--bg-secondary, #f9fafb);
  border-radius: 0 8px 8px 0;
  opacity: 0;
  width: 0;
  overflow: hidden;
  transition: opacity 0.2s, width 0.2s, padding 0.2s;
  padding-left: 0;
  padding-right: 0;
}

.email-item:hover .card-actions-side {
  opacity: 1;
  width: 40px;
  padding: 6px 4px;
}

/* Toujours visible si un bouton est actif */
.card-actions-side:has(.card-action-btn.active) {
  opacity: 1;
  width: 40px;
  padding: 6px 4px;
}

/* Boutons d'action */
.card-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 5px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.card-action-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Important - actif */
.card-action-btn.important.active {
  background: #fef3c7;
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.card-action-btn.important:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

/* A revoir - actif */
.card-action-btn.arevoir.active {
  background: #dbeafe;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.card-action-btn.arevoir:hover {
  background: #dbeafe;
  border-color: #2563eb;
}

/* Classify - actif */
.card-action-btn.classify.active {
  background: #d1fae5;
  border-color: #10b981;
  opacity: 0.6;
  cursor: default;
}

.card-action-btn.classify:not(.active):hover {
  background: #d1fae5;
  border-color: #10b981;
}

/* Reply */
.card-action-btn.reply:hover {
  background: #ede9fe;
  border-color: #8b5cf6;
}

/* Gmail */
.card-action-btn.gmail:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

/* ==========================================
   SPECIAL VIEWS (accueil)
   ========================================== */

.special-views-section {
  margin-bottom: 16px;
  padding: 0 4px;
}

.special-views-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.special-view-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 2px solid var(--border-light, #e5e7eb);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.special-view-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.special-view-btn.important-btn:hover {
  background: #fef3c7;
  border-color: #fbbf24;
}

.special-view-btn.arevoir-btn:hover {
  background: #dbeafe;
  border-color: #3b82f6;
}

.special-view-icon {
  font-size: 20px;
}

.special-view-label {
  color: #374151;
}

/* Barre de recherche globale */
.global-search-bar {
  display: flex;
  gap: 8px;
}

.global-search-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border-light, #e5e7eb);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.global-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.global-search-btn {
  padding: 10px 20px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.global-search-btn:hover {
  background: #2563eb;
}

/* ==========================================
   FAVORITE SENDERS (accueil)
   ========================================== */

.favorite-senders-section {
  margin-bottom: 16px;
  padding: 0 4px;
}

/* Toggle étoile favori dans le détail email */
.favorite-sender-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  padding: 0;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.5;
  filter: grayscale(1);
}

.favorite-sender-toggle-btn:hover {
  opacity: 1;
  filter: none;
  transform: scale(1.15);
  border-color: #fbbf24;
}

.favorite-sender-toggle-btn.active {
  opacity: 1;
  filter: none;
  background: #fef3c7;
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.favorite-senders-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 10px 0;
  padding: 0;
}

.special-view-btn.sender-btn {
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  position: relative;
  overflow: visible;
}

.special-view-btn.sender-btn:hover {
  background: #f0f9ff;
  border-color: #3b82f6;
}

.sender-btn-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

/* Boutons ✕ et ✏️ en hover */
.sender-remove-btn,
.sender-edit-btn {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  z-index: 2;
  transition: all 0.15s;
}

.sender-remove-btn {
  top: -4px;
  left: -4px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.sender-remove-btn:hover {
  background: #dc2626;
  transform: scale(1.2);
}

.sender-edit-btn {
  bottom: -4px;
  left: -4px;
  background: #6b7280;
  color: white;
  font-size: 9px;
}

.sender-edit-btn:hover {
  background: #3b82f6;
  transform: scale(1.2);
}

.special-view-btn.sender-btn:hover .sender-remove-btn,
.special-view-btn.sender-btn:hover .sender-edit-btn {
  display: flex;
}

/* Modal renommer */
.rename-favorite-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.rename-favorite-modal {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  min-width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.rename-favorite-email {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 10px 0;
  word-break: break-all;
}

.rename-favorite-modal h4 {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: #1f2937;
}

.rename-favorite-modal .add-favorite-input {
  margin-bottom: 14px;
}

.rename-favorite-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rename-favorite-cancel,
.rename-favorite-confirm {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.rename-favorite-cancel {
  background: white;
  color: #6b7280;
}

.rename-favorite-cancel:hover {
  background: #f3f4f6;
}

.rename-favorite-confirm {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.rename-favorite-confirm:hover {
  background: #2563eb;
}

/* Pastille "nouveaux" — même style que .date-button .new-emails-badge */
.sender-new-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%);
  color: white;
  border-radius: 12px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(255, 71, 87, 0.3);
  z-index: 1;
  pointer-events: none;
}

/* Stats sous le nom (2 lignes) */
.sender-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.sender-stats-line {
  font-size: 11px;
  font-weight: 400;
  color: #9ca3af;
  white-space: nowrap;
  line-height: 1.3;
}

/* Pastille verte ✓ — même style que .completed-badge sur les dates */
.sender-completed-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
  z-index: 1;
  pointer-events: none;
}

/* Header favoris avec bouton + */
.favorite-senders-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.favorite-senders-header .favorite-senders-title {
  margin: 0;
}

.add-favorite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: white;
  color: #6b7280;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.add-favorite-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
  background: #eff6ff;
  transform: scale(1.1);
}

/* Formulaire d'ajout */
.add-favorite-form {
  margin-bottom: 12px;
}

.add-favorite-input-wrapper {
  position: relative;
}

.add-favorite-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.add-favorite-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Liste autocomplete */
.sender-autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
  display: none;
}

.sender-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #f3f4f6;
}

.sender-autocomplete-item:last-child {
  border-bottom: none;
}

.sender-autocomplete-item:hover {
  background: #f0f9ff;
}

.sender-autocomplete-item.already-fav {
  opacity: 0.5;
  cursor: default;
}

.sender-ac-name {
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sender-ac-email {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.sender-ac-add {
  font-size: 16px;
  font-weight: 700;
  color: #3b82f6;
  flex-shrink: 0;
}

.sender-ac-fav {
  font-size: 12px;
  flex-shrink: 0;
}

.sender-autocomplete-empty {
  padding: 12px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

.no-favorites-hint {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 8px 0;
  font-style: italic;
}

/* Input filtre expéditeur dans la sidebar */
.sender-filter-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-filter-input {
  width: 100%;
  padding: 6px 28px 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.sidebar-filter-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.sender-filter-clear {
  position: absolute;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: #e5e7eb;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  color: #6b7280;
  padding: 0;
}

.sender-filter-clear:hover {
  background: #d1d5db;
  color: #374151;
}

/* ==========================================
   QUICK REPLY DROPDOWN
   ========================================== */

.quick-reply-dropdown {
  background: white;
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  max-width: 300px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  animation: dropdownFadeIn 0.15s ease;
  z-index: 1000;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.quick-reply-option {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}

.quick-reply-option:hover {
  background: #f0f9ff;
  color: #1d4ed8;
}

.quick-reply-option:last-of-type {
  border-bottom: none;
}

.quick-reply-custom {
  padding: 6px 8px;
  border-top: 1px solid #e5e7eb;
}

.quick-reply-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.quick-reply-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ==========================================
   QUICK REPLY SIDEBAR (actions panel)
   ========================================== */

.quick-reply-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.quick-reply-section h4 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.quick-reply-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.quick-reply-sidebar-btn {
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 16px;
  background: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  color: #374151;
}

.quick-reply-sidebar-btn:hover {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
}

.quick-reply-custom-row {
  display: flex;
  gap: 6px;
}

.quick-reply-sidebar-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
}

.quick-reply-sidebar-input:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.quick-reply-send-btn {
  padding: 6px 10px;
  border: 1px solid #8b5cf6;
  border-radius: 6px;
  background: #8b5cf6;
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.quick-reply-send-btn:hover {
  background: #7c3aed;
}
