/*-----------------------------------*\
  analyse.css — Page Analyser
  Rodson_desu
\*-----------------------------------*/

/* ── NAV HEADER ── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: var(--fs-sm);
  font-weight: var(--fw-500);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ── SOURCE TABS ── */
.source-tabs {
  display: flex;
  gap: 4px;
}

.src-tab {
  font-size: var(--fs-xs);
  font-weight: var(--fw-600);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}

.src-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.src-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── DROP ZONE ── */
.drop-zone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drop-zone--image { border-color: hsla(152, 70%, 45%, 0.4); }
.drop-zone--image:hover,
.drop-zone--image.dragover {
  border-color: var(--success);
  background: hsla(152, 70%, 45%, 0.07);
}

.drop-icon {
  color: var(--text-tertiary);
  transition: color var(--transition);
}

.drop-zone:hover .drop-icon,
.drop-zone.dragover .drop-icon { color: var(--accent); }
.drop-zone--image:hover .drop-icon,
.drop-zone--image.dragover .drop-icon { color: var(--success); }

.drop-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-600);
  color: var(--text-primary);
}

.drop-sub {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}

/* ── FILE INFO ── */
.file-info { margin-top: 1rem; }

.file-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.file-icon { font-size: 24px; flex-shrink: 0; }

.file-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.file-name {
  font-size: var(--fs-sm);
  font-weight: var(--fw-500);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.extract-progress {
  margin-top: 8px;
  height: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  width: 0%;
  transition: width 0.4s ease;
  animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ── IMAGE PREVIEW ── */
.image-preview-wrap { margin-top: 1rem; }

.img-preview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-input);
}

.ocr-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* ── EXTRACTED TEXT ── */
.extracted-block {
  margin-top: 1.25rem;
  animation: fadeIn 0.3s ease;
}

.extracted-text {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: var(--fs-sm);
  line-height: 1.75;
  color: var(--text-primary);
  min-height: 100px;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
  outline: none;
}

.extracted-text:focus { border-color: var(--border-focus); }

.extracted-stats {
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-align: right;
}

/* ── ACTION GRID ── */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.action-card {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--transition);
}

.action-card:hover { border-color: var(--border-hover); }

.action-card--wide { grid-column: 1 / -1; }

.action-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.action-icon--blue   { background: var(--accent-light); color: var(--accent); }
.action-icon--green  { background: hsla(152,70%,45%,0.12); color: var(--success); }
.action-icon--amber  { background: hsla(38,95%,54%,0.12);  color: var(--warning); }
.action-icon--purple { background: hsla(260,70%,65%,0.12); color: hsl(260,70%,65%); }

.action-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.action-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-600);
  color: var(--text-primary);
}

.action-desc {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.action-options .select-sm {
  padding: 6px 8px;
  font-size: var(--fs-xs);
  width: 100%;
}

.btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-600);
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
  margin-top: auto;
}

.btn-action:hover         { background: var(--accent-dark); }
.btn-action--green        { background: var(--success); }
.btn-action--green:hover  { background: hsl(152,70%,35%); }
.btn-action--amber        { background: var(--warning); color: hsl(38,60%,15%); }
.btn-action--amber:hover  { background: hsl(38,90%,44%); }
.btn-action--purple       { background: hsl(260,60%,58%); }
.btn-action--purple:hover { background: hsl(260,60%,48%); }
.btn-action:disabled      { opacity: 0.45; cursor: not-allowed; }

.action-question-row {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
}

.action-question-row .ai-input { flex: 1; }
.action-question-row .btn-action { white-space: nowrap; }

/* ── RESULT CARD ── */
.result-card { animation: fadeIn 0.3s ease; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1rem;
}

.result-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-badge {
  font-size: var(--fs-xs);
  font-weight: var(--fw-700);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.result-model {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.result-actions-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── LOADING ── */
.result-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 2rem;
}

.loading-dots {
  display: flex;
  gap: 6px;
}

.loading-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
  40%           { transform: translateY(-8px); opacity: 1; }
}

.loading-label {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* ── RESULT BODY ── */
.result-body {
  font-size: var(--fs-md);
  color: var(--text-primary);
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-body strong { font-weight: var(--fw-600); color: var(--text-primary); }
.result-body em     { font-style: italic; color: var(--text-secondary); }

/* markdown-like table rendu dans le résultat */
.result-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  margin-top: 8px;
}

.result-body th, .result-body td {
  padding: 8px 12px;
  border: 1px solid var(--border-default);
  text-align: left;
}

.result-body th {
  background: var(--bg-input);
  font-weight: var(--fw-600);
  color: var(--text-primary);
}

.result-body tr:hover td { background: var(--bg-hover); }

/* ── HISTORY ITEMS (override) ── */
.history-item .history-action-label {
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ════════════════════════════════════
   RESPONSIVE — analyse.css
   ════════════════════════════════════ */

/* ── Tablette (≤768px) ── */
@media (max-width: 768px) {
  .action-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

  .drop-zone { padding: 2rem 1rem; }

  .result-header { flex-wrap: wrap; gap: 8px; }

  .result-actions-group { flex-wrap: wrap; gap: 6px; }
}

/* ── Mobile large (≤560px) ── */
@media (max-width: 560px) {

  /* SOURCE TABS */
  .source-tabs { gap: 4px; }

  .src-tab {
    font-size: 11px;
    padding: 5px 10px;
    min-height: 32px;
  }

  /* DROP ZONE */
  .drop-zone {
    padding: 1.75rem 1rem;
    gap: 8px;
  }

  .drop-zone .drop-icon svg { width: 32px; height: 32px; }

  .drop-title { font-size: var(--fs-sm); }

  .drop-sub   { font-size: 11px; line-height: 1.4; }

  /* FILE META */
  .file-meta { padding: 10px 12px; gap: 10px; }

  /* IMAGE PREVIEW */
  .img-preview { max-height: 200px; }

  /* EXTRACTED TEXT */
  .extracted-text {
    font-size: 13px;
    max-height: 180px;
    padding: 10px 12px;
  }

  /* ACTIONS */
  .action-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .action-card--wide { grid-column: 1; }

  .action-card { padding: 0.875rem; }

  .action-question-row { flex-direction: column; gap: 8px; }

  .action-question-row .btn-action {
    width: 100%;
    justify-content: center;
  }

  .btn-action {
    padding: 11px 14px;
    min-height: 42px; /* zone de tap confortable */
  }

  /* RESULT */
  .result-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  .result-actions-group { width: 100%; justify-content: flex-start; gap: 6px; }

  .result-actions-group .pill-btn {
    flex: 1;
    text-align: center;
    min-height: 34px;
  }

  .result-body {
    font-size: var(--fs-sm);
    line-height: 1.7;
  }

  .result-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
  }

  /* LOADING */
  .result-loading { padding: 1.5rem; }
}

/* ── Mobile petit (≤380px) ── */
@media (max-width: 380px) {

  .source-tabs { flex-wrap: wrap; gap: 4px; }

  .src-tab { font-size: 10px; padding: 5px 8px; }

  .action-icon { width: 30px; height: 30px; }

  .action-title { font-size: 13px; }

  .action-desc  { font-size: 11px; }

  .result-actions-group { flex-direction: column; }

  .result-actions-group .pill-btn { text-align: center; }
}
