/* ==========================================================================
   Fullscreen Overlay with elegant blur
   ========================================================================== */
.compare-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.45); /* Elegant Slate Overlay */
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 24px;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}

/* Glassmorphism Card Container */
.compare-modal-container {
    width: 100%;
    max-width: 1120px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15),
                0 4px 12px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
    box-sizing: border-box;
}

/* Header Area */
.compare-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid #f1f5f9;
}

.compare-modal-header-info h2 {
    font-size: 18px;
    font-weight: 750;
    color: #0f172a;
    margin: 0;
}

.compare-modal-header-info p {
    font-size: 12px;
    color: #64748b;
    margin: 4px 0 0 0;
}

.compare-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease-in-out;
}

.compare-modal-close:hover {
    color: #475569;
}

/* ==========================================================================
   Dynamic Loader Step Card
   ========================================================================== */
.compare-modal-loading-card {
    padding: 50px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.compare-modal-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3.5px solid #e2e8f0;
    border-top: 3.5px solid #3b82f6;
    border-radius: 50%;
    animation: spinCompare 0.9s linear infinite;
    margin-bottom: 20px;
}

@keyframes spinCompare {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.compare-modal-loading-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.loading-sub {
    font-size: 12.5px;
    color: #64748b;
    margin: 0 0 32px 0;
    text-align: center;
}

.loading-steps {
    width: 100%;
    max-width: 420px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease-in-out;
}

.step-bullet {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.2s ease-in-out;
}

.loading-step.pending .step-bullet {
    background-color: #cbd5e1;
    color: #64748b;
}

.loading-step.pending span {
    color: #94a3b8;
    font-size: 12.5px;
}

.loading-step.completed .step-bullet {
    background-color: #22c55e;
    color: white;
}

.loading-step.completed span {
    color: #334155;
    font-weight: 550;
    font-size: 12.5px;
}

/* ==========================================================================
   Dashboard View Grid Layout
   ========================================================================== */
.compare-modal-dashboard {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.compare-scans-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 24px;
    margin-bottom: 24px;
}

.compare-scan-column {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 42%;
}

.compare-scan-column.scan-b-label {
    justify-content: flex-end;
    text-align: right;
}

.scan-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: white;
}

.avatar-a {
    background: #3b82f6;
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.2);
}

.avatar-b {
    background: #6366f1; /* Premium Indigo */
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.2);
}

.scan-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.scan-badge {
    font-size: 9.5px;
    font-weight: 750;
    text-transform: uppercase;
    color: #3b82f6;
    letter-spacing: 0.5px;
}

.scan-badge.text-blue {
    color: #6366f1;
}

.scan-meta h3 {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scan-date {
    font-size: 11px;
    color: #64748b;
}

.compare-versus-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: white;
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   Two Column Grid Splits
   ========================================================================== */
.compare-dashboard-grid-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 32px;
    margin-bottom: 24px;
}

@media (max-width: 990px) {
    .compare-dashboard-grid-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

.compare-dashboard-left,
.compare-dashboard-right {
    display: flex;
    flex-direction: column;
}

.panel-title-area {
    margin-bottom: 18px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 8px;
}

.panel-title-area h3 {
    font-size: 14.5px;
    font-weight: 750;
    color: #0f172a;
    margin: 0;
}

.panel-title-area p {
    font-size: 11px;
    color: #64748b;
    margin: 4px 0 0 0;
}

/* Left side bar tracks grid */
.compare-metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.compare-metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 18px;
    transition: all 0.2s ease;
}

.compare-metric-row:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    border-color: #cbd5e1;
}

.compare-metric-label-area {
    width: 32%;
}

.compare-metric-name {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.compare-metric-bar-group {
    width: 50%;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-val {
    font-size: 11px;
    font-weight: 750;
    width: 65px;
    text-align: right;
    flex-shrink: 0;
}

.font-a { color: #3b82f6; }
.font-b { color: #6366f1; }

.bar-track {
    background-color: #f1f5f9;
    height: 7px;
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease-out;
}

.fill-a {
    background: linear-gradient(90deg, #93c5fd, #3b82f6);
}

.fill-b {
    background: linear-gradient(90deg, #a5b4fc, #6366f1);
}

.compare-metric-delta-area {
    width: 18%;
    display: flex;
    justify-content: flex-end;
}

.delta-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
}

.delta-badge.loss {
    background-color: #ecfdf5;
    color: #059669; /* Green representing trimmed fat/leaning progress */
}

.delta-badge.gain {
    background-color: #eff6ff;
    color: #2563eb; /* Blue representing muscle/volume increase */
}

.delta-badge.neutral {
    background-color: #f1f5f9;
    color: #64748b;
}

/* ==========================================================================
   Visual Diverging Delta baseline Chart (Right Column)
   ========================================================================== */
.diverging-chart-container {
    position: relative;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    min-height: 290px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* The vertical 0 baseline line in the middle */
.chart-center-axis {
    position: absolute;
    left: 62.5%; /* Aligns pixel-perfectly with 50% center of the graphic tracks */
    top: 0;
    bottom: 0;
    width: 2px;
    border-left: 2px dashed #94a3b8;
    z-index: 1;
    transform: translateX(-50%);
}

.chart-header-labels {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
    margin-bottom: 4px;
    z-index: 2;
    width: 100%;
}

.diverging-graphic-track.header-track {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    width: 75%;
}

.hdr-label {
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #94a3b8;
}

.hdr-label.label-toning {
    position: absolute;
    right: 54%;
    text-align: right;
}

.hdr-label.label-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #475569;
    font-weight: 800;
    background-color: #f8fafc; /* Covers line intersections */
    padding: 0 8px;
    z-index: 5;
}

.hdr-label.label-growth {
    position: absolute;
    left: 54%;
    text-align: left;
}

.diverging-chart-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2;
    position: relative;
}

.diverging-chart-row-item {
    display: flex;
    align-items: center;
    height: 24px;
}

.diverging-row-title {
    width: 25%;
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
}

.diverging-graphic-track {
    flex: 1;
    display: flex;
    height: 100%;
    position: relative;
    align-items: center;
    justify-content: center;
}

.diverging-zero-marker {
    width: 8px;
    height: 8px;
    background-color: #cbd5e1;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.diverging-side-container {
    width: 50%;
    height: 14px;
    display: flex;
    align-items: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.diverging-side-container.side-left {
    right: 50%;
    justify-content: flex-end;
    padding-right: 1px;
}

.diverging-side-container.side-right {
    left: 50%;
    justify-content: flex-start;
    padding-left: 1px;
}

/* HSL bars styling with custom gradient caps */
.diverging-bar-fill {
    height: 100%;
    border-radius: 4px;
    position: relative;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.fill-toning {
    background: linear-gradient(270deg, #10b981, #059669); /* emerald toning */
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.15);
}

.fill-growth {
    background: linear-gradient(90deg, #6366f1, #4f46e5); /* indigo hypertrophy */
    box-shadow: 0 2px 5px rgba(99, 102, 241, 0.15);
}

.diverging-bar-label-outer {
    font-size: 10px;
    font-weight: 800;
    color: #475569;
    white-space: nowrap;
    z-index: 10;
}

.diverging-bar-label-outer.val-left {
    margin-right: 6px;
}

.diverging-bar-label-outer.val-right {
    margin-left: 6px;
}

/* ==========================================================================
   Volumetric Analytics widgets & transformation profiles
   ========================================================================== */
.analytics-summary-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.verdict-banner-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.04), rgba(99, 102, 241, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    padding: 14px 18px;
}

.verdict-tag {
    font-size: 9px;
    font-weight: 800;
    color: #4f46e5;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
}

.verdict-banner-card h4 {
    font-size: 14px;
    font-weight: 750;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.verdict-banner-card p {
    font-size: 11.5px;
    color: #475569;
    margin: 0;
    line-height: 1.4;
}

.highlight-cards-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.summary-highlight-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hl-card-badge {
    font-size: 8.5px;
    font-weight: 750;
    letter-spacing: 0.5px;
}

.hl-card-badge.text-green { color: #059669; }
.hl-card-badge.text-indigo { color: #4f46e5; }

.summary-highlight-card.card-toning {
    border-left: 4px solid #10b981;
}

.summary-highlight-card.card-growth {
    border-left: 4px solid #6366f1;
}

.hl-value {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 3px 0 1px 0;
}

.hl-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin: 0;
}

/* ==========================================================================
   Footer Section
   ========================================================================== */
.compare-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f1f5f9;
    padding-top: 20px;
    margin-top: auto;
}

.btn-print-report {
    background-color: #0f172a;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
    transition: all 0.15s ease-in-out;
}

.btn-print-report:hover {
    background-color: #1e293b;
    transform: translateY(-1px);
}

.btn-close-bottom {
    background-color: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-close-bottom:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

/* ==========================================================================
   Clean Print Styles for Exporting Reports
   ========================================================================== */
@media print {
    body * {
        visibility: hidden;
    }
    
    .compare-modal-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        background: transparent !important;
        backdrop-filter: none !important;
        padding: 0;
        margin: 0;
    }

    #scanCompareModal,
    #scanCompareModal * {
        visibility: visible;
    }

    .compare-modal-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100% !important;
        max-height: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    .compare-modal-dashboard {
        overflow: visible !important;
        max-height: none !important;
    }

    .compare-dashboard-grid-layout {
        display: grid !important;
        grid-template-columns: 1.1fr 0.9fr !important;
        gap: 20px !important;
        max-height: none !important;
        background: #ffffff !important;
    }

    .diverging-chart-container {
        background: #ffffff !important;
        border-color: #cbd5e1 !important;
    }

    .no-print {
        display: none !important;
    }
}

/* ==========================================================================
   Search Bar Styling
   ========================================================================== */
.compare-modal-search input {
    padding: 8px 14px 8px 36px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 13px;
    outline: none;
    width: 220px;
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat 10px center;
    background-size: 16px 16px;
    transition: all 0.15s ease-in-out;
}

.compare-modal-search input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

@media (max-width: 640px) {
    .compare-modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .compare-modal-search {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%;
    }
    .compare-modal-search input {
        width: 100%;
    }
    .compare-modal-close {
        position: absolute;
        top: 16px;
        right: 20px;
    }
}
