/* Variables */
:root {
  --primary: #00b894;
  --primary-dark: #00a884;
  --secondary: #2d3436;
  --surface: #1e272e;
  --surface-light: #2d3436;
  --text: #f5f6fa;
  --text-secondary: #b2bec3;
  --border: #3d3d3d;
  --tier-s: #ff7675;
  --tier-a: #fdcb6e;
  --tier-b: #55efc4;
  --tier-c: #74b9ff;
  --tier-d: #a29bfe;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* Reset et styles de base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: #121212;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Conteneur principal */
.tierlist-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
  width: 100%;
}

/* En-tête */
.tierlist-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.tierlist-title {
  font-family: 'Garamond', serif;
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.tierlist-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

/* Boutons d'action */
.tierlist-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  font-size: 0.95rem;
  text-decoration: none;
}

.btn i {
  font-size: 1rem;
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 184, 148, 0.3);
}

.btn-secondary {
  background-color: var(--surface-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: #3d3d3d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-danger {
  background-color: #ff6b6b;
  color: white;
}

.btn-danger:hover {
  background-color: #ff5252;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

/* Rangées de tier */
.tier-row {
  display: flex;
  margin-bottom: 0.5rem;
  min-height: 100px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.tier-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.tier-label {
  width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.5rem;
  text-transform: uppercase;
  color: white;
  font-family: 'Garamond', serif;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Couleurs des différents tiers */
.tier-s .tier-label { 
  background-color: var(--tier-s);
  color: white;
}

.tier-a .tier-label { 
  background-color: var(--tier-a);
  color: #2d3436;
}

.tier-b .tier-label { 
  background-color: var(--tier-b);
  color: #2d3436;
}

.tier-c .tier-label { 
  background-color: var(--tier-c);
  color: white;
}

.tier-d .tier-label { 
  background-color: var(--tier-d);
  color: white;
}

/* Contenu du tier */
.tier-content {
  flex: 1;
  background-color: var(--surface-light);
  display: flex;
  align-items: center;
  padding: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-height: 100%;
  transition: var(--transition);
}

/* Éléments du tier */
.tier-item {
  width: 80px;
  height: 100px;
  border-radius: 4px;
  overflow: hidden;
  cursor: grab;
  position: relative;
  transition: var(--transition);
  background-color: var(--surface);
  border: 2px solid transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tier-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
  z-index: 10;
  border-color: var(--primary);
}

.tier-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Bouton de suppression */
.tier-item .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: rgba(255, 0, 0, 0.8);
  color: white;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.tier-item:hover .remove-btn {
  opacity: 1;
}

.tier-item .remove-btn:hover {
  background-color: #ff0000;
  transform: scale(1.1);
}

/* Zone non classée */
.unranked-container {
  margin-top: 3rem;
  background-color: var(--surface-light);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--border);
}

.unranked-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.unranked-title {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.unranked-title i {
  color: var(--primary);
}

.unranked-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-height: 140px;
  padding: 1.5rem;
  border: 2px dashed var(--border);
  border-radius: 4px;
  transition: all 0.3s ease;
  align-content: flex-start;
  position: relative;
}

.unranked-items .empty-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  text-align: center;
  width: 100%;
  padding: 0 1rem;
  pointer-events: none;
}

.unranked-items.dragover {
  background-color: rgba(0, 184, 148, 0.1);
  border-color: var(--primary);
}

/* États de glisser-déposer */
.tier-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
  box-shadow: 0 0 0 2px var(--primary);
}

.tier-content.dragover,
.unranked-items.dragover {
  background-color: rgba(0, 184, 148, 0.1);
  border: 2px dashed var(--primary);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background-color: var(--surface);
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(20px);
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.modal.show .modal-content {
  transform: translateY(0);
  opacity: 1;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background-color: var(--surface);
  z-index: 10;
  border-radius: 8px 8px 0 0;
}

.modal-title {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text);
  font-weight: 600;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.close-modal:hover {
  color: var(--text);
  background-color: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--surface-light);
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 184, 148, 0.2);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 0 0 8px 8px;
}

/* Résultats de recherche d'images */
.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.25rem;
}

.search-result-item {
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
  transition: var(--transition);
  background-color: var(--surface);
}

.search-result-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  border-color: var(--primary);
}

.search-result-item.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

.search-result-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.search-result-item .selected-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 184, 148, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.search-result-item.selected .selected-overlay {
  opacity: 1;
}

.search-result-item .selected-overlay i {
  color: white;
  font-size: 1.5rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Aperçu des images sélectionnées */
.selected-images-preview {
  margin-top: 1.5rem;
  display: none;
}

.selected-images-preview h4 {
  margin-bottom: 0.75rem;
  color: var(--text);
  font-weight: 500;
  font-size: 1.1rem;
}

.selected-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  background-color: var(--surface-light);
  border-radius: 4px;
  padding: 1rem;
  min-height: 80px;
  border: 1px dashed var(--border);
}

.selected-image {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid var(--border);
  transition: var(--transition);
}

.selected-image:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.selected-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.remove-selected-image {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: rgba(255, 0, 0, 0.8);
  color: white;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  transition: var(--transition);
}

.remove-selected-image:hover {
  background-color: #ff0000;
  transform: scale(1.1);
}

/* État de chargement */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Message d'information */
.info-message {
  background-color: rgba(0, 184, 148, 0.1);
  border-left: 3px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 0 4px 4px 0;
  margin: 1rem 0;
  color: var(--text);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.info-message i {
  color: var(--primary);
  margin-top: 0.1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .tier-label {
    width: 70px;
    font-size: 1.2rem;
  }
  
  .tier-item {
    width: 70px;
    height: 90px;
  }
  
  .tierlist-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .modal-content {
    margin: 1rem;
  }
}

@media (max-width: 480px) {
  .tier-label {
    width: 50px;
    font-size: 1rem;
    padding: 0.5rem;
  }
  
  .tier-item {
    width: 60px;
    height: 80px;
  }
  
  .tierlist-title {
    font-size: 2rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
}

/* Animation d'apparition des éléments */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tier-row {
  animation: fadeIn 0.3s ease-out forwards;
  opacity: 0;
}

.tier-row:nth-child(1) { animation-delay: 0.1s; }
.tier-row:nth-child(2) { animation-delay: 0.2s; }
.tier-row:nth-child(3) { animation-delay: 0.3s; }
.tier-row:nth-child(4) { animation-delay: 0.4s; }
.tier-row:nth-child(5) { animation-delay: 0.5s; }

/* Style pour les notifications */
.notification {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background-color: var(--surface);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 350px;
}

.notification.show {
  transform: translateY(0);
  opacity: 1;
}

.notification.success {
  border-left: 4px solid #00b894;
}

.notification.error {
  border-left: 4px solid #ff7675;
}

.notification.warning {
  border-left: 4px solid #fdcb6e;
}

.notification i {
  font-size: 1.25rem;
}

.notification.success i { color: #00b894; }
.notification.error i { color: #ff7675; }
.notification.warning i { color: #fdcb6e; }

.notification-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.25rem;
  transition: color 0.2s;
}

.notification-close:hover {
  color: var(--text);
}

/* Style pour les tooltips */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
  margin-bottom: -6px;
  opacity: 0;
  transition: opacity 0.2s;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
}
