/* ══════════════════════════════════════════════════════════════
   Carboneum v5.1 — style-ai.css
   Styles spécifiques au module IA — Rampe Vert Carbone
   ══════════════════════════════════════════════════════════════ */

/* ─── AI RESULT CARDS ────────────────────────────────────────── */
.ai-result-card {
  background: var(--bg-1);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 1rem 1.1rem;
  margin-bottom: .6rem;
  transition: var(--tr);
}

.ai-result-card:hover {
  border-color: var(--c-200);
  box-shadow: var(--shadow-sm);
}

.ai-result-card-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

.ai-result-card-header .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.ai-result-card-header .dot.success { background: var(--c-400); }
.ai-result-card-header .dot.warning { background: var(--amber); }
.ai-result-card-header .dot.error { background: var(--rose); }
.ai-result-card-header .dot.info { background: var(--sky); }

.ai-result-card-title {
  font-weight: 600;
  font-size: .88rem;
  color: var(--txt);
}

.ai-result-card-body {
  font-size: .85rem;
  color: var(--txt-2);
  line-height: 1.5;
}

/* ─── AI METRICS GRID ────────────────────────────────────────── */
.ai-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin: 1rem 0;
}

.ai-metric {
  background: var(--bg-1);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  padding: .9rem;
  text-align: center;
  transition: var(--tr);
}

.ai-metric:hover {
  border-color: var(--c-200);
  box-shadow: var(--shadow-sm);
}

.ai-metric-value {
  font-family: var(--fm);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.ai-metric-label {
  font-size: .75rem;
  color: var(--txt-3);
  margin-top: .25rem;
  font-weight: 500;
}

.ai-metric-delta {
  font-size: .72rem;
  font-weight: 600;
  margin-top: .15rem;
}

.ai-metric-delta.pos { color: var(--c-500); }
.ai-metric-delta.neg { color: var(--rose); }

/* ─── AI PROGRESS RING ───────────────────────────────────────── */
.ai-progress-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.ai-progress-ring svg {
  transform: rotate(-90deg);
}

.ai-progress-ring-bg {
  fill: none;
  stroke: var(--bg-5);
  stroke-width: 10;
}

.ai-progress-ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset .8s ease;
}

.ai-progress-ring-text {
  font-family: var(--fm);
  font-size: 22px;
  font-weight: 700;
  fill: var(--primary);
}

/* ─── AI BADGE ───────────────────────────────────────────────── */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .55rem;
  background: linear-gradient(135deg, var(--c-400), var(--c-500));
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 4px;
  letter-spacing: .02em;
}

/* ─── AI STREAMING CURSOR ────────────────────────────────────── */
.ai-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--primary);
  animation: ai-blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

@keyframes ai-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ─── AI TOOLTIP ───────────────────────────────────────────── */
.ai-tooltip {
  position: relative;
  display: inline-block;
}

.ai-tooltip .ai-tooltip-text {
  visibility: hidden;
  background: var(--c-600);
  color: #fff;
  font-size: .75rem;
  padding: .4rem .7rem;
  border-radius: var(--r-sm);
  position: absolute;
  z-index: 100;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s;
  box-shadow: var(--shadow);
}

.ai-tooltip:hover .ai-tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ─── AI DIVIDER ─────────────────────────────────────────────── */
.ai-divider {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 1rem 0;
  color: var(--txt-3);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.ai-divider::before,
.ai-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── AI SECTION HEADER ──────────────────────────────────────── */
.ai-section-hd {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .8rem;
  background: var(--bg-3);
  border-radius: var(--r-sm);
  margin-bottom: .75rem;
  border-left: 3px solid var(--primary);
}

.ai-section-hd i {
  color: var(--primary);
  flex-shrink: 0;
}

.ai-section-hd span {
  font-weight: 600;
  font-size: .88rem;
  color: var(--txt);
}

/* ─── AI CODE BLOCK ──────────────────────────────────────────── */
.ai-code-block {
  background: var(--c-600);
  color: var(--c-100);
  padding: .8rem 1rem;
  border-radius: var(--r-sm);
  font-family: var(--fm);
  font-size: .82rem;
  line-height: 1.5;
  overflow-x: auto;
  margin: .5rem 0;
}

.ai-code-block .comment { color: var(--c-200); opacity: .7; }
.ai-code-block .keyword { color: var(--c-300); }
.ai-code-block .string { color: #86EFBB; }
.ai-code-block .number { color: var(--c-100); }

/* ─── AI TABLE ───────────────────────────────────────────────── */
.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  margin: .5rem 0;
}

.ai-table th {
  text-align: left;
  padding: .5rem .7rem;
  font-weight: 600;
  color: var(--txt-2);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 2px solid var(--border);
  background: var(--bg-2);
}

.ai-table td {
  padding: .45rem .7rem;
  border-bottom: 1px solid var(--border-2);
  color: var(--txt);
}

.ai-table tr:hover td {
  background: var(--bg-3);
}

/* ─── AI ALERT BOXES ─────────────────────────────────────────── */
.ai-alert {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .8rem 1rem;
  border-radius: var(--r-sm);
  margin: .5rem 0;
  font-size: .85rem;
  line-height: 1.5;
}

.ai-alert.info {
  background: rgba(14, 165, 233, .08);
  border: 1.5px solid rgba(14, 165, 233, .2);
  color: #0369a1;
}

.ai-alert.success {
  background: rgba(29, 185, 122, .08);
  border: 1.5px solid rgba(29, 185, 122, .2);
  color: var(--c-500);
}

.ai-alert.warning {
  background: rgba(217, 119, 6, .08);
  border: 1.5px solid rgba(217, 119, 6, .2);
  color: #92400e;
}

.ai-alert.error {
  background: rgba(220, 38, 38, .08);
  border: 1.5px solid rgba(220, 38, 38, .2);
  color: #991b1b;
}

.ai-alert i {
  flex-shrink: 0;
  margin-top: .15rem;
}

/* ─── AI LOADING SKELETON ───────────────────────────────────── */
.ai-skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: ai-skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}

@keyframes ai-skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── AI ANIMATED GRADIENT BORDER ────────────────────────────── */
.ai-gradient-border {
  position: relative;
  background: var(--bg-1);
  border-radius: var(--r-md);
  padding: 1px;
}

.ai-gradient-border::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: calc(var(--r-md) + 1.5px);
  background: linear-gradient(135deg, var(--c-300), var(--c-400), var(--c-500));
  z-index: -1;
  opacity: .6;
  animation: ai-gradient-rotate 3s linear infinite;
  background-size: 200% 200%;
}

@keyframes ai-gradient-rotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ─── AI PULSE DOT ─────────────────────────────────────────────── */
.ai-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  position: relative;
}

.ai-pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--primary);
  opacity: .3;
  animation: ai-pulse-ring 2s ease-out infinite;
}

@keyframes ai-pulse-ring {
  0% { transform: scale(1); opacity: .3; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ─── AI TAGS / LABELS ───────────────────────────────────────── */
.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .5rem;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
}

.ai-tag.primary {
  background: rgba(29, 185, 122, .12);
  color: var(--c-500);
}

.ai-tag.secondary {
  background: rgba(14, 165, 233, .1);
  color: #0369a1;
}

.ai-tag.tertiary {
  background: var(--bg-2);
  color: var(--txt-3);
}

/* ─── AI FOOTER ──────────────────────────────────────────────── */
.ai-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .8rem;
  background: var(--bg-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
  border-top: 1.5px solid var(--border-2);
  font-size: .75rem;
  color: var(--txt-3);
}

/* ─── AI QUICK ACTIONS ─────────────────────────────────────────── */
.ai-quick-actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  padding: .5rem 0;
}

.ai-quick-action {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .7rem;
  background: var(--bg-1);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: .8rem;
  color: var(--txt-2);
  cursor: pointer;
  transition: var(--tr);
  font-weight: 500;
}

.ai-quick-action:hover {
  background: var(--c-50);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.ai-quick-action i {
  font-size: .85rem;
  color: var(--primary);
}

/* ─── RESPONSIVE AI ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .ai-metrics {
    grid-template-columns: repeat(2, 1fr);
  }