/* ══════════════════════════════════════════════════════════════
   PIPELINE MODAL — 10-card consult-only — #9944 PRE-AI 3/10
   ══════════════════════════════════════════════════════════════
   Spec: apps/termont2.com/project-management/pre-ai-support-pipeline/03-ten-card-consult-modal.md

   Cards live inside #dms_pipeline_modal which is rendered server-side
   by class-pipeline-modal.php and injected into #kt_modal_pipeline_steps
   by pipeline-modal.js after the AJAX call.

   Design tokens (M19-M22):
     - Current card:   border 2px solid #0d6efd · shadow drop · scale 1.02 · opacity 1
     - Other cards:    opacity 0.5 · grayscale(0.4)
     - Hover any card: opacity → 1 · transform scale 1.03 · transition 200ms

   Logistik safety (M17/M32):
     - NO Bootstrap .btn-close — we use a custom .dms-pipeline-modal__close
     - NO Bootstrap .badge anywhere
     - z-index above the Logistik header

   Maintainer: Olivier RAVEAU — Oliv.Ai (2026-05-23)
   ══════════════════════════════════════════════════════════════ */

.dms-pipeline-modal {
    /* Float above Logistik sticky header / menus. */
    z-index: 1060;
}
.dms-pipeline-modal__content {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}

/* ─── Header ──────────────────────────────────────────────────── */

.dms-pipeline-modal__header {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.dms-pipeline-modal__title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}
.dms-pipeline-modal__title-icon {
    color: #0d6efd;
}
.dms-pipeline-modal__ticket-ref {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    margin-left: 4px;
}

/* Custom close button — NOT Bootstrap .btn-close (Logistik trap). */
.dms-pipeline-modal__close {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #475569;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.dms-pipeline-modal__close:hover {
    background-color: #fee2e2;
    color: #b91c1c;
    transform: scale(1.06);
}
.dms-pipeline-modal__close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ─── Toolbar ─────────────────────────────────────────────────── */

.dms-pipeline-modal__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 4px 16px;
    flex-wrap: wrap;
}
.dms-pipeline-modal__current-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    border-radius: 999px;
    font-size: 13px;
}
.dms-pipeline-modal__current-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.18);
    animation: dms-pipeline-pulse 1.6s ease-in-out infinite;
}
@keyframes dms-pipeline-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.18); }
    50%      { box-shadow: 0 0 0 6px rgba(13, 110, 253, 0.08); }
}
.dms-pipeline-modal__toolbar-actions {
    display: inline-flex;
    gap: 8px;
}
.dms-pipeline-modal__toolbar-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 150ms ease, border-color 150ms ease;
}
.dms-pipeline-modal__toolbar-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.dms-pipeline-modal__toolbar-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ─── Grid ────────────────────────────────────────────────────── */

.dms-pipeline-modal__grid {
    margin-top: 4px;
}

/* ─── Cards (M19-M24) ─────────────────────────────────────────── */

.dms-pipeline-step-card {
    cursor: pointer;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
    transition:
        opacity 200ms ease,
        transform 200ms ease,
        box-shadow 200ms ease,
        border-color 200ms ease,
        filter 200ms ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Greyed (non-current) state — M21 */
.dms-pipeline-step-card--other {
    opacity: 0.5;
    filter: grayscale(0.4);
}
.dms-pipeline-step-card--other:hover,
.dms-pipeline-step-card--other:focus-within {
    /* Hover — M22 — brings non-current back to full color + tiny scale. */
    opacity: 1;
    filter: grayscale(0);
    transform: scale(1.03);
    border-color: #cbd5e1;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

/* Current step — M20 — strong focus styling. */
.dms-pipeline-step-card--current {
    border: 2px solid #0d6efd;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.22);
    transform: scale(1.02);
    background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 60%);
}
.dms-pipeline-step-card--current:hover {
    transform: scale(1.04);
    box-shadow: 0 12px 32px rgba(13, 110, 253, 0.30);
}

/* Focus visible for keyboard nav */
.dms-pipeline-step-card:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Card header — step number + icon + current-flag */
.dms-pipeline-step-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}
.dms-pipeline-step-card--current .dms-pipeline-step-card__header {
    background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 100%);
    border-bottom-color: #93c5fd;
}
.dms-pipeline-step-card__step-number {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 2px 10px;
    letter-spacing: 0.02em;
}
.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number {
    background: #0d6efd;
    color: #ffffff;
    border-color: #0d6efd;
}
.dms-pipeline-step-card__icon {
    font-size: 18px;
    color: #475569;
    flex: 0 0 auto;
}
.dms-pipeline-step-card--current .dms-pipeline-step-card__icon {
    color: #0d6efd;
}
.dms-pipeline-step-card__current-flag {
    margin-left: auto;
    color: #16a34a;
    font-size: 14px;
}

/* Card body */
.dms-pipeline-step-card__body {
    padding: 12px 14px 14px;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}
.dms-pipeline-step-card__step-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px;
}
.dms-pipeline-step-card__step-description {
    font-size: 12px;
    color: #475569;
    margin: 0 0 10px;
    line-height: 1.45;
    min-height: 34px;
}

/* Expand button at the bottom */
.dms-pipeline-step-card__expand-btn {
    background: transparent;
    border: 1px dashed #cbd5e1;
    color: #2563eb;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.dms-pipeline-step-card__expand-btn:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #93c5fd;
}
.dms-pipeline-step-card__expand-btn-text,
.dms-pipeline-step-card__collapse-btn-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Expanded detail layer (M23/M24) */
.dms-pipeline-step-card__detail {
    background: #f9fafb;
    border-top: 1px dashed #e5e7eb;
    margin: 12px -14px;
    padding: 10px 14px 4px;
    font-size: 11px;
    color: #334155;
}
.dms-pipeline-step-card__detail--open {
    animation: dms-pipeline-card-slide 200ms ease-out;
}
@keyframes dms-pipeline-card-slide {
    0%   { opacity: 0; transform: translateY(-3px); }
    100% { opacity: 1; transform: translateY(0); }
}
.dms-pipeline-step-card__detail-label {
    margin: 6px 0 4px;
    font-size: 11px;
    color: #475569;
}
.dms-pipeline-step-card__detail-label code {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 10px;
    color: #0f172a;
}
.dms-pipeline-step-card__actions {
    margin: 4px 0 8px 18px;
    padding: 0;
    list-style: disc;
}
.dms-pipeline-step-card__actions li {
    margin: 3px 0;
    font-size: 11px;
    line-height: 1.45;
    color: #334155;
}

/* ─── Color tier inheritance from .step-N ─────────────────────── */
/* When a card is the "current" one we tint the step-number pill with
   the same color tier as the .dms-step-circle widget — keeps visual
   continuity between the circle the user clicked and the card opened. */
.dms-pipeline-step-card.step-1.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number,
.dms-pipeline-step-card.step-2.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number,
.dms-pipeline-step-card.step-3.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number {
    background: #dc3545; border-color: #dc3545;
}
.dms-pipeline-step-card.step-4.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number,
.dms-pipeline-step-card.step-5.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number,
.dms-pipeline-step-card.step-6.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number {
    background: #ffc107; border-color: #ffc107; color: #000;
}
.dms-pipeline-step-card.step-7.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number,
.dms-pipeline-step-card.step-8.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number,
.dms-pipeline-step-card.step-9.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number {
    background: #0d6efd; border-color: #0d6efd;
}
.dms-pipeline-step-card.step-10.dms-pipeline-step-card--current .dms-pipeline-step-card__step-number {
    background: #28a745; border-color: #28a745;
}

/* ─── Inline loader fallback (no KTBlockUI on page) ───────────── */
.dms-pipeline-modal__inline-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1080;
    font-size: 13px;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.dms-pipeline-modal__alert {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1080;
    max-width: 480px;
}

/* ─── Responsive tweaks ───────────────────────────────────────── */

@media (max-width: 576px) {
    .dms-pipeline-modal__title { font-size: 16px; }
    .dms-pipeline-modal__toolbar { flex-direction: column; align-items: stretch; }
    .dms-pipeline-modal__current-pill { justify-content: center; }
}
