/* ============================================
   Historique CSS - Styles spécifiques à cette page
   ============================================ */

/* ============================================
   History Grid
   ============================================ */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.history-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.history-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.history-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  cursor: pointer;
}

/* Image wrapper avec loader */
.history-card-image-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  background: var(--bg-secondary, #f8f9fa);
  cursor: pointer;
}

.history-card-image-wrapper .history-card-image {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.history-card-image-wrapper .history-card-image.loaded {
  opacity: 1;
}

.history-card-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted, #6c757d);
  font-size: 1.5rem;
  transition: opacity 0.3s ease;
}

.history-card-image-wrapper .history-card-image.loaded + .history-card-loader,
.history-card-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Overlay avec bouton voir sur l'image */
.history-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 50%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 1rem;
  opacity: 1;
  transition: background 0.3s ease;
}

.history-card:hover .history-card-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 50%);
}

.history-overlay-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.history-overlay-btn:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.1);
}

.history-card-body {
  padding: 1rem;
}

.history-card-title {
  font-weight: 600;
  margin: 0 0 0.375rem 0;
  font-size: 0.9375rem;
}

.history-card-date {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

.history-card-images {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.history-card-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 0.25rem;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.history-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ============================================
   Demo History (Guest Mode)
   Utilise les classes communes de base.css:
   .demo-blur, .demo-overlay, .demo-overlay-content, .demo-overlay-icon
   ============================================ */
.demo-history-wrapper {
  position: relative;
  min-height: 400px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 767.98px) {
  .history-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Options de génération dans la modal
   ============================================ */
.preview-options {
  margin-top: 0.75rem;
}

.options-list {
  max-height: 200px;
  overflow-y: auto;
}

/* Bouton réutiliser les options */
.btn-reuse-options {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  border-radius: 2rem;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-reuse-options:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-reuse-options i {
  font-size: 0.75rem;
}

/* ============================================
   Section Ajout à la penderie
   ============================================ */
#add-to-wardrobe-section {
  background: var(--sidebar-bg);
  border: 1px solid var(--secondary);
  border-radius: 0;
  padding: 1rem;
}

#add-to-wardrobe-section .add-wardrobe-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--info);
  margin-bottom: 0.75rem;
}

#add-to-wardrobe-section .add-wardrobe-header i {
  color: var(--secondary);
}

#add-to-wardrobe-section .add-wardrobe-inputs {
  display: flex;
  gap: 0.75rem;
}

#add-to-wardrobe-section .add-wardrobe-name {
  flex: 0 0 60%;
  max-width: 60%;
}

#add-to-wardrobe-section .add-wardrobe-category {
  flex: 0 0 calc(40% - 0.75rem);
  max-width: calc(40% - 0.75rem);
}

#add-to-wardrobe-section .add-wardrobe-action {
  width: 100%;
  margin-top: 0.75rem;
}

#add-to-wardrobe-section .add-wardrobe-form .form-label {
  color: var(--info);
  font-size: 0.75rem;
  font-weight: 500;
}

#add-to-wardrobe-section .add-wardrobe-form .form-control,
#add-to-wardrobe-section .add-wardrobe-form .form-select {
  background: var(--card-bg);
  border-color: var(--border-color);
  border-radius: 0;
  height: 38px;
}

#add-to-wardrobe-section .add-wardrobe-form .form-control:focus,
#add-to-wardrobe-section .add-wardrobe-form .form-select:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 0.2rem rgba(242, 156, 163, 0.25);
}

#add-to-wardrobe-section .add-wardrobe-success {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--info);
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0;
}

#add-to-wardrobe-section .add-wardrobe-success i {
  font-size: 1rem;
  color: var(--secondary);
}

/* Responsive pour la section ajout penderie */
@media (max-width: 575.98px) {
  #add-to-wardrobe-section {
    padding: 0.75rem;
  }
  
  #add-to-wardrobe-section .add-wardrobe-inputs {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  #add-to-wardrobe-section .add-wardrobe-name,
  #add-to-wardrobe-section .add-wardrobe-category {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ============================================
   Sélection multiple - Styles spécifiques historique
   Utilise les classes communes .bulk-checkbox et .bulk-actions-bar de base.css
   ============================================ */

/* Alias pour compatibilité */
.history-card-checkbox {
  margin-left: auto;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.history-card-checkbox:hover {
  transform: scale(1.1);
}

.history-card-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.history-card-checkbox .checkmark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--border-color, #dee2e6);
  border-radius: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.history-card-checkbox .checkmark i {
  opacity: 0;
  color: #fff;
  font-size: 0.75rem;
  transition: opacity 0.15s ease;
}

.history-card-checkbox input:checked + .checkmark {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
}

.history-card-checkbox input:checked + .checkmark i {
  opacity: 1;
}

.history-card-checkbox:hover .checkmark {
  border-color: var(--primary);
  transform: scale(1.05);
}

/* Carte sélectionnée */
.history-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(17, 159, 184, 0.3), var(--shadow);
}

.history-card.selected .history-card-image-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(17, 159, 184, 0.1);
  pointer-events: none;
}
