/* ================================================================
   Screen 2C — Top Panel & Bottom Panel Layout
   ================================================================ */

/* -- Divider between sections -- */
.s2c-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 16px 0;
}

/* ================================================================
   TOP PANEL — Ranked Alternatives List
   ================================================================ */

.s2c-top-panel {
    margin-bottom: 20px;
}

.s2c-panel-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(34, 197, 94, 0.8);
    margin-bottom: 12px;
}

.s2c-alt-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.s2c-alt-row {
    position: relative;
    padding: 14px 16px;
    padding-right: 70px; /* Space for BEST badge */
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.s2c-alt-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.s2c-alt-row--selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.4);
}

.s2c-alt-row:first-child {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.25);
}

.s2c-alt-row:first-child.s2c-alt-row--selected {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.5);
}

.s2c-alt-row-content {
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.75);
}

.s2c-alt-row-title {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
}

.s2c-alt-row-summary {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

.s2c-best-badge {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--vc-status-supported);
    color: #fff;
    border-radius: 4px;
}

/* ================================================================
   BOTTOM PANEL — Selected Alternative Details
   ================================================================ */

.s2c-bottom-panel {
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

/* Metrics row */
.s2c-detail-metrics {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.s2c-metric {
    display: flex;
    align-items: center;
}

.s2c-metric-value {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.s2c-metric-value--score {
    font-size: 16px;
    font-weight: 800;
    color: rgba(34, 197, 94, 0.9);
    background: rgba(34, 197, 94, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
}

.s2c-metric-value--score.medium {
    color: rgba(234, 179, 8, 0.9);
    background: rgba(234, 179, 8, 0.1);
}

.s2c-metric-value--score.low {
    color: rgba(239, 68, 68, 0.9);
    background: rgba(239, 68, 68, 0.1);
}

.s2c-metric-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(99, 102, 241, 0.9);
    background: rgba(99, 102, 241, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
}

.s2c-metric-badge svg {
    width: 14px;
    height: 14px;
}

.s2c-detail-title {
    font-size: 15px;
    font-weight: 700;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
    flex: 1;
    min-width: 200px;
    margin-top: 8px;
}

/* Authors line */
.s2c-detail-authors {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 16px;
}

/* Action buttons */
.s2c-detail-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.s2c-btn-use-source {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(34, 197, 94, 0.95);
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.s2c-btn-use-source:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.s2c-btn-use-source svg {
    width: 16px;
    height: 16px;
}

.s2c-btn-external {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.s2c-btn-external:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
}

.s2c-btn-external svg {
    width: 16px;
    height: 16px;
}

/* AI explanation */
.s2c-ai-explanation {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.75);
}

.s2c-ai-explanation svg {
    flex-shrink: 0;
    color: rgba(99, 102, 241, 0.7);
    margin-top: 2px;
    width: 16px;
    height: 16px;
}

.s2c-ai-label {
    font-weight: 600;
    color: rgba(99, 102, 241, 0.9);
    margin-right: 4px;
}

/* Abstract section (Phase 1) */
.s2c-abstract-section {
    margin-bottom: 16px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.s2c-abstract-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.s2c-abstract-header svg {
    width: 14px;
    height: 14px;
    color: rgba(255, 255, 255, 0.4);
}

.s2c-abstract-text {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    transition: max-height 0.3s ease;
}

.s2c-abstract-text.expanded {
    max-height: none;
}

.s2c-abstract-toggle {
    display: inline-block;
    margin-top: 10px;
    padding: 0;
    background: none;
    border: none;
    color: rgba(99, 102, 241, 0.8);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.s2c-abstract-toggle:hover {
    color: rgba(99, 102, 241, 1);
    text-decoration: underline;
}

/* Why this source is better */
.s2c-why-better {
    margin-bottom: 16px;
}

.s2c-why-better-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 10px;
}

.s2c-why-better-title svg {
    width: 16px;
    height: 16px;
}

.s2c-why-better-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
}

.s2c-why-better-item svg {
    color: rgba(34, 197, 94, 0.6);
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.s2c-why-better-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    min-width: 80px;
}

.s2c-why-better-value {
    color: rgba(255, 255, 255, 0.5);
}

/* Evidence section */
.s2c-evidence-section {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid rgba(34, 197, 94, 0.5);
    border-radius: 8px;
    margin-bottom: 16px;
}

.s2c-evidence-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(34, 197, 94, 0.7);
    margin-bottom: 10px;
}

.s2c-evidence-header svg {
    width: 14px;
    height: 14px;
}

.s2c-evidence-finding-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(239, 68, 68, 0.7);
    margin-bottom: 6px;
}

.s2c-evidence-text {
    font-size: 13px;
    font-style: italic;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
}

/* Keep original button - bottom panel version */
.s2c-bottom-panel .s2c-btn-keep-original {
    width: 100%;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.s2c-bottom-panel .s2c-btn-keep-original:hover {
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ================================================================
   NO ALTERNATIVES STATE (Clean, no manual search)
   ================================================================ */

.s2c-no-alternatives {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    margin-bottom: 16px;
}

.s2c-no-alt-icon {
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 16px;
}

.s2c-no-alt-icon svg {
    width: 32px;
    height: 32px;
}

.s2c-no-alt-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.s2c-no-alt-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.5;
    max-width: 400px;
    margin-bottom: 16px;
}

.s2c-no-alt-recommendation {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.15);
    border-radius: 6px;
    padding: 10px 14px;
    max-width: 400px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.s2c-no-alt-recommendation strong {
    color: rgba(34, 197, 94, 0.8);
}

/* Prominent "Keep Original" button for no-alternatives state */
.s2c-btn-keep-original--prominent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 300px;
    padding: 14px 24px;
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.s2c-btn-keep-original--prominent:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.s2c-btn-keep-original--prominent svg {
    color: rgba(34, 197, 94, 0.8);
}

/* Legacy class for backward compatibility */
.s2c-no-alternatives-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

/* ================================================================
   SEARCHING STATE — Skeleton/Shimmer for panels
   ================================================================ */

.s2c-searching-panel {
    padding: 20px;
}

.s2c-skeleton-row {
    height: 52px;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.03) 25%,
        rgba(255,255,255,0.06) 50%,
        rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: s2c-panel-shimmer 1.5s ease infinite;
    border-radius: 8px;
    margin-bottom: 8px;
}

@keyframes s2c-panel-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.s2c-searching-panel .s2c-searching-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* ================================================================
   PROGRESS BAR (Progressive Loading)
   ================================================================ */

.s2c-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 24px;
}

.s2c-progress-bar {
    flex: 1;
    max-width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.s2c-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.8), rgba(139, 92, 246, 0.8));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.s2c-progress-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

/* Progress bar fading animation */
.s2c-progress-counter.fading {
    animation: s2c-progress-fade 1.5s ease forwards;
}

@keyframes s2c-progress-fade {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Live indicator styling */
.s2c-live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(99, 102, 241, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.s2c-live-dot {
    width: 6px;
    height: 6px;
    background: rgba(99, 102, 241, 0.9);
    border-radius: 50%;
    animation: s2c-live-pulse 1.5s ease infinite;
}

@keyframes s2c-live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Progress bar container */
.s2c-progress-bar-container {
    flex: 1;
    max-width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

/* ================================================================
   ALTERNATIVES SCROLL CONTAINER — Prevents UI Overlap
   ================================================================ */

.s2c-alternatives-scroll-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 24px;
    /* Smooth scrolling */
    scroll-behavior: smooth;
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.s2c-alternatives-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.s2c-alternatives-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.s2c-alternatives-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.s2c-alternatives-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Ensure panels inside the scroll container are properly spaced */
.s2c-alternatives-scroll-container .s2c-top-panel {
    margin-bottom: 16px;
}

.s2c-alternatives-scroll-container .s2c-bottom-panel {
    margin-bottom: 0;
}

/* ================================================================
   RESPONSIVE ADJUSTMENTS
   ================================================================ */

@media (max-width: 768px) {
    .s2c-detail-metrics {
        gap: 8px;
    }

    .s2c-detail-title {
        min-width: 100%;
    }

    .s2c-why-better-item {
        flex-wrap: wrap;
    }

    .s2c-why-better-label {
        min-width: 100%;
        margin-bottom: 2px;
    }

    .s2c-detail-actions {
        flex-wrap: wrap;
    }

    .s2c-btn-use-source {
        flex: 1;
        justify-content: center;
    }
}
