/* ═══════════════════════════════════════════════════════════════
   OPTIMISATIONS CSS ADMIN
   À charger APRÈS style.css pour améliorer UX et performance.
   ═══════════════════════════════════════════════════════════════ */

/* ── Amélioration des formulaires ── */
input, select, textarea {
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(244, 169, 71, 0.12);
}

input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

input:valid:not(:placeholder-shown) {
  border-color: rgba(76, 175, 80, 0.5);
}

/* ── Amélioration des tableaux ── */
table {
  border-collapse: collapse;
}

th {
  background: rgba(51, 32, 79, 0.3);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(69, 42, 99, 0.35);
}

tbody tr {
  transition: background 0.1s ease;
}

tbody tr:hover {
  background: rgba(244, 169, 71, 0.04);
}

tbody tr.selected {
  background: rgba(244, 169, 71, 0.08);
}

/* ── Amélioration des boutons ── */
button {
  transition: all 0.15s ease;
}

button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

button.danger {
  box-shadow: 0 2px 8px rgba(224, 99, 122, 0.15);
}

button.danger:hover {
  box-shadow: 0 4px 16px rgba(224, 99, 122, 0.3);
}

/* ── Amélioration des cartes ── */
.card {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: rgba(244, 169, 71, 0.25);
  box-shadow: 0 4px 12px rgba(244, 169, 71, 0.1);
}

.card.active, .card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(244, 169, 71, 0.15);
}

/* ── Badge : meilleure lisibilité ── */
.tag, .badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.tag.active, .badge.active {
  background: var(--gold);
  color: #1B1706;
}

.tag.danger, .badge.danger {
  background: rgba(224, 99, 122, 0.15);
  color: var(--danger);
}

.tag.success, .badge.success {
  background: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
}

/* ── Amélioration des onglets ── */
.admin-tab {
  transition: all 0.15s ease;
  position: relative;
}

.admin-tab:focus-visible {
  outline: 2px solid var(--gold);
}

.admin-tab.active {
  color: var(--gold);
  font-weight: 700;
}

.admin-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
}

/* ── Sélecteurs améliorés ── */
select {
  cursor: pointer;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"%3E%3Cpolyline points="6 9 12 15 18 9"%3E%3C/polyline%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}

/* ── Amélioration des champs au survol ── */
.form-field:hover label {
  color: var(--gold-alpha-35);
  font-weight: 600;
}

.form-field.error input,
.form-field.error select,
.form-field.error textarea {
  border-color: var(--danger);
  background: rgba(224, 99, 122, 0.08);
}

.form-field.error label {
  color: var(--danger);
  font-weight: 600;
}

.form-field.success input,
.form-field.success select,
.form-field.success textarea {
  border-color: #4CAF50;
}

/* ── Messages et notifications ── */
.alert, .notification, .message {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.alert.success {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: #4CAF50;
}

.alert.error {
  background: rgba(224, 99, 122, 0.1);
  border: 1px solid rgba(224, 99, 122, 0.3);
  color: var(--danger);
}

.alert.warning {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  color: #FFC107;
}

.alert.info {
  background: rgba(244, 169, 71, 0.1);
  border: 1px solid rgba(244, 169, 71, 0.3);
  color: var(--gold);
}

/* ── Loading states ── */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(244, 169, 71, 0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Barre latérale (si présente) ── */
.sidebar {
  background: rgba(26, 14, 46, 0.5);
  border-right: 1px solid var(--line);
  transition: all 0.2s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

/* ── Modales et overlays ── */
.modal-overlay, .overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s cubic-bezier(0.22, 0.9, 0.32, 1);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Grille responsive ── */
.grid, .card-grid {
  display: grid;
  grid-auto-flow: dense;
  gap: 16px;
}

@media (min-width: 1200px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

@media (max-width: 768px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}

/* ── Status indicators ── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.status.active, .status.success {
  background: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
}

.status.inactive, .status.disabled {
  background: rgba(180, 155, 199, 0.15);
  color: var(--muted);
}

.status.pending, .status.warning {
  background: rgba(255, 193, 7, 0.15);
  color: #FFC107;
}

.status.error, .status.critical {
  background: rgba(224, 99, 122, 0.15);
  color: var(--danger);
}

.status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

/* ── Améliorations du contraste et lisibilité ── */
.text-muted {
  color: var(--muted);
}

.text-gold {
  color: var(--gold);
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: #4CAF50;
}

/* ── Séparateurs ── */
.divider, hr {
  margin: 16px 0;
  border: none;
  height: 1px;
  background: var(--line);
}

/* ── Focus visible global ── */
*:focus-visible {
  outline-color: var(--gold);
  outline-width: 2px;
  outline-offset: 2px;
}

/* ── Réduit les animations pour les utilisateurs préférant ── */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Impressions ── */
@media print {
  .no-print { display: none !important; }
  body { background: white; color: black; }
  button, .btn { background: none; border: 1px solid black; }
}
