/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a12;
  --bg-secondary: #12121e;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --bg-input: #16162a;
  --border-color: #2a2a45;
  --text-primary: #e8e8f0;
  --text-secondary: #8888aa;
  --text-muted: #5a5a78;
  --accent: #7c5cfc;
  --accent-hover: #9478ff;
  --accent-light: rgba(124, 92, 252, 0.15);
  --danger: #f04060;
  --success: #34d399;
  --warning: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f5f5f8;
  --bg-secondary: #eaeaef;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f5;
  --bg-input: #f0f0f5;
  --border-color: #d0d0dd;
  --text-primary: #1a1a2e;
  --text-secondary: #555570;
  --text-muted: #8888aa;
  --accent: #6c4ce6;
  --accent-hover: #7c5cfc;
  --accent-light: rgba(108, 76, 230, 0.1);
  --danger: #e0304f;
  --success: #22b07a;
  --warning: #e0a820;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ===== LOGIN PAGE ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.login-logo span {
  color: var(--accent);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.3);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(240, 64, 96, 0.15);
  color: var(--danger);
  border: 1px solid rgba(240, 64, 96, 0.3);
}

.btn-danger:hover {
  background: rgba(240, 64, 96, 0.25);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.error-message {
  background: rgba(240, 64, 96, 0.1);
  border: 1px solid rgba(240, 64, 96, 0.3);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  text-align: center;
}

/* ===== LAYOUT (DASHBOARD + UPLOAD) ===== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.header-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.header-logo span {
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.app-layout {
  display: flex;
  margin-top: 60px;
  min-height: calc(100vh - 60px);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 20px 0;
  overflow-y: auto;
  height: calc(100vh - 60px);
  position: fixed;
  top: 60px;
  left: 0;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 20px;
  margin-bottom: 12px;
}

.folder-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.folder-btn:hover {
  background: var(--accent-light);
  color: var(--text-primary);
}

.folder-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  border-right: 3px solid var(--accent);
}

.folder-btn .folder-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.folder-children {
  display: none;
  padding-left: 16px;
}

.folder-children.open {
  display: block;
}

.folder-children .folder-btn {
  font-size: 13px;
  padding: 8px 20px 8px 32px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 24px;
  overflow-x: auto;
}

.search-bar-container {
  margin-bottom: 20px;
}

.search-bar {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-bar-wrapper {
  position: relative;
}

.search-bar-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

/* ===== TABLE ===== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 220px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.data-table .col-id { width: 60px; }
.data-table .col-titre { width: 200px; }
.data-table .col-categorie { width: 140px; }
.data-table .col-nature { width: 160px; }
.data-table .col-type { width: 100px; }
.data-table .col-statut { width: 120px; }
.data-table .col-paiement { width: 140px; }
.data-table .col-ref { width: 180px; }
.data-table .col-dossiers { width: 100px; }
.data-table .col-secteur { width: 140px; }
.data-table .col-date { width: 120px; }
.data-table .col-actions { width: 100px; }

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table thead tr:first-child th {
  background: var(--bg-secondary);
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table thead tr:nth-child(2) th {
  background: var(--bg-secondary);
  padding: 6px 8px;
  border-bottom: 2px solid var(--border-color);
}

.filter-input {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}

.filter-input:focus {
  border-color: var(--accent);
}

.filter-select {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font);
  outline: none;
  cursor: pointer;
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.data-table tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(42, 42, 69, 0.5);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 15px;
  transition: background 0.15s;
}

.action-btn:hover {
  background: var(--bg-card-hover);
}

.action-btn-download {
  color: var(--accent);
}

.action-btn-delete {
  color: var(--danger);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-brouillon {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.badge-valide {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.badge-archive {
  background: rgba(136, 136, 170, 0.15);
  color: var(--text-secondary);
}

.badge-paye {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.badge-non-paye {
  background: rgba(240, 64, 96, 0.15);
  color: var(--danger);
}

.badge-partiel {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.badge-en-attente {
  background: rgba(124, 92, 252, 0.15);
  color: var(--accent);
}

.badge-refuse {
  background: rgba(240, 64, 96, 0.15);
  color: var(--danger);
}

/* F3: Pending section */
.pending-section {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(124, 92, 252, 0.08);
  border: 1px solid rgba(124, 92, 252, 0.3);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.pending-icon {
  font-size: 18px;
  color: var(--accent);
}

.pending-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.pending-badge {
  background: var(--accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

/* F3: Validation select */
.validation-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 4px 24px 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%238888aa'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.validation-en-attente {
  background-color: rgba(124, 92, 252, 0.15);
  color: var(--accent);
}

.validation-valide {
  background-color: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.validation-refuse {
  background-color: rgba(240, 64, 96, 0.15);
  color: var(--danger);
}

/* F1: Version badges */
.badge-version-creation {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.badge-version-modification {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.badge-version-restauration {
  background: rgba(230, 126, 0, 0.15);
  color: #e67e00;
}

.badge-version-upload {
  background: rgba(124, 92, 252, 0.15);
  color: var(--accent);
}

.badge-version-statut {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 15px;
  margin-top: 12px;
}

/* ===== UPLOAD PAGE ===== */
.upload-layout {
  display: flex;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  min-height: calc(100vh - 60px);
}

.upload-dossier-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  position: sticky;
  top: 60px;
}

.upload-dossier-panel-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.upload-selected-dossier {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}

.upload-selected-label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.upload-selected-name {
  color: var(--accent);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.upload-selected-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

.upload-selected-clear:hover {
  color: var(--danger);
}

.upload-dossier-search-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.upload-dossier-search {
  padding: 10px 14px !important;
  font-size: 13px !important;
}

.upload-dossier-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: none;
  max-height: 220px;
  overflow-y: auto;
}

.upload-suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-color);
}

.upload-suggestion-item:last-child {
  border-bottom: none;
}

.upload-suggestion-item:hover {
  background: var(--accent-light);
}

.upload-suggestion-path {
  font-size: 13px;
  color: var(--text-primary);
}

.upload-suggestion-empty {
  padding: 12px 14px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Tree explorer */
.upload-dossier-tree {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  min-height: 120px;
}

.upload-tree-node {
  /* wrapper */
}

.upload-tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(42, 42, 69, 0.3);
}

.upload-tree-item:hover {
  background: var(--bg-card-hover);
}

.upload-tree-item.selected {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.upload-tree-arrow {
  width: 16px;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
  text-align: center;
  flex-shrink: 0;
  cursor: pointer;
}

.upload-tree-arrow.expanded {
  transform: rotate(90deg);
}

.upload-tree-arrow.empty {
  visibility: hidden;
}

.upload-tree-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.upload-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-tree-delete {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.upload-tree-item:hover .upload-tree-delete {
  opacity: 0.7;
}

.upload-tree-delete:hover {
  opacity: 1 !important;
  background: var(--danger);
  color: white;
}

.upload-tree-children {
  padding-left: 20px;
}

.upload-add-dossier-btn {
  width: 100%;
  font-size: 13px;
  flex-shrink: 0;
}

.upload-main {
  flex: 1;
  padding: 32px 24px;
  max-width: 800px;
}

/* Upload notifications */
.upload-notif {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  animation: slideIn 0.3s ease;
}

.upload-notif-success {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}

.upload-notif-error {
  background: rgba(240, 64, 96, 0.15);
  border: 1px solid rgba(240, 64, 96, 0.3);
  color: var(--danger);
}

.upload-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px;
}

.upload-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 28px;
}

.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
  margin-bottom: 24px;
}

.dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
  animation: dropzonePulse 1s ease infinite;
}

@keyframes dropzonePulse {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: var(--accent-hover); box-shadow: 0 0 20px var(--accent-light); }
}

.dropzone-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.dropzone-text {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.dropzone-subtext {
  font-size: 13px;
  color: var(--text-muted);
}

.upload-folder-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 14px;
}

.upload-form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

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

.form-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.upload-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Recap */
.recap-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  display: none;
}

.recap-section.visible {
  display: block;
}

.recap-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.recap-files {
  list-style: none;
}

.recap-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  margin-bottom: 6px;
  background: var(--bg-input);
}

.recap-file-name {
  font-size: 14px;
  color: var(--text-primary);
}

.recap-file-info {
  font-size: 12px;
  color: var(--text-muted);
}

.recap-file-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
}

.destination-search {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  margin-top: 12px;
}

.destination-search:focus {
  border-color: var(--accent);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== LOGO EASTER EGG ===== */
.header-logo {
  user-select: none;
  -webkit-user-select: none;
}

/* ===== CONFIRM MODAL ===== */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.confirm-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.confirm-card p {
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ===== UPLOAD PROGRESS ===== */
.upload-progress {
  margin-top: 12px;
  display: none;
}

.upload-progress.visible {
  display: block;
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.2s;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
}

/* ===== BULK BAR ===== */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.col-check {
  width: 40px;
  text-align: center;
}

/* ===== PREVIEW MODAL ===== */
.preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.preview-title {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-unsupported {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.preview-unsupported p {
  margin-bottom: 16px;
}

.action-btn-preview {
  color: var(--accent);
}

.action-btn-preview:hover {
  background: var(--accent-light);
}

/* ===== PAGINATION ===== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-buttons {
  display: flex;
  gap: 4px;
}

/* ===== HAMBURGER BUTTON ===== */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: background 0.15s;
}

.hamburger-btn:hover {
  background: var(--bg-card-hover);
}

/* ===== DOSSIERS ===== */
.dossiers-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  z-index: 5000;
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: 400px;
  display: none;
}

.dossier-path-line {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  flex-wrap: wrap;
}

.dossier-path-segment {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.dossier-path-segment:hover {
  background: var(--accent);
  color: #fff;
}

.dossier-path-segment-static {
  color: var(--text-primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

.dossier-path-sep {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.dossiers-voir-btn {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid transparent;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.dossiers-voir-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* ===== F6: ADVANCED SEARCH ===== */
.adv-search-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  padding: 4px 10px;
}

.search-bar-wrapper {
  position: relative;
}

.adv-search-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.adv-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.adv-search-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.adv-search-criteria {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.search-criteria-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.criteria-field,
.criteria-operator {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  min-width: 140px;
}

.criteria-field:focus,
.criteria-operator:focus {
  border-color: var(--accent);
}

.criteria-value {
  flex: 1;
  min-width: 150px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
}

.criteria-value:focus {
  border-color: var(--accent);
}

.criteria-value-group {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 150px;
}

.criteria-value-group input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
}

.criteria-remove {
  padding: 6px 10px;
  font-size: 14px;
  flex-shrink: 0;
}

.adv-search-actions {
  display: flex;
  gap: 8px;
}

/* ===== F5: ANALYTICS ===== */
.analytics-section {
  margin-bottom: 20px;
}

.analytics-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.analytics-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.analytics-card-accent {
  color: var(--warning);
}

.analytics-card-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.analytics-period-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.analytics-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.analytics-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
}

.analytics-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* ===== F7: NOTIFICATIONS ===== */
.notif-bell-wrapper {
  position: relative;
}

.notif-bell-btn {
  position: relative;
  font-size: 16px;
  line-height: 1;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.notif-mark-all {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
}

.notif-mark-all:hover {
  text-decoration: underline;
}

.notif-dropdown-list {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}

.notif-dropdown-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--bg-card-hover);
}

.notif-unread {
  background: rgba(124, 92, 252, 0.06);
}

.notif-item-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.notif-item-message {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.notif-pref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}

.notif-pref-row:last-child {
  border-bottom: none;
}

.notif-pref-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ===== VOICE SEARCH ===== */
.voice-search-btn {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 2;
}

.voice-search-btn:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.voice-search-btn.voice-listening {
  color: var(--danger);
  background: rgba(240, 64, 96, 0.12);
  animation: voicePulse 1.5s ease infinite;
}

.voice-search-btn.voice-unsupported {
  opacity: 0.4;
  cursor: not-allowed;
}

.voice-status-dot {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.voice-status-dot.active {
  display: block;
  animation: voiceDotPulse 1s ease infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 64, 96, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(240, 64, 96, 0); }
}

@keyframes voiceDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.voice-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 8px;
  animation: slideIn 0.2s ease;
}

.voice-feedback-listening {
  background: rgba(240, 64, 96, 0.1);
  border: 1px solid rgba(240, 64, 96, 0.3);
  color: var(--danger);
}

.voice-feedback-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}

.voice-feedback-error {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: var(--warning);
}

.voice-feedback-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.voice-feedback-text {
  font-weight: 500;
}

/* Adjust search bar padding to accommodate voice button */
.search-bar {
  padding-right: 88px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .data-table {
    table-layout: auto;
  }

  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 900px;
  }
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 60px;
    left: -280px;
    z-index: 90;
    transition: left 0.3s ease;
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .sidebar-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 89;
    display: none;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  /* Header mobile */
  .app-header {
    padding: 0 12px;
    height: 56px;
  }

  .header-logo {
    font-size: 17px;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .btn-sm {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Hide text-only buttons on mobile, keep icon buttons */
  .header-actions a[href="/admin"],
  .header-actions a[href="/logout"] {
    font-size: 0;
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
  }

  .header-actions a[href="/admin"]::before {
    content: '\2699';
    font-size: 16px;
  }

  .header-actions a[href="/logout"]::before {
    content: '\23FB';
    font-size: 14px;
  }

  /* Search bar mobile */
  .search-bar {
    font-size: 14px;
    padding: 12px 80px 12px 40px;
  }

  .search-bar::placeholder {
    font-size: 13px;
  }

  /* Voice button mobile sizing */
  .voice-search-btn {
    padding: 8px;
    right: 40px;
  }

  /* Upload page */
  .upload-layout {
    flex-direction: column;
  }

  .upload-dossier-panel {
    width: 100%;
    min-width: 100%;
    max-height: none;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
  }

  .upload-dossier-tree {
    max-height: 200px;
  }

  .upload-main {
    padding: 20px 12px;
    max-width: 100%;
  }

  .upload-container {
    padding: 20px 12px;
  }

  .upload-title {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .upload-form {
    padding: 20px;
  }

  .upload-actions {
    flex-direction: column;
    gap: 10px;
  }

  .upload-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .dropzone {
    padding: 40px 16px;
  }

  .dropzone-icon {
    font-size: 36px;
  }

  .dropzone-text {
    font-size: 14px;
  }

  /* Login mobile */
  .login-card {
    margin: 0 16px;
    padding: 32px 24px;
  }

  /* Bulk bar mobile */
  .bulk-bar {
    flex-wrap: wrap;
    font-size: 12px;
    gap: 8px;
  }

  .bulk-bar .btn {
    min-height: 40px;
  }

  /* Preview modal mobile */
  .preview-card {
    width: 98%;
    max-height: 90vh;
    border-radius: var(--radius-sm);
  }

  .preview-header {
    padding: 12px 16px;
  }

  .preview-body {
    padding: 12px;
  }

  /* Confirm modal mobile */
  .confirm-card {
    width: 92%;
    padding: 24px 20px;
  }

  .confirm-actions {
    flex-direction: column;
    gap: 8px;
  }

  .confirm-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  /* Pagination mobile */
  .pagination-bar {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 12px;
  }

  .pagination-buttons {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .pagination-buttons .btn {
    min-width: 40px;
    min-height: 40px;
  }

  /* Notifications dropdown mobile */
  .notif-dropdown {
    position: fixed;
    top: 56px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 72px);
    border-radius: var(--radius-sm);
  }

  /* Analytics mobile */
  .analytics-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .analytics-card {
    padding: 14px;
  }

  .analytics-card-value {
    font-size: 22px;
  }

  .analytics-charts-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .analytics-period-filters {
    flex-wrap: wrap;
  }

  /* Advanced search mobile */
  .search-criteria-row {
    flex-direction: column;
    gap: 6px;
  }

  .criteria-field,
  .criteria-operator {
    min-width: 100%;
  }

  .adv-search-actions {
    flex-direction: column;
  }

  .adv-search-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  /* Touch-friendly sizing for interactive elements */
  .filter-input,
  .filter-select {
    padding: 10px;
    font-size: 14px;
    min-height: 40px;
  }

  .action-btn {
    padding: 8px;
    font-size: 18px;
    min-width: 36px;
    min-height: 36px;
  }

  .folder-btn {
    padding: 12px 20px;
    min-height: 44px;
  }

  /* Dossiers tooltip mobile */
  .dossiers-tooltip {
    left: 8px !important;
    right: 8px;
    max-width: none;
  }
}

/* ===== SMALL MOBILE (< 480px) ===== */
@media (max-width: 480px) {
  .app-header {
    height: 52px;
    padding: 0 10px;
  }

  .app-layout {
    margin-top: 52px;
  }

  .sidebar {
    top: 52px;
    height: calc(100vh - 52px);
    width: 260px;
    left: -260px;
  }

  .sidebar-overlay {
    top: 52px;
    height: calc(100vh - 52px);
  }

  .header-logo {
    font-size: 15px;
  }

  .header-actions {
    gap: 4px;
  }

  .header-actions .btn-sm {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* + Ajouter button: icon only on very small screens */
  .header-actions a[href="/upload"] {
    font-size: 0;
    padding: 6px 8px;
    min-width: 34px;
    min-height: 34px;
  }

  .header-actions a[href="/upload"]::before {
    content: '+';
    font-size: 18px;
    font-weight: 700;
  }

  .main-content {
    padding: 12px 10px;
  }

  /* Search bar small mobile */
  .search-bar {
    font-size: 13px;
    padding: 10px 72px 10px 36px;
    border-radius: var(--radius-sm);
  }

  .search-bar-icon {
    left: 12px;
    font-size: 14px;
  }

  .voice-search-btn {
    right: 36px;
    padding: 6px;
  }

  .adv-search-toggle {
    padding: 4px 8px;
    font-size: 12px;
  }

  /* Table card view for mobile */
  .table-container {
    border-radius: var(--radius-sm);
  }

  .table-scroll {
    max-height: none;
  }

  /* Keep table scrollable horizontally on very small screens */
  .data-table {
    min-width: 800px;
  }

  /* Upload mobile small */
  .upload-title {
    font-size: 18px;
  }

  .dropzone {
    padding: 28px 12px;
  }

  .dropzone-icon {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .dropzone-text {
    font-size: 13px;
  }

  .dropzone-subtext {
    font-size: 11px;
  }

  .upload-form {
    padding: 16px;
  }

  .form-input,
  .form-textarea {
    padding: 12px 14px;
    font-size: 14px;
  }

  /* Recap mobile */
  .recap-section {
    padding: 16px;
  }

  .recap-file {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .recap-file-name {
    font-size: 13px;
    word-break: break-all;
  }

  /* Login small mobile */
  .login-card {
    margin: 0 12px;
    padding: 28px 20px;
    border-radius: var(--radius-sm);
  }

  .login-logo h1 {
    font-size: 24px;
  }

  /* Analytics small mobile */
  .analytics-cards {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .analytics-card {
    padding: 12px 10px;
  }

  .analytics-card-value {
    font-size: 20px;
  }

  .analytics-card-label {
    font-size: 11px;
  }

  /* Voice feedback small mobile */
  .voice-feedback {
    font-size: 12px;
    padding: 6px 10px;
  }

  /* Notifications small mobile */
  .notif-dropdown {
    top: 52px;
    left: 4px;
    right: 4px;
  }

  .notif-item {
    padding: 10px 12px;
  }

  .notif-item-title {
    font-size: 12px;
  }

  .notif-item-message {
    font-size: 11px;
  }

  /* Buttons touch target */
  .btn {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 36px;
  }

  /* Pagination small */
  .pagination-bar {
    padding: 10px;
    gap: 8px;
  }

  .pagination-info {
    font-size: 12px;
  }

  .pagination-buttons .btn {
    min-width: 36px;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
  }
}
