﻿/* Resolution timeline Hazards */
.hz-timeline-wrapper {
    position: relative;
    overflow: visible;
}

/* Toggle button */
.hz-timeline-toggle-container {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
}

.hz-timeline-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #575d63;
    background: #f8f9fa;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.hz-timeline-toggle-btn:hover {
    color: #2d353c;
    background: #fff;
    border-color: #242a30;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.hz-timeline-toggle-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.hz-timeline-toggle-btn i {
    font-size: 1rem;
}

.hz-timeline-scroll-wrapper {
    overflow: visible;
}

.hz-timeline-scroll-wrapper.horizontal-scroll {
    overflow-x: auto;
    overflow-y: visible;
}

/* Horizontal layout */
.hz-timeline-container {
    display: inline-flex;
    gap: 3rem;
    padding: 2rem 0;
    white-space: nowrap;
    position: relative;
    min-height: 450px;
    width: auto;
    margin: 3rem 2rem;
}

.hz-timeline-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    background: #d0d7de;
    transform: translateY(-50%);
    z-index: 1;
}

.hz-timeline-item {
    display: inline-block;
    position: relative;
    width: 22rem;
    min-width: 22rem;
    text-align: center;
}

.hz-timeline-dot {
    width: 18px;
    height: 18px;
    background: var(--bs-primary);
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.hz-timeline-card {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20rem;
    background: #fff;
    border-left: 4px solid var(--bs-primary);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    white-space: normal;
    z-index: 2;
    line-height: 1.45;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

.hz-timeline-item.top .hz-timeline-card {
    bottom: calc(50% + 35px);
}

.hz-timeline-item.bottom .hz-timeline-card {
    top: calc(50% + 35px);
}

.hz-timeline-date {
    position: absolute;
    font-size: 0.85rem;
    color: #6c757d;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    z-index: 4;
}

.hz-timeline-item.top .hz-timeline-date {
    top: calc(50% + 20px);
    left: 50%;
    transform: translateX(-50%);
}

.hz-timeline-item.bottom .hz-timeline-date {
    bottom: calc(50% + 20px);
    left: 50%;
    transform: translateX(-50%);
}

.hz-timeline-start-dot,
.hz-timeline-end-dot {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: #d0d7de;
    border-radius: 50%;
    z-index: 2;
}

.hz-timeline-start-dot {
    left: 0;
    transform: translate(-50%, -50%);
}

.hz-timeline-end-dot {
    right: 0;
    transform: translate(50%, -50%);
}

/* =====================
   Vertical Layout
   ===================== */
.hz-timeline-container.vertical {
    display: flex !important;
    justify-content: center;
    padding: 0 1rem;
    min-height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 1rem auto;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.hz-timeline-inner {
    position: relative;
    padding: 1rem 0 1rem 3rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Vertical connecting line */
.hz-timeline-inner::before {
    content: '';
    position: absolute;
    left: 20px;
    margin-left: -2px;
    width: 4px;
    top: 10px;
    bottom: 10px;
    background: #d0d7de;
    z-index: 1;
}

/* Top cap dot */
.hz-timeline-inner::after {
    content: '';
    position: absolute;
    left: 20px;
    margin-left: -7px;
    top: 10px;
    width: 14px;
    height: 14px;
    background: #d0d7de;
    border-radius: 50%;
    z-index: 2;
}

.hz-timeline-container.vertical .hz-timeline-item {
    display: flex;
    align-items: flex-start;
    position: relative;
    width: auto;
    min-width: auto;
    text-align: left;
    margin-bottom: 2.5rem;
    padding-left: 0;
}

.hz-timeline-container.vertical .hz-timeline-item:last-child {
    margin-bottom: 0;
}

/* Bottom cap dot on last item */
.hz-timeline-container.vertical .hz-timeline-item.last::after {
    content: '';
    position: absolute;
    left: -28px;
    margin-left: -7px;
    bottom: -10px;
    width: 14px;
    height: 14px;
    background: #d0d7de;
    border-radius: 50%;
    z-index: 2;
}

/* FIX: align dot to top of card, not a hardcoded pixel value */
.hz-timeline-container.vertical .hz-timeline-dot {
    position: absolute;
    left: -19px;
    margin-left: -9px;
    top: 28px; /* aligns with the card header row */
    width: 18px;
    height: 18px;
    z-index: 3;
}

.hz-timeline-vertical-content {
    display: flex;
    flex-direction: column;
    margin-left: 2.5rem;
    margin-right: 1rem;
    position: relative;
}

.hz-timeline-date-vertical {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.hz-timeline-card-vertical {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: #fff;
    border-left: 4px solid var(--bs-primary);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    line-height: 1.45;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    word-break: break-word;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

.hz-timeline-card-vertical * {
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
}

.hz-timeline-container.vertical .hz-timeline-line,
.hz-timeline-container.vertical .hz-timeline-start-dot,
.hz-timeline-container.vertical .hz-timeline-end-dot,
.hz-timeline-container.vertical .hz-timeline-date {
    display: none;
}

/* =====================
   Card internals
   ===================== */
.hz-event-title {
    font-size: 0.95rem;
}

.hz-action-chip {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 10px;
    border-radius: 999px;
    background-color: rgba(0, 0, 0, 0.06);
    color: inherit;
    white-space: nowrap;
}

.hz-severity-badge {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 2px 10px;
    border-radius: 4px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

/* Special contrast for Slight severity (yellow background) */
.hz-severity-badge[style*="#ffff99"],
.hz-severity-badge[style*="rgb(255, 255, 153)"] {
    color: #1a1a1a !important;
    text-shadow: none !important;
    font-weight: 700;
}

.hz-comment-block {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(0, 0, 0, 0.035);
    border-left: 3px solid rgba(0, 0, 0, 0.12);
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    margin: 8px 0;
    max-width: 100%;
    overflow-wrap: break-word;
}

.hz-comment-icon {
    margin-top: 2px;
    opacity: 0.45;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.hz-comment-text {
    font-size: 0.82rem;
    font-style: italic;
    color: var(--bs-secondary-color, #6c757d);
    line-height: 1.5;
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.hz-event-footer {
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-top: 6px;
}

/* =====================
   Mobile
   ===================== */
@media (max-width: 767px) {
    .hz-timeline-toggle-container {
        padding: 0.5rem 1rem;
        margin-bottom: 0.5rem;
    }

    .hz-timeline-toggle-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    .hz-timeline-scroll-wrapper.horizontal-scroll {
        overflow-x: visible;
    }

    .hz-timeline-container.horizontal {
        display: flex !important;
        flex-direction: column !important;
        align-items: center;
        gap: 1.5rem;
        padding: 0.5rem 1rem;
        max-height: 70vh;
        overflow-y: auto;
        margin: 0 auto;
    }

    .hz-timeline-container.horizontal .hz-timeline-line,
    .hz-timeline-container.horizontal .hz-timeline-start-dot,
    .hz-timeline-container.horizontal .hz-timeline-end-dot,
    .hz-timeline-container.horizontal .hz-timeline-dot {
        display: none !important;
    }

    .hz-timeline-container.horizontal .hz-timeline-item {
        width: 100% !important;
        max-width: 400px;
        text-align: center;
    }

    .hz-timeline-container.horizontal .hz-timeline-date {
        position: relative;
        margin-bottom: 0.5rem;
        transform: none;
        left: auto;
        top: auto;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
        font-weight: 500;
        white-space: normal;
        display: inline-block;
    }

    .hz-timeline-container.horizontal .hz-timeline-card {
        position: relative !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100%;
        padding: 0.75rem 1rem 1rem;
    }

    .hz-timeline-container.vertical {
        max-height: 65vh;
        padding: 0 1rem;
    }

    .hz-timeline-inner {
        padding: 1rem 0 1rem 2rem;
    }

    .hz-timeline-inner::before {
        left: 15px;
    }

    .hz-timeline-inner::after {
        left: 15px;
        margin-left: -7px;
    }

    .hz-timeline-container.vertical .hz-timeline-dot {
        left: -12px;
        margin-left: -9px;
    }

    .hz-timeline-container.vertical .hz-timeline-item.last::after {
        left: -21px;
        margin-left: -7px;
    }

    .hz-timeline-vertical-content {
        margin-left: 2rem;
    }

    .hz-timeline-card-vertical {
        width: calc(100vw - 5rem);
        max-width: 22rem;
    }
}