* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Home */
.home-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.home-card {
  width: 100%;
  max-width: 760px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 42px 26px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.home-logo {
  width: 100%;
  max-width: 560px;
  height: 220px;
  object-fit: contain;
}

.home-cta {
  font-size: 1.05em;
  padding: 14px 28px;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  width: 280px;
  background: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 30px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
}

.sidebar-brand-logo {
  width: 100%;
  max-width: 220px;
  height: 96px;
  object-fit: contain;
}

.sidebar-logo {
  font-size: 1.8em;
  color: #667eea;
  font-weight: 700;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 15px 25px;
  color: #555;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05em;
  transition: all 0.3s;
  border-left: 4px solid transparent;
}

.sidebar-link:hover {
  background: #f8f9ff;
  color: #667eea;
  border-left-color: #667eea;
}

.sidebar-link.active {
  background: linear-gradient(90deg, #f8f9ff 0%, #ffffff 100%);
  color: #667eea;
  border-left-color: #667eea;
  font-weight: 600;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
  color: #999;
  font-size: 0.9em;
}

.sidebar-footer p {
  margin: 0;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 40px;
  max-width: calc(100vw - 280px);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: white;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.card h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8em;
}

.alert {
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.form-group input[type="file"] {
  display: block;
  width: 100%;
  padding: 10px;
  border: 2px dashed #667eea;
  border-radius: 8px;
  background: #f8f9ff;
  cursor: pointer;
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: #666;
  font-size: 0.9em;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

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

.btn-danger:hover {
  background: #c82333;
}

.btn-danger:disabled {
  background: #e4606d;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.9em;
}

.info-box {
  background: #f8f9ff;
  padding: 20px;
  border-radius: 8px;
  margin-top: 30px;
  border-left: 4px solid #667eea;
}

.info-box h3 {
  color: #667eea;
  margin-bottom: 15px;
}

.info-box ul {
  list-style: none;
  padding-left: 0;
}

.info-box li {
  padding: 8px 0;
  color: #555;
}

.progress-bar-container {
  position: relative;
  width: 100%;
  height: 40px;
  background: #f0f0f0;
  border-radius: 20px;
  overflow: hidden;
  margin: 20px 0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.5s ease;
  width: 0%;
}

.progress-percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
  color: #333;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.logs-terminal {
  margin-top: 20px;
  border: 1px solid #2d2d2d;
  border-radius: 8px;
  overflow: hidden;
  background: #0b0f14;
}

.logs-terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #121923;
  color: #d8dee9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  border-bottom: 1px solid #2d2d2d;
}

.logs-terminal-hint {
  opacity: 0.7;
  font-weight: normal;
}

.logs-terminal-body {
  margin: 0;
  padding: 12px;
  color: #d8dee9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

.stat-item {
  text-align: center;
  padding: 15px;
  background: #f8f9ff;
  border-radius: 8px;
}

.stat-label {
  display: block;
  font-size: 0.9em;
  color: #666;
  margin-bottom: 5px;
}

.stat-value {
  display: block;
  font-size: 2em;
  font-weight: bold;
  color: #667eea;
}

.stat-total {
  color: #999;
  font-size: 1.2em;
}

.info-message {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.info-message p {
  margin: 5px 0;
  color: #155724;
}

.info-message a {
  color: #0c5460;
  font-weight: bold;
}

.status-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 0.9em;
  font-weight: 600;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-running {
  background: #d1ecf1;
  color: #0c5460;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
}

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

.archives-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  margin: 20px 0;
}

/* Session archives table is wider due to extra columns */
.archives-table.sessions-table {
  min-width: 1350px;
}

/* Column sizing for session archives (keeps headers readable) */
.archives-table.sessions-table th:nth-child(2),
.archives-table.sessions-table td:nth-child(2) {
  min-width: 140px; /* Date */
  white-space: nowrap;
}

.archives-table.sessions-table th:nth-child(7),
.archives-table.sessions-table td:nth-child(7) {
  min-width: 110px; /* Durée */
  white-space: nowrap;
}

.archives-table.sessions-table th:nth-child(8),
.archives-table.sessions-table td:nth-child(8) {
  min-width: 130px; /* Statut */
  white-space: nowrap;
}

.archives-table.sessions-table th:nth-child(9),
.archives-table.sessions-table td:nth-child(9) {
  min-width: 140px;
  text-align: center;
}

.archives-table.sessions-table th:nth-child(10),
.archives-table.sessions-table td:nth-child(10) {
  min-width: 170px;
  text-align: center;
}

.archives-table.sessions-table th:nth-child(11),
.archives-table.sessions-table td:nth-child(11) {
  min-width: 170px;
  text-align: center;
}

.archives-table.sessions-table th:nth-child(12),
.archives-table.sessions-table td:nth-child(12) {
  min-width: 170px;
  text-align: center;
}

.archives-table.sessions-table th:nth-child(13),
.archives-table.sessions-table td:nth-child(13) {
  min-width: 420px;
}

.archives-table th,
.archives-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.archives-table th {
  background: #f8f9ff;
  color: #667eea;
  font-weight: 600;
  white-space: nowrap;
}

/* Allow manual wrapping on selected header cells */
.archives-table th.th-wrap {
  white-space: normal;
  text-align: center;
  line-height: 1.15;
}

.archives-table tr:hover {
  background: #f8f9ff;
}

.actions-cell {
  white-space: nowrap;
}

.actions {
  margin-top: 30px;
  text-align: center;
}

.no-data {
  text-align: center;
  color: #999;
  padding: 40px;
  font-size: 1.1em;
}

.muted {
  color: #888;
  font-size: 0.95em;
}

/* Indexation depth view */
.indexation-table th.depth-col,
.indexation-table td.heat {
  text-align: center;
  white-space: nowrap;
}

.indexation-table tr.total-row td {
  font-weight: 700;
  background: #f8f9ff;
}

.indexation-table td.heat {
  border-left: 1px solid #eef1ff;
  border-right: 1px solid #eef1ff;
}

/* Violet heat variant (used in /profondeur/) */
.indexation-table td.heat.heat-violet {
  border-left: 1px solid #efe6ff;
  border-right: 1px solid #efe6ff;
}

footer {
  background: white;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  color: #666;
  margin-top: 30px;
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
  }

  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 20px;
  }

  .app-container {
    flex-direction: column;
  }

  .progress-stats {
    grid-template-columns: 1fr;
  }

  .sidebar-footer {
    padding: 15px;
  }
}
