/* ============================================
   VALIDATION.CSS - Page validation admin
   Design propre et cohérent avec periode.css
   ============================================ */

/* Variables héritées de periode.css */
:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --text-light: #475569;
  --muted: #64748b;
  --line: rgba(15,23,42,.10);
  --primary: #2563eb;
  --shadow: 0 10px 28px rgba(15,23,42,.08);
  --radius: 16px;

  /* Couleurs actions */
  --success: #10b981;
  --success-hover: #059669;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  --warning-hover: #d97706;

  /* Couleurs statuts */
  --brouillon: #fbbf24;
  --brouillon-bg: #fef3c7;
  --brouillon-text: #92400e;
  
  --soumis: #3b82f6;
  --soumis-bg: #dbeafe;
  --soumis-text: #1e3a8a;
  
  --valide: #10b981;
  --valide-bg: #d1fae5;
  --valide-text: #065f46;
  
  --refuse: #ef4444;
  --refuse-bg: #fee2e2;
  --refuse-text: #991b1b;

  --exporte: #6b7280;
  --exporte-bg: #f3f4f6;
  --exporte-text: #374151;
}

/* Reset de base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ============================================
   ONGLETS
   ============================================ */

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: white;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
  border: 1px solid var(--line);
}

.tab {
  flex: 1;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab:hover {
  background: #f8fafc;
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,.2);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: var(--primary);
  color: white;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.tab.active .badge {
  background: white;
  color: var(--primary);
}

/* ============================================
   CONTENU ONGLETS
   ============================================ */

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================
   TOOLBAR
   ============================================ */

.toolbar {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
}

.toolbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar__right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.checkbox-all {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.checkbox-all input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.sep {
  color: var(--line);
  font-weight: bold;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-select:hover {
  border-color: var(--primary);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ============================================
   BOUTONS D'ACTION
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 18px;
  line-height: 1;
}

.btn-text {
  line-height: 1;
}

.btn--secondary {
  background: var(--muted);
  color: white;
}

.btn--secondary:hover:not(:disabled) {
  background: #475569;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(100,116,139,.3);
}

.btn--success {
  background: var(--success);
  color: white;
}

.btn--success:hover:not(:disabled) {
  background: var(--success-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
}

.btn--danger {
  background: var(--danger);
  color: white;
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239,68,68,.3);
}

.btn--primary {
  background: var(--primary);
  color: white;
}

.btn--primary:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* ============================================
   TABLEAU VALIDATION
   ============================================ */

.table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
}

.validation-table {
  width: 100%;
  border-collapse: collapse;
}

.validation-table thead {
  background: #f8fafc;
  border-bottom: 2px solid var(--line);
}

.validation-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.validation-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.validation-table th.sortable:hover {
  background: #f1f5f9;
}

.sort-icon {
  opacity: 0.3;
  margin-left: 4px;
}

.validation-table th.sortable:hover .sort-icon {
  opacity: 0.6;
}

.validation-table tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 0.2s ease;
}

.validation-table tbody tr:hover {
  background: #fafbfc;
}

.validation-table tbody tr.selected {
  background: rgba(37,99,235,.05);
}

.validation-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
}

/* Colonnes spécifiques */
.col-check {
  width: 40px;
  text-align: center;
}

.col-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.col-user {
  font-weight: 600;
  min-width: 180px;
}

.col-periode {
  min-width: 150px;
}

.col-km,
.col-3h,
.col-frais {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.col-statut {
  min-width: 120px;
}

.col-date {
  min-width: 150px;
  color: var(--muted);
  font-size: 13px;
}

.col-validateur {
  min-width: 180px;
  color: var(--muted);
}

.col-actions {
  text-align: center;
  min-width: 100px;
}

/* ============================================
   RECTANGLES PÉRIODE
   ============================================ */

.periode-rect {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.periode-rect:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.periode-rect.brouillon {
  background: var(--brouillon-bg);
  color: var(--brouillon-text);
  border-color: var(--brouillon);
}

.periode-rect.soumis {
  background: var(--soumis-bg);
  color: var(--soumis-text);
  border-color: var(--soumis);
}

.periode-rect.valide {
  background: var(--valide-bg);
  color: var(--valide-text);
  border-color: var(--valide);
}

.periode-rect.refuse {
  background: var(--refuse-bg);
  color: var(--refuse-text);
  border-color: var(--refuse);
}

.periode-rect.exporte {
  background: var(--exporte-bg);
  color: var(--exporte-text);
  border-color: var(--exporte);
}

/* ============================================
   BADGES STATUT
   ============================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.brouillon {
  background: var(--brouillon-bg);
  color: var(--brouillon-text);
}

.status-badge.soumis {
  background: var(--soumis-bg);
  color: var(--soumis-text);
}

.status-badge.valide {
  background: var(--valide-bg);
  color: var(--valide-text);
}

.status-badge.refuse {
  background: var(--refuse-bg);
  color: var(--refuse-text);
}

.status-badge.exporte {
  background: var(--exporte-bg);
  color: var(--exporte-text);
}

/* ============================================
   BOUTONS D'ACTION (TABLEAU)
   ============================================ */

.action-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 18px;
}

.action-btn:hover {
  background: #f8fafc;
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* ============================================
   ÉTAT VIDE
   ============================================ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 18px;
  font-weight: 600;
}

/* ============================================
   MODALES
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay[aria-hidden="true"] {
  display: none;
}

.modal-dialog {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}

.modal-dialog--large {
  max-width: 1000px;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f4f6;
  border-radius: 8px;
  cursor: pointer;
  font-size: 24px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #e5e7eb;
  color: var(--text);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ============================================
   INFO CARDS (dans modale détails)
   ============================================ */

.info-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.info-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.info-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
}

.info-list dt {
  font-weight: 600;
  color: var(--muted);
  font-size: 14px;
}

.info-list dd {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

/* ============================================
   TABLEAU DÉTAILS (dans modale)
   ============================================ */

.details-table-wrap {
  margin-top: 20px;
}

.details-table-wrap h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.details-table thead {
  background: #f8fafc;
  border-bottom: 2px solid var(--line);
}

.details-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.details-table th.num {
  text-align: right;
}

.details-table tbody tr {
  border-bottom: 1px solid var(--line);
}

.details-table td {
  padding: 10px 12px;
  color: var(--text-light);
}

.details-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   FORMULAIRES (modale refus)
   ============================================ */

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 14px;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: all 0.2s ease;
}

.field textarea {
  resize: vertical;
  min-height: 100px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ============================================
   ALERTES
   ============================================ */

.alert {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.alert--warning {
  background: var(--brouillon-bg);
  border: 1px solid var(--brouillon);
  color: var(--brouillon-text);
}

.alert--info {
  background: var(--soumis-bg);
  border: 1px solid var(--soumis);
  color: var(--soumis-text);
}

.alert--danger {
  background: var(--refuse-bg);
  border: 1px solid var(--refuse);
  color: var(--refuse-text);
}

.alert strong {
  font-weight: 700;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
  .validation-table {
    font-size: 13px;
  }

  .validation-table th,
  .validation-table td {
    padding: 10px 12px;
  }
}

@media (max-width: 900px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar__left,
  .toolbar__right {
    width: 100%;
    justify-content: space-between;
  }

  .btn {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 16px;
  }

  .tabs {
    flex-direction: column;
  }

  .tab {
    width: 100%;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .validation-table {
    min-width: 800px;
  }
}