/* ==============================================================================
   MediLink – Unified Medical Timeline & Module Stylesheet
   Modern, Mobile-First Clinical Timeline, Patient Profile & Security Modules
   ============================================================================== */

/* --- Timeline Layout --- */
.ml-timeline-container {
    position: relative;
    padding: 1rem 0;
}

.ml-timeline-track {
    position: relative;
    padding-left: 2.5rem;
}

/* Vertical central connecting line */
.ml-timeline-track::before {
    content: '';
    position: absolute;
    top: 14px;
    bottom: 24px;
    left: 17px;
    width: 2px;
    background-color: var(--ml-border, #E2E8F0);
    z-index: 1;
}

/* Individual Timeline Event Entry */
.ml-timeline-item {
    position: relative;
    margin-bottom: 2rem;
    transition: opacity 0.2s ease;
}

.ml-timeline-item:last-child {
    margin-bottom: 0;
}

/* Timeline Node Dot / Icon */
.ml-timeline-node {
    position: absolute;
    left: -2.5rem;
    top: 4px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #FFFFFF;
    border: 2px solid var(--ml-border, #E2E8F0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.ml-timeline-item:hover .ml-timeline-node {
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

/* Event Type Specific Node Colors */
.node-diagnosis {
    border-color: #0F766E;
    color: #0F766E;
    background-color: #F0FDFA;
}

.node-surgery {
    border-color: #7C3AED;
    color: #7C3AED;
    background-color: #F5F3FF;
}

.node-prescription {
    border-color: #D97706;
    color: #D97706;
    background-color: #FFFBEB;
}

.node-lab_report {
    border-color: #2563EB;
    color: #2563EB;
    background-color: #EFF6FF;
}

.node-visit {
    border-color: #0284C7;
    color: #0284C7;
    background-color: #F0F9FF;
}

.node-emergency {
    border-color: #DC2626;
    color: #DC2626;
    background-color: #FEF2F2;
}

.node-referral {
    border-color: #059669;
    color: #059669;
    background-color: #ECFDF5;
}

/* Event Content Card */
.ml-timeline-card {
    background: #FFFFFF;
    border: 1px solid var(--ml-border, #E2E8F0);
    border-radius: var(--ml-radius, 12px);
    padding: 1.25rem 1.35rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.ml-timeline-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 118, 110, 0.35);
}

.ml-timeline-card .event-date {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ml-text-muted, #64748B);
}

.ml-timeline-card .event-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ml-text-dark, #0F172A);
    margin: 0.25rem 0 0.5rem;
    line-height: 1.35;
}

.ml-timeline-card .event-desc {
    font-size: 0.9rem;
    color: #334155;
    margin-bottom: 0.75rem;
    line-height: 1.55;
}

.ml-timeline-card .event-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--ml-text-muted, #64748B);
    padding-top: 0.65rem;
    border-top: 1px dashed var(--ml-border, #E2E8F0);
}

/* --- Patient Profile Styling --- */
.ml-profile-hero {
    background: #FFFFFF;
    border: 1px solid var(--ml-border, #E2E8F0);
    border-radius: var(--ml-radius, 12px);
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    margin-bottom: 1.5rem;
}

.ml-profile-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background-color: var(--ml-primary, #0F766E);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

.ml-profile-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 50rem;
}

.ml-attribute-box {
    background-color: #F8FAFC;
    border: 1px solid var(--ml-border, #E2E8F0);
    border-radius: var(--ml-radius-sm, 8px);
    padding: 0.85rem;
    font-size: 0.88rem;
    height: 100%;
}

.ml-attribute-label {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ml-text-muted, #64748B);
    margin-bottom: 0.25rem;
}

.ml-attribute-val {
    font-weight: 600;
    color: var(--ml-text-dark, #0F172A);
    word-break: break-word;
}

/* Missing Data indicator */
.missing-data-badge {
    background-color: #F1F5F9;
    color: #94A3B8;
    border: 1px dashed #CBD5E1;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

/* --- Identity Matching Side-by-Side Comparison --- */
.ml-match-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.ml-match-card {
    background: #FFFFFF;
    border: 1px solid var(--ml-border, #E2E8F0);
    border-radius: var(--ml-radius, 12px);
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.ml-match-card--left {
    border-left: 4px solid #0F766E;
}

.ml-match-card--right {
    border-left: 4px solid #0284C7;
}

.match-attr-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.55rem 0;
    border-bottom: 1px solid #F1F5F9;
    font-size: 0.88rem;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.match-attr-row:last-child {
    border-bottom: none;
}

.match-attr-row .match-indicator {
    color: #059669;
    font-size: 0.8rem;
    font-weight: 600;
}

.match-confidence-badge {
    background-color: #FEF3C7;
    border: 1px solid #FDE68A;
    color: #92400E;
    padding: 0.5rem 0.85rem;
    border-radius: var(--ml-radius-sm, 8px);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- QR Code Display --- */
.ml-qr-card {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
    background: #FFFFFF;
    border: 1px solid var(--ml-border, #E2E8F0);
    border-radius: var(--ml-radius, 12px);
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

.ml-qr-frame {
    display: inline-block;
    padding: 1rem;
    background: #FFFFFF;
    border: 2px solid var(--ml-border, #E2E8F0);
    border-radius: var(--ml-radius, 12px);
    margin: 1.25rem 0;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.02);
    max-width: 100%;
}

.ml-qr-svg {
    width: 180px;
    height: 180px;
    max-width: 100%;
}

/* --- Document Upload Drag-and-Drop Area --- */
.ml-upload-box {
    border: 2px dashed #CBD5E1;
    border-radius: var(--ml-radius, 12px);
    padding: 2.25rem 1.5rem;
    text-align: center;
    background-color: #F8FAFC;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.ml-upload-box:hover,
.ml-upload-box.dragover {
    border-color: var(--ml-primary, #0F766E);
    background-color: #F0FDFA;
    transform: scale(1.01);
}

.ml-upload-icon {
    font-size: 2.4rem;
    color: var(--ml-primary, #0F766E);
    margin-bottom: 0.5rem;
    display: inline-block;
}

/* --- Responsive Adjustments --- */
@media (max-width: 991.98px) {
    .ml-profile-hero {
        padding: 1.35rem;
    }

    .ml-profile-hero .d-flex.flex-wrap.gap-2 {
        width: 100%;
        margin-top: 1rem;
    }
}

@media (max-width: 767.98px) {
    .ml-match-comparison {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .ml-timeline-track {
        padding-left: 2.15rem;
    }

    .ml-timeline-track::before {
        left: 14px;
    }

    .ml-timeline-node {
        left: -2.15rem;
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .ml-timeline-card {
        padding: 1rem 1.15rem;
    }

    .ml-profile-avatar {
        width: 56px;
        height: 56px;
        font-size: 1.35rem;
    }
}

@media (max-width: 575.98px) {
    .ml-timeline-track {
        padding-left: 1.85rem;
    }

    .ml-timeline-track::before {
        left: 11px;
    }

    .ml-timeline-node {
        left: -1.85rem;
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
        top: 2px;
    }

    .ml-timeline-card {
        padding: 0.95rem;
    }

    .ml-timeline-card .event-title {
        font-size: 0.98rem;
    }

    .ml-profile-hero {
        padding: 1rem;
    }

    .ml-profile-hero .ml-profile-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.15rem;
    }

    .ml-qr-card {
        padding: 1.5rem 1rem;
    }

    .ml-qr-svg {
        width: 150px;
        height: 150px;
    }

    .ml-upload-box {
        padding: 1.5rem 1rem;
    }
}
