/* ============================================
   Suivi Manuscrit - Page Styles
   ============================================ */

/* --- Page Layout --- */
.suivi-page {
    padding-top: 120px;
    padding-bottom: 3rem;
}

/* --- Horizontal Stepper --- */
.stepper-container {
    overflow-x: auto;
    padding: 20px 0;
    margin-bottom: 2rem;
    -webkit-overflow-scrolling: touch;
}
.stepper-container::-webkit-scrollbar {
    height: 6px;
}
.stepper-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.stepper {
    display: flex;
    align-items: flex-start;
    min-width: max-content;
    padding: 0 10px;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: 100px;
    cursor: pointer;
    transition: transform 0.2s;
}
.stepper-step:hover {
    transform: translateY(-2px);
}

.stepper-step .step-connector {
    position: absolute;
    top: 18px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: #dee2e6;
    z-index: 0;
}
.stepper-step:last-child .step-connector {
    display: none;
}
.stepper-step.completed .step-connector {
    background: #198754;
}
.stepper-step.current .step-connector {
    background: linear-gradient(to right, #0d6efd 50%, #dee2e6 50%);
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    z-index: 1;
    transition: all 0.3s;
    border: 3px solid #dee2e6;
    background: white;
    color: #6c757d;
}
.stepper-step.completed .step-circle {
    background: #198754;
    border-color: #198754;
    color: white;
}
.stepper-step.current .step-circle {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25);
    animation: stepPulse 2s infinite;
}

@keyframes stepPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25); }
    50% { box-shadow: 0 0 0 8px rgba(13, 110, 253, 0.1); }
}

.step-label {
    margin-top: 8px;
    font-size: 0.7rem;
    text-align: center;
    max-width: 90px;
    color: #6c757d;
    line-height: 1.2;
    word-wrap: break-word;
}
.stepper-step.completed .step-label {
    color: #198754;
    font-weight: 600;
}
.stepper-step.current .step-label {
    color: #0d6efd;
    font-weight: 700;
}

/* --- Stats Cards --- */
.stat-card {
    text-align: center;
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.3rem;
}
.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Progress circle */
.progress-ring {
    width: 70px;
    height: 70px;
    margin: 0 auto 8px;
    position: relative;
}
.progress-ring svg {
    transform: rotate(-90deg);
}
.progress-ring .ring-bg {
    fill: none;
    stroke: #e9ecef;
    stroke-width: 6;
}
.progress-ring .ring-fill {
    fill: none;
    stroke: #198754;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}
.progress-ring .ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    font-weight: 700;
    color: #198754;
}

/* --- View Tabs --- */
.view-tabs {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1.5rem;
}
.view-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    font-weight: 600;
    padding: 12px 20px;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.view-tabs .nav-link:hover {
    color: #0d6efd;
    border-bottom-color: rgba(13, 110, 253, 0.3);
}
.view-tabs .nav-link.active {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
    background: transparent;
}

/* --- Checklist Accordion --- */
.etape-accordion .accordion-item {
    border: 1px solid #e9ecef;
    border-radius: 10px !important;
    margin-bottom: 12px;
    overflow: hidden;
}
.etape-accordion .accordion-button {
    font-weight: 600;
    padding: 16px 20px;
    background: #f8f9fa;
}
.etape-accordion .accordion-button:not(.collapsed) {
    background: #e8f4fd;
    color: #0d6efd;
    box-shadow: none;
}
.etape-accordion .accordion-button .etape-progress {
    width: 120px;
    height: 8px;
    border-radius: 4px;
    margin-left: auto;
    margin-right: 15px;
}
.etape-accordion .accordion-button .etape-percent {
    font-size: 0.85rem;
    min-width: 45px;
    text-align: right;
}

.etape-accordion .accordion-item.is-current {
    border-color: #0d6efd;
    border-width: 2px;
}
.etape-accordion .accordion-item.is-current .accordion-button {
    background: #e8f4fd;
}
.etape-accordion .accordion-item.is-completed {
    border-color: #198754;
}
.etape-accordion .accordion-item.is-completed .accordion-button {
    background: #e8f8ee;
}

/* Checklist items */
.checklist-row {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    gap: 12px;
}
.checklist-row:last-child {
    border-bottom: none;
}
.checklist-row:hover {
    background: #f8f9fa;
}
.checklist-row.is-done {
    opacity: 0.65;
}
.checklist-row.is-done .checklist-title {
    text-decoration: line-through;
}

.checklist-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #ced4da;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    background: white;
}
.checklist-checkbox:hover {
    border-color: #0d6efd;
    background: #e8f4fd;
}
.checklist-checkbox.checked {
    background: #198754;
    border-color: #198754;
    color: white;
}

.checklist-info {
    flex: 1;
    min-width: 0;
}
.checklist-title {
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 2px;
}
.checklist-desc {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
}
.checklist-meta {
    font-size: 0.75rem;
    color: #198754;
    margin-top: 4px;
}

.checklist-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.status-select {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
}

.badge-obligatoire {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: #dc3545;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Notes inline */
.checklist-notes {
    margin-top: 6px;
    padding: 6px 10px;
    background: #fff3cd;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #664d03;
}
.notes-input {
    font-size: 0.8rem;
    border-radius: 6px;
    resize: none;
}

/* --- Kanban Board --- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    min-height: 400px;
}

@media (max-width: 992px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 576px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

.kanban-column {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    min-height: 300px;
}
.kanban-column-header {
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.kanban-column-header .count {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0,0,0,0.1);
}

.kanban-column.col-todo .kanban-column-header { background: #e2e3e5; color: #41464b; }
.kanban-column.col-progress .kanban-column-header { background: #cfe2ff; color: #084298; }
.kanban-column.col-done .kanban-column-header { background: #d1e7dd; color: #0f5132; }
.kanban-column.col-blocked .kanban-column-header { background: #f8d7da; color: #842029; }

.kanban-card {
    background: white;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 3px solid transparent;
    transition: box-shadow 0.2s;
    cursor: default;
}
.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.kanban-card .card-step {
    font-size: 0.65rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.kanban-card .card-title-text {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.kanban-column.col-todo .kanban-card { border-left-color: #6c757d; }
.kanban-column.col-progress .kanban-card { border-left-color: #0d6efd; }
.kanban-column.col-done .kanban-card { border-left-color: #198754; }
.kanban-column.col-blocked .kanban-card { border-left-color: #dc3545; }

/* --- Timeline (Historique) --- */
.timeline-container {
    position: relative;
    padding-left: 40px;
}
.timeline-container::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, #0d6efd, #dee2e6);
    border-radius: 2px;
}

.timeline-entry {
    position: relative;
    padding-bottom: 24px;
}
.timeline-entry:last-child {
    padding-bottom: 0;
}
.timeline-entry .timeline-dot {
    position: absolute;
    left: -30px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0d6efd;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #0d6efd;
}
.timeline-entry .timeline-content {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e9ecef;
}
.timeline-entry .timeline-date {
    font-size: 0.75rem;
    color: #6c757d;
}
.timeline-entry .timeline-user {
    font-weight: 600;
    color: #212529;
}

/* --- Alerts Section --- */
.alert-deadline {
    border-left: 4px solid #ffc107;
    background: #fff8e1;
    border-radius: 0 8px 8px 0;
}
.alert-overdue {
    border-left: 4px solid #dc3545;
    background: #fff5f5;
    border-radius: 0 8px 8px 0;
}

/* --- Header Actions --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.page-header .manuscript-title {
    color: #6c757d;
    font-size: 1rem;
}
.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* --- Step Change Section --- */
.step-change-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.step-change-bar .current-step-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.step-change-bar .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}
.step-change-bar .step-name {
    font-weight: 600;
    font-size: 1.1rem;
}
.step-change-bar .step-nav-buttons {
    display: flex;
    gap: 8px;
}

/* --- Loading / Spinner --- */
.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
    display: none;
}
.is-loading .spinner-overlay {
    display: flex;
}

/* --- Toast Notification --- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* --- Print Styles --- */
@media print {
    .suivi-page { padding-top: 0; }
    .header-actions,
    .step-change-bar .step-nav-buttons,
    .checklist-actions,
    .view-tabs,
    nav, footer,
    .btn { display: none !important; }

    .kanban-board { display: none !important; }

    .accordion-collapse { display: block !important; height: auto !important; }
    .accordion-button::after { display: none; }

    .stat-card { box-shadow: none; border: 1px solid #dee2e6; }

    .stepper-step.current .step-circle { box-shadow: none; animation: none; }

    body { font-size: 12px; }
    h1 { font-size: 1.3rem; }
}
