/* frontend/timeline.css - Styles de la frise chronologique du cursus et mise en page d'impression */

/* Horizontal Timeline Styles */
#cursus-timeline-wrapper {
    scrollbar-width: thin;
    scrollbar-color: rgba(167, 139, 250, 0.4) transparent;
}

#cursus-timeline-wrapper::-webkit-scrollbar {
    height: 6px;
}

#cursus-timeline-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

#cursus-timeline-wrapper::-webkit-scrollbar-thumb {
    background: rgba(167, 139, 250, 0.3);
    border-radius: 3px;
}

#cursus-timeline-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(167, 139, 250, 0.6);
}

/* 3 Degree Guide Rails in Background */
.timeline-degree-rail {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    pointer-events: none;
    z-index: 1;
}

.timeline-degree-rail.rail-degre-3 {
    top: 80px;
    border-top-color: rgba(251, 191, 36, 0.22);
}

.timeline-degree-rail.rail-degre-2 {
    top: 200px;
    border-top-color: rgba(192, 132, 252, 0.18);
}

.timeline-degree-rail.rail-degre-1 {
    top: 320px;
    border-top-color: rgba(56, 189, 248, 0.18);
}

.timeline-rail-label {
    position: sticky;
    left: 10px;
    display: inline-block;
    transform: translateY(-50%);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 8px;
    border-radius: 6px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
    z-index: 3;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.timeline-rail-label.label-degre-3 {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.timeline-rail-label.label-degre-2 {
    color: #c084fc;
    background: rgba(192, 132, 252, 0.12);
    border: 1px solid rgba(192, 132, 252, 0.3);
}

.timeline-rail-label.label-degre-1 {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Timeline Milestone Items */
.timeline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 4;
}

.timeline-item:hover {
    z-index: 25;
}

/* Timeline Dot - Exact 16x16 centering directly on SVG line coordinates */
.timeline-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0f172a;
    border: 3px solid #38bdf8;
    box-sizing: border-box;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    position: absolute;
    top: 0;
    left: 0;
}

/* Tooltip Container */
.timeline-tooltip {
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 10.5px;
    text-align: center;
    width: auto;
    min-width: 120px;
    max-width: 155px;
    min-height: 44px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    pointer-events: auto;
    white-space: normal;
}

/* Tooltip Position: Placed above or below the dot cleanly */
.timeline-item.tooltip-top .timeline-tooltip {
    bottom: 20px;
    top: auto;
    transform: translateY(0);
}

.timeline-item.tooltip-top:hover .timeline-tooltip {
    transform: translateY(-4px) scale(1.03);
    border-color: var(--accent-color);
    box-shadow: 0 10px 25px rgba(167, 139, 250, 0.4);
}

.timeline-item.tooltip-bottom .timeline-tooltip {
    top: 20px;
    bottom: auto;
    transform: translateY(0);
}

.timeline-item.tooltip-bottom:hover .timeline-tooltip {
    transform: translateY(4px) scale(1.03);
    border-color: var(--accent-color);
    box-shadow: 0 10px 25px rgba(167, 139, 250, 0.4);
}

/* Staggered offsets (only when explicitly needed) */

.timeline-item.stagger-up.tooltip-top .timeline-tooltip {
    bottom: 34px;
}

.timeline-item.stagger-down.tooltip-bottom .timeline-tooltip {
    top: 34px;
}

/* Vertical guide connector line from dot to tooltip */
.timeline-item.tooltip-top::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 14px;
    border-left: 1px dashed rgba(167, 139, 250, 0.3);
    pointer-events: none;
}

.timeline-item.stagger-up.tooltip-top::before {
    height: 26px;
}

.timeline-item.tooltip-bottom::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 14px;
    border-left: 1px dashed rgba(167, 139, 250, 0.3);
    pointer-events: none;
}

.timeline-item.stagger-down.tooltip-bottom::before {
    height: 26px;
}



.timeline-item:hover .timeline-dot {
    transform: scale(1.35);
    box-shadow: 0 0 14px currentColor, 0 0 26px rgba(167, 139, 250, 0.6);
}

/* Dot Types & Degree-specific Glows */
.timeline-item.type-role .timeline-dot {
    border-color: #a78bfa;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.4);
}

.timeline-item.type-promotion .timeline-dot {
    background: #fbbf24;
    border-color: #fef08a;
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.8), 0 0 24px rgba(251, 191, 36, 0.4);
}

.timeline-item.type-planche.degre-1 .timeline-dot {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.timeline-item.type-planche.degre-2 .timeline-dot {
    border-color: #c084fc;
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.6);
}

.timeline-item.type-planche.degre-3 .timeline-dot {
    border-color: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

.timeline-item.type-presentation .timeline-dot {
    border-color: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

.timeline-item.type-role_end .timeline-dot {
    border-color: #fb7185;
    box-shadow: 0 0 8px rgba(251, 113, 133, 0.5);
}

/* Date Label */
.timeline-date {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    white-space: nowrap;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 6;
}

.timeline-item.tooltip-top .timeline-date {
    top: 22px;
    bottom: auto;
}

.timeline-item.tooltip-bottom .timeline-date {
    bottom: 22px;
    top: auto;
}

.timeline-item:hover .timeline-date {
    color: #fff;
    background: rgba(15, 23, 42, 0.95);
}

/* Tooltip Content Elements */
.timeline-type {
    font-size: 8px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

/* Planche Degree Badges */
.badge-planche-degre {
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 4px;
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-degre-1 {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.badge-degre-2 {
    background: rgba(192, 132, 252, 0.15);
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.4);
}

.badge-degre-3 {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.4);
}

.badge-promotion {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

.timeline-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1px;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    font-size: 11px;
}

/* Officer Period Frames */
.timeline-role-frame {
    position: absolute;
    top: 20px;
    bottom: 20px;
    height: 320px;
    border: 1px dashed rgba(167, 139, 250, 0.22);
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.03) 0%, rgba(167, 139, 250, 0.01) 100%);
    border-radius: 16px;
    z-index: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.role-frame-watermark {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.08);
    text-align: left;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.role-frame-footer {
    display: flex;
    align-items: flex-end;
    width: 100%;
}

.role-frame-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
    width: 100%;
}

.role-frame-title {
    font-size: 11px;
    font-weight: 800;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.role-frame-period {
    font-size: 9.5px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 2px;
}

/* Print Styles: Impression verticale élégante en format A4 Portrait */
#print-timeline-area {
    display: none;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 14mm 16mm 14mm 16mm;
    }

    /* Standardiser la restitution des couleurs d'impression */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    :root {
        --bg-color: #ffffff !important;
        --card-bg: #ffffff !important;
        --text-primary: #0f172a !important;
        --text-secondary: #475569 !important;
    }

    html, body {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        background: #ffffff !important;
        color: #0f172a !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    }

    /* Masquer l'ensemble des éléments de l'interface écran */
    .orb,
    #auth-layout,
    #unauth-layout,
    .menu-toggle,
    #sidebar,
    #sidebar-overlay,
    .header-bar,
    #profile-view,
    .card,
    #btn-timeline-scroll-left,
    #btn-timeline-scroll-right,
    #btn-print-cursus {
        display: none !important;
    }

    /* Zone d'impression verticale */
    #print-timeline-area {
        display: block !important;
        width: 100% !important;
        max-width: 720px !important;
        margin: 0 auto !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #0f172a !important;
    }

    /* En-tête du document officiel */
    .print-header {
        margin-bottom: 24px !important;
        padding-bottom: 12px !important;
        border-bottom: 2.5px solid #1e1b4b !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    .print-header-inner {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-end !important;
    }

    .print-doc-title {
        font-size: 20px !important;
        font-weight: 800 !important;
        color: #1e1b4b !important;
        margin: 0 0 4px 0 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.8px !important;
    }

    .print-doc-subtitle {
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #4338ca !important;
        margin: 0 !important;
    }

    .print-doc-meta {
        font-size: 10px !important;
        color: #64748b !important;
        font-weight: 600 !important;
        text-align: right !important;
    }

    /* Flux vertical */
    .print-vertical-flow {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
    }

    /* Carte d'élément individuel (anti-coupure de page) */
    .print-vertical-item {
        display: flex !important;
        align-items: stretch !important;
        width: 100% !important;
        border-radius: 10px !important;
        background: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        overflow: hidden !important;
        box-shadow: none !important;
    }

    /* Variantes selon le type d'événement */
    .print-vertical-item.cat-promotion {
        background: #fffbeb !important;
        border: 1.5px solid #f59e0b !important;
    }

    .print-vertical-item.cat-officer {
        background: #f5f3ff !important;
        border: 1.5px solid #818cf8 !important;
    }

    .print-vertical-item.cat-planche {
        background: #f0f9ff !important;
        border: 1px solid #bae6fd !important;
    }

    /* Colonne gauche (Date + Icône) */
    .print-item-marker {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 135px !important;
        min-width: 135px !important;
        padding: 10px 8px !important;
        background: rgba(15, 23, 42, 0.04) !important;
        border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
        box-sizing: border-box !important;
    }

    .print-marker-icon {
        font-size: 18px !important;
        line-height: 1 !important;
        margin-bottom: 4px !important;
    }

    .cat-promotion .print-marker-icon {
        color: #d97706 !important;
    }

    .cat-officer .print-marker-icon {
        color: #6366f1 !important;
    }

    .cat-planche .print-marker-icon {
        color: #0284c7 !important;
    }

    .print-item-date {
        font-size: 10.5px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        text-align: center !important;
        line-height: 1.25 !important;
    }

    /* Corps de la carte */
    .print-item-body {
        padding: 10px 16px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        flex-grow: 1 !important;
        min-width: 0 !important;
    }

    .print-item-badges {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin-bottom: 4px !important;
        flex-wrap: wrap !important;
    }

    .print-type-badge {
        font-size: 9px !important;
        font-weight: 800 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        color: #475569 !important;
    }

    .print-degre-badge {
        font-size: 8.5px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        padding: 2px 7px !important;
        border-radius: 4px !important;
    }

    .print-degre-badge.badge-degre-1 {
        background: #e0f2fe !important;
        color: #0369a1 !important;
        border: 1px solid #7dd3fc !important;
    }

    .print-degre-badge.badge-degre-2 {
        background: #f3e8ff !important;
        color: #7e22ce !important;
        border: 1px solid #d8b4fe !important;
    }

    .print-degre-badge.badge-degre-3 {
        background: #fef3c7 !important;
        color: #b45309 !important;
        border: 1px solid #fde68a !important;
    }

    .print-degre-badge.badge-officier {
        background: #ede9fe !important;
        color: #5b21b6 !important;
        border: 1px solid #c4b5fd !important;
    }

    .print-item-title {
        font-size: 13.5px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        line-height: 1.3 !important;
        margin: 0 !important;
    }

    /* Connecteur fléché vertical entre les éléments (anti-coupure) */
    .print-vertical-arrow {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        height: 26px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        page-break-before: avoid !important;
        page-break-after: avoid !important;
    }

    /* Pied de page officiel */
    .print-footer {
        margin-top: 26px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .print-footer-line {
        height: 1px !important;
        background: #cbd5e1 !important;
        margin-bottom: 8px !important;
    }

    .print-footer-content {
        display: flex !important;
        justify-content: space-between !important;
        font-size: 9px !important;
        color: #64748b !important;
        font-weight: 500 !important;
    }
}
