/**
 * header-admin.css - Styles partagés du header Console Admin
 * Utilisé par : admin.html, kanban.html, users.html, audit.html
 */

/* ============================================================
   VARIABLES COMMUNES
   ============================================================ */
:root {
  --header-height: 56px;
  --bg: #0f172a;
  --panel: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* ============================================================
   HEADER PRINCIPAL
   ============================================================ */
.app-header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 0 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

/* ============================================================
   LOGO / BRAND
   ============================================================ */
.app-header .header-brand {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}

.app-header .header-brand i {
  font-size: 1.5rem;
}

/* Console Admin - Logo orange distinctif */
.app-header .header-brand.console-admin {
  color: #f59e0b;
  cursor: default;
}

.app-header .header-brand.console-admin i {
  color: #f59e0b;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 2rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  transition: background-color 0.15s, color 0.15s;
  background: transparent;
  border: none;
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

.nav-link i {
  font-size: 0.95rem;
}

/* ============================================================
   MENU DROPDOWN IMPORT
   ============================================================ */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-dropdown-toggle .fa-caret-down {
  font-size: 0.75rem;
  margin-left: 0.25rem;
  transition: transform 0.2s;
}

.nav-dropdown.open .nav-dropdown-toggle .fa-caret-down {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 1000;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.dropdown-item:first-child {
  border-radius: 7px 7px 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 7px 7px;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.dropdown-item i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.dropdown-item i.fa-file-excel {
  color: #22c55e;
}

.dropdown-item i.fa-database {
  color: #3b82f6;
}

.dropdown-item i.fa-sync-alt {
  color: #f59e0b;
}

.dropdown-item i.fa-chart-line {
  color: #a855f7;
}

/* S'assurer que les liens <a> sont cliquables */
a.dropdown-item {
  display: flex;
  pointer-events: auto;
}

/* ============================================================
   HEADER RIGHT (user badge + logout)
   ============================================================ */
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

.user-badge i {
  font-size: 1.2rem;
  color: var(--accent);
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.logout-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* ============================================================
   UTILITAIRES
   ============================================================ */
.hidden {
  display: none !important;
}

/* ============================================================
   MODAL OVERLAY (pour import-menu.js)
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header i {
  font-size: 1.25rem;
  color: var(--accent);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  flex: 1;
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.modal-footer.hidden {
  display: none;
}

/* Boutons de modale */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--text-muted);
}

/* ============================================================
   SYNC STYLES (pour import-menu.js)
   ============================================================ */
.sync-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--text-muted);
}

.sync-loading i {
  font-size: 1.5rem;
  color: var(--accent);
}

.sync-results {
  max-height: 400px;
  overflow-y: auto;
}

.sync-section {
  margin-bottom: 1.5rem;
}

.sync-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--text);
}

.sync-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sync-list li {
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.sync-list li strong {
  color: var(--accent);
}

.sync-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sync-diffs {
  margin-top: 0.5rem;
}

.sync-diff-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.diff-field {
  color: var(--text-muted);
  min-width: 100px;
}

.diff-old {
  color: var(--danger);
  text-decoration: line-through;
}

.diff-new {
  color: var(--success);
}

.sync-diff-item i {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Import status dans modal */
.import-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.import-status.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.import-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.import-status i {
  font-size: 1.25rem;
}
