/* PRB - Product Readiness Board */

/* === Layout === */
html, body {
    height: 100%;
    margin: 0;
}
body {
    display: flex;
    flex-direction: column;
    background: #f5f6f8;
    font-size: 14px;
    opacity: 1;
    transition: opacity 0.12s ease;
}
body.fade-out { opacity: 0; }

/* === Project Tabs (OneNote style) === */
.project-tabs-container {
    background: #fff;
    border-bottom: 2px solid #dee2e6;
    padding: 0 1rem;
    overflow-x: auto;
    white-space: nowrap;
}
.project-tabs {
    border-bottom: none;
    flex-wrap: nowrap;
}
.project-tab {
    border-radius: 6px 6px 0 0 !important;
    border: 1px solid transparent !important;
    border-bottom: none !important;
    padding: 0.4rem 1rem !important;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.project-tab:hover {
    background: #f0f0f0;
}
.project-tab.active {
    background: #f5f6f8;
    border-color: #dee2e6 !important;
    color: #212529;
    font-weight: 600;
}

/* === Status Dots (Traffic Lights) === */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}
.status-dot-lg {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0,0,0,0.25);
    vertical-align: middle;
}

/* Pulse animation for red (blocked) */
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 4px rgba(220, 53, 69, 0.4); }
    50% { box-shadow: 0 0 12px rgba(220, 53, 69, 0.8); }
}
.status-dot[style*="background: #dc3545"],
.status-dot-lg[style*="background: #dc3545"] {
    animation: pulse-red 2s ease-in-out infinite;
}

/* === Traffic Light Summary Bar === */
.traffic-light-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #e9ecef;
    font-size: 0.8rem;
}

/* === Section Cards === */
/* Bandeau blanc qui cache le contenu qui défile */
.section-card::before {
    content: '';
    position: sticky;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px; /* Hauteur du header */
    background: #f8f9fa;
    z-index: 9; /* Juste en dessous du header */
    display: block;
    margin-bottom: -50px; /* Pour ne pas créer d'espace */
}

.section-card .card-header {
    position: sticky;
    top: 0;
    z-index: 10; /* Au-dessus du bandeau */
    background: #f8f9fa !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Colonnes qui scrollent */
.col-md-3 {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

#mainPanel {
    max-height: none;
    overflow-y: visible;
}

/* === Task Rows === */
.task-row {
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 0;
    font-size: 0.82rem;
    transition: background 0.1s;
    border-bottom: 1px solid #f0f0f0;
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: #f8f9fa; }
.task-row.task-rejected { background: #fff5f5; opacity: 0.7; }
.task-row.task-done { opacity: 0.65; }
.task-row.task-subtask { border-left: 2px solid #dee2e6; margin-left: 4px; padding-left: 8px; }
/* Collapsible deliverable details */
.deliverable-details { overflow: hidden; transition: max-height 0.25s ease; }
.deliverable-details.collapsed { max-height: 0 !important; }
.deliverable-toggle { cursor: pointer; user-select: none; }
.deliverable-toggle .bi-chevron-down { transition: transform 0.2s; }
.deliverable-toggle.collapsed .bi-chevron-down { transform: rotate(-90deg); }
.task-title {
    font-size: 0.82rem;
    line-height: 1.3;
}
.task-checkbox {
    line-height: 1;
    border: none !important;
    background: none !important;
}
.task-checkbox-locked {
    font-size: 0.9rem;
}
.task-delete,
.task-rename {
    opacity: 0;
    transition: opacity 0.15s;
}
.task-row:hover .task-delete,
.task-row:hover .task-rename {
    opacity: 0.5;
}
.task-row:hover .task-delete:hover,
.task-row:hover .task-rename:hover {
    opacity: 1;
}

/* === Deliverable Dot === */
.deliverable-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

/* === Deliverable Actions === */
.deliverable-actions {
    font-size: 0.78rem;
}
.btn-xs {
    padding: 0px 6px;
    font-size: 0.72rem;
    line-height: 1.6;
    border-radius: 3px;
}
.btn-outline-purple {
    color: #6f42c1;
    border-color: #6f42c1;
}
.btn-outline-purple:hover {
    background: #6f42c1;
    color: #fff;
}
.badge-sm {
    font-size: 0.65rem;
    padding: 2px 5px;
    font-weight: 500;
}
.bg-purple {
    background-color: #6f42c1 !important;
}

/* === Parallel Validations === */
.parallel-validations {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

/* === Rejection Reason === */
.rejection-reason {
    font-size: 0.75rem;
    margin-top: 2px;
}

/* === Checklist Items (PREPROD/MEP) === */
.checklist-btn {
    font-size: 0.78rem;
    padding: 2px 10px;
    border-radius: 20px;
}
.checklist-btn.btn-success {
    color: #fff;
}

/* === Add Task === */
.add-task-toggle {
    border-style: dashed;
    font-size: 0.8rem;
}

/* === Dep Icon === */
.dep-icon {
    font-size: 0.85rem;
    margin-top: 2px;
}

/* === Audit Log === */
.audit-log-list {
    max-height: 200px;
    overflow-y: auto;
}
.audit-entry {
    display: flex;
    gap: 8px;
    padding: 2px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.78rem;
}

/* === Split View === */
#splitContainer {
    flex: 1;
    min-height: 0;
}

/* === Progress Bar === */
.progress {
    border-radius: 2px;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* === Responsive === */
@media (max-width: 768px) {
    .project-tabs-container {
        padding: 0 0.5rem;
    }
    .project-tab {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.78rem;
    }
    .traffic-light-summary {
        padding: 3px 8px;
        font-size: 0.75rem;
    }
    .section-card {
        font-size: 0.8rem;
    }
}

/* === Editable title === */
.editable-title {
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s;
}
/* Affordance d'édition uniquement quand le titre est activé via "Renommer" */
.editable-title.editing {
    cursor: text;
    background: #fff3cd;
}
.editable-title.editing:focus {
    outline: 2px solid #0d6efd;
    background: #fff;
}

/* === Highlight animation pour les tâches === */
.task-highlighted {
    animation: highlight-flash 2s ease-in-out;
}

.audit-comment-entry { cursor: pointer; border-radius: 4px; transition: background 0.15s; }
.audit-comment-entry:hover { background: #f0f7ff; }

@keyframes highlight-flash {
    0%, 100% { background: transparent; }
    50% { background: #fff3cd; }
}

/* === Lien cliquable pour DEV #XX === */
.linked-task-ref {
    color: #0d6efd;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.linked-task-ref:hover {
    text-decoration: underline;
}

/* ============================================================================
   Badges Jira
   ============================================================================ */
.jira-link {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s;
    position: relative;
    text-decoration: none !important;
}

.jira-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.jira-link i {
    font-size: 0.7rem;
}

/* Bouton dropdown pour changer le board */
.jira-board-toggle {
    margin-left: 0.25rem;
    cursor: pointer;
    opacity: 0.7;
}

.jira-board-toggle:hover {
    opacity: 1;
}

/* Dropdown pour changer le board */
.jira-board-selector {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 100px;
    margin-top: 2px;
    display: none;
}

.jira-board-selector.show {
    display: block;
}

.jira-board-option {
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.jira-board-option:last-child {
    border-bottom: none;
}

.jira-board-option:hover {
    background: #f0f0f0;
}

.jira-board-option.selected {
    background: #e3f2fd;
    font-weight: bold;
}

.jira-board-option.selected::before {
    content: "✓ ";
    margin-right: 0.25rem;
}

/* Badges ServiceNow */
.snow-link {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.2rem;
    transition: all 0.2s;
}

.snow-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Champs éditables */
.editable-field {
    cursor: text;
    padding: 0.1rem 0.3rem;
    border-radius: 0.2rem;
    transition: background 0.2s;
}

.editable-field:hover {
    background: rgba(0,0,0,0.05);
}

.editable-field:focus {
    outline: 1px solid #007bff;
    background: #fff;
}

/* Placeholder pour contenteditable */
.editable-field:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
    opacity: 0.6;
}

.editable-field:focus:empty:before {
    content: attr(data-placeholder);
    opacity: 0.4;
}

/* Tooltips Bootstrap personnalisés */
.tooltip-inner {
    background-color: #2c3e50;
    color: white;
    font-size: 0.85rem;
    padding: 8px 14px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    max-width: 350px;
    text-align: left;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #2c3e50;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #2c3e50;
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
    border-left-color: #2c3e50;
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
    border-right-color: #2c3e50;
}

/* Container avec scroll vertical */
#mainPanel {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Chevron rotation for collapsible sections */
.bi-chevron-down.rotated { transform: rotate(-90deg); }

/* ============================================================================
   Confort mobile — ajouts responsive (audit 2026-07-27)
   ============================================================================ */
@media (max-width: 768px) {
    /* Cibles tactiles : les mini-boutons de réordonnancement (chevrons) et
       autres actions ponctuelles restent visuellement identiques mais gagnent
       une zone de tap plus large et facile à viser au doigt. */
    .btn-sm.p-0,
    .template-row .btn,
    .cfg-card .btn-sm {
        min-height: 32px;
        min-width: 28px;
    }

    /* Filet de sécurité : toute table Bootstrap non déjà encapsulée peut
       défiler horizontalement dans son conteneur plutôt que d'élargir la page. */
    .card-body > .table:not(.table-responsive .table) {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Le contenu principal reprend toute la hauteur utile sur mobile. */
    #mainPanel {
        max-height: none;
    }

    /* Padding de page réduit pour gagner de la largeur utile. */
    .container-fluid.px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* Menu replié (burger) : espacement lisible des liens empilés. */
@media (max-width: 991.98px) {
    .navbar .navbar-nav .nav-link { padding-left: 0.25rem; }
    .navbar .navbar-collapse { padding-bottom: 0.4rem; }
}

/* ============================================================================
   Réordonnancement des tâches (drag & drop)
   ============================================================================ */
.task-drag-handle {
    cursor: grab;
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    line-height: 1;
    padding: 2px 1px;
    touch-action: none;          /* le handle capte le geste, pas le scroll */
    flex: 0 0 auto;
    align-self: center;
}
.task-drag-handle:hover { color: #64748b; }
.task-row.dragging {
    opacity: 0.5;
    background: #eef2ff !important;
}
.task-drop-placeholder {
    height: 3px;
    background: #6366f1;
    border-radius: 2px;
    margin: 3px 0;
    box-shadow: 0 0 0 1px rgba(99,102,241,0.3);
}
/* Pendant un réordonnancement, on empêche la sélection de texte parasite. */
body.task-reordering { user-select: none; -webkit-user-select: none; }

@media (max-width: 768px) {
    /* Cible tactile plus large pour le handle sur mobile. */
    .task-drag-handle { font-size: 1.05rem; padding: 6px 4px; }
}

/* ============================================================================
   Rich task — corps (markdown léger), checklist inline, références externes.
   Purement additif : n'affecte que les .task-row portant du contenu rich.
   ============================================================================ */
.rich-task {
    margin-left: 0.15rem;
    padding-left: 0.55rem;
    border-left: 2px solid #ede9fe;      /* liseré violet très clair */
}
.rich-task-bar {
    min-height: 1.1rem;
}
.rich-edit-toggle {
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.rich-edit-toggle:hover { color: #6f42c1 !important; }
.rich-edit-toggle.has-body .rich-toggle-ico { color: #6f42c1; }

/* Task SANS corps : le bouton "Ajouter un corps" se comporte comme le crayon
   d'édition de titre — masqué au repos, révélé au survol de la ligne.
   Une task AVEC corps garde "Modifier le corps" toujours visible (pas .rich-toggle-hover). */
.rich-toggle-hover {
    opacity: 0;
    transition: opacity 0.15s;
}
.task-row:hover .rich-toggle-hover {
    opacity: 0.6;
}
.task-row:hover .rich-toggle-hover:hover {
    opacity: 1;
}

/* --- Corps rendu -------------------------------------------------------- */
.rich-body {
    font-size: 0.79rem;
    color: #374151;
    line-height: 1.45;
}
.rich-body .rt-p        { margin: 0.15rem 0; }
.rich-body .rt-h        { font-weight: 600; color: #4b5563; margin: 0.35rem 0 0.15rem; line-height: 1.3; }
/* Capper explicitement TOUTES les tailles de titre : sans ça, # → h3 et ## → h4
   retombent sur la taille par défaut du navigateur (≈1.5em) → titres énormes. */
.rich-body h3.rt-h      { font-size: 0.98rem; }
.rich-body h4.rt-h      { font-size: 0.9rem; }
.rich-body h5.rt-h      { font-size: 0.9rem; }
.rich-body h6.rt-h      { font-size: 0.82rem; }
/* Contexte spec (fonctionnelle/technique) : échelle encore plus sobre — c'est un
   objet de spécification, pas un pavé qui doit dominer la colonne. */
.rich-task[data-context="spec_fonc"] .rich-body,
.rich-task[data-context="spec_tech"] .rich-body { font-size: 0.75rem; }
.rich-task[data-context="spec_fonc"] .rich-body .rt-h,
.rich-task[data-context="spec_tech"] .rich-body .rt-h { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; color: #6b7280; }
.rich-body .rt-ul       { margin: 0.15rem 0 0.15rem 0.2rem; padding-left: 1rem; }
.rich-body .rt-ul li    { margin: 0.05rem 0; }
.rich-body .rt-quote    {
    border-left: 3px solid #d1d5db;
    padding: 0.1rem 0.5rem;
    margin: 0.2rem 0;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 0 4px 4px 0;
}
.rich-body .rt-code {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 0 4px;
    font-size: 0.72rem;
    color: #6f42c1;
}
.rich-body .rt-link { color: #3b82f6; text-decoration: none; }
.rich-body .rt-link:hover { text-decoration: underline; }

/* --- Checklist (lecture + édition) ------------------------------------- */
.rich-checklist li,
.rich-checklist-edit li { margin: 0.1rem 0; }
.rich-check-label { font-size: 0.78rem; }
.rich-check-box { cursor: pointer; }
.rich-edit-item .rich-check-drag { touch-action: none; }
.rich-edit-item.dragging { background: #f5f3ff; border-radius: 4px; }

/* --- Références externes ------------------------------------------------ */
.rich-refs .rich-ref,
.rich-refs-edit .rich-ref-chip {
    font-size: 0.62rem;
    font-weight: 500;
    padding: 2px 6px;
}
.rich-refs .rich-ref:hover { border-color: #6f42c1 !important; color: #6f42c1 !important; }

/* --- Éditeur ------------------------------------------------------------ */
.rich-edit {
    background: #fbfaff;
    border: 1px solid #ede9fe;
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    margin-top: 0.35rem;
}
.rich-edit .form-label { font-weight: 500; }
.rich-body-input { resize: vertical; }

@media (max-width: 768px) {
    .rich-edit-item .rich-check-drag { padding: 4px 2px; font-size: 1rem; }
}
