/* ============================================================================
   CONFIGURE SOURCES - SMART MATCHING STYLES
   File 4 of 6: Smart Matching Container, Upload Zone, File List, Progress
   ============================================================================ */

/* --- Smart Matching Container --- */
.cs-smart-match-container {
    margin: 24px 0;
    background: transparent;
    border: 1px solid rgba(67, 132, 255, 0.12);
    border-radius: 20px;
    overflow: visible;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05),
                0 4px 20px rgba(67, 132, 255, 0.04);
    position: relative;
}

.cs-smart-match-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(67, 132, 255, 0.3) 20%,
        rgba(123, 66, 255, 0.3) 80%,
        transparent
    );
    opacity: 0.8;
}

/* --- Smart Match Toggle Button --- */
.cs-smart-match-toggle {
    width: 100%;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    letter-spacing: -0.02em;
}

.cs-smart-match-toggle:hover {
    background: var(--vc-glass-bg);
}

.cs-smart-match-toggle .cs-icon-wrapper {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 12px;
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.1), rgba(123, 66, 255, 0.1));
    border-radius: 12px;
}

.cs-smart-match-toggle svg {
    width: 22px;
    height: 22px;
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-smart-match-toggle .cs-toggle-text {
    flex: 1;
    text-align: left;
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    font-size: 17px;
}

.cs-smart-match-toggle .cs-recommended-badge {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    padding: 5px 10px;
    border-radius: 14px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(67, 132, 255, 0.25);
}

.cs-chevron {
    margin-left: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
    color: var(--vc-text-muted);
}

/* --- Smart Match Panel --- */
.cs-smart-match-panel {
    background: transparent; /* Or use 'none' */
    border-top: 1px solid rgba(67, 132, 255, 0.1);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cs-smart-match-content {
    min-height: 100px;
    visibility: visible;
    opacity: 1;
    background: none; /* Remove any background */
}

/* --- Progress Section --- */
.cs-match-progress {
    margin-bottom: 20px;
    position: relative;
    background: none;
}

.cs-upload-stats-badge {
    text-align: center;
    margin-bottom: 24px;
}

.cs-upload-stats {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 8px 20px;
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.08), rgba(123, 66, 255, 0.08));
    border-radius: 20px;
    display: inline-block;
    border: 1px solid rgba(67, 132, 255, 0.15);
}

.cs-upload-stats span {
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Progress Stats - Above Progress Bar */
.cs-progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 2px;
}

.cs-manual-needed {
    font-size: 13px;
    color: var(--vc-text-muted);
    font-weight: 500;
}

.cs-manual-count {
    color: var(--vc-status-partial);
    font-weight: 600;
}

.cs-match-count {
    font-size: 13px;
    color: var(--vc-text-muted);
    font-weight: 500;
}

.cs-match-percentage {
    color: var(--vc-status-supported);
    font-weight: 600;
}

/* --- Progress Bar --- */
.cs-progress-bar-container {
    background: var(--vc-bg-input);
    height: 8px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--vc-border-default);
    width: 100%;
}

.cs-progress-bar {
    height: 100%;
    width: 100%;
    position: relative;
    background: var(--vc-glass-bg);
}

.cs-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4384ff, #7b42ff);
    border-radius: 12px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 0 20px rgba(67, 132, 255, 0.4);
}

.cs-progress-fill.processing {
    animation: processingPulse 1.5s ease-in-out infinite;
}

@keyframes processingPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.cs-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent,
        rgba(255, 255, 255, 0.2) 50%,
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* --- Upload Area --- */
.cs-smart-match-upload-area {
    min-height: 180px;
    border: 2px dashed rgba(67, 132, 255, 0.2);
    border-radius: 16px;
    display: flex !important; /* Force display */
    visibility: visible !important; /* Force visibility */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 32px;
    text-align: center;
    background: radial-gradient(ellipse at center, 
        rgba(67, 132, 255, 0.02), 
        transparent
    );
    position: relative;
    margin: 20px 0;
    opacity: 1; /* Ensure it's visible */
}

.cs-smart-match-upload-area:hover,
.cs-smart-match-upload-area.dragover {
    background: radial-gradient(ellipse at center, 
        rgba(67, 132, 255, 0.06), 
        rgba(67, 132, 255, 0.01)
    );
    border-color: rgba(67, 132, 255, 0.35);
    border-style: solid;
    transform: scale(1.01);
}

.cs-smart-match-icon {
    margin-bottom: 16px;
}

.cs-smart-match-icon svg {
    width: 40px;
    height: 40px;
}

.cs-smart-match-icon svg path {
    stroke: url(#upload-gradient);
    stroke-width: 1.5;
}

.cs-smart-match-main-text {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--vc-text-primary);
    margin-bottom: 8px;
    font-size: 17px;
}

.cs-smart-match-subtext {
    font-size: 13px;
    color: var(--vc-text-muted);
    margin-bottom: 20px;
}

.cs-upload-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.cs-upload-action-btn {
    background: var(--vc-bg-input);
    border: 1px solid var(--vc-border-emphasis);
    border-radius: 10px;
    padding: 12px 20px;  /* Increased padding for premium feel */
    font-weight: 600;  /* Changed from 500 to 600 */
    letter-spacing: -0.01em;
    transition: all 0.2s ease;
    color: var(--vc-text-secondary);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;  /* CENTER THE CONTENT */
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);  /* Premium shadow */
}

.cs-upload-action-btn svg {
    flex-shrink: 0;
}

.cs-upload-action-btn svg path {
    stroke: url(#button-gradient);
}

.cs-upload-action-btn:hover {
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.15), rgba(123, 66, 255, 0.15));
    border-color: rgba(67, 132, 255, 0.4);
    color: var(--vc-text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(67, 132, 255, 0.3);  /* Enhanced shadow on hover */
}

.cs-upload-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(67, 132, 255, 0.2);
}

.cs-upload-action-btn.compact {
    padding: 8px 14px;
    font-size: 13px;
}

/* --- File List Results --- */
#smartMatchResults {
    margin-top: 20px;
    max-height: 700px;
    overflow-y: auto;
    padding-right: 8px;
    background: none; /* Remove background */
}

#smartMatchResults::-webkit-scrollbar {
    width: 6px;
}

#smartMatchResults::-webkit-scrollbar-track {
    background: var(--vc-glass-bg);
    border-radius: 3px;
}

#smartMatchResults::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.3), rgba(123, 66, 255, 0.3));
    border-radius: 3px;
}

/* --- File Items --- */
.sm-file-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--vc-glass-bg);
    border: 1px solid var(--vc-border-default);
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
}

.sm-file-item:hover {
    background: rgba(67, 132, 255, 0.03);
    border-color: rgba(67, 132, 255, 0.15);
    transform: translateX(4px);
}

.sm-file-item.matched {
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.03);
}

.sm-file-type {
    width: 48px;
    height: 32px;
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.15), rgba(123, 66, 255, 0.15));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #7b42ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 12px;
    flex-shrink: 0;
}

.sm-file-info {
    flex: 1;
    min-width: 0;
}

.sm-file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--vc-text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-file-size {
    font-size: 12px;
    color: var(--vc-text-muted);
}

.sm-file-remove {
    width: 28px;
    height: 28px;
    background: var(--vc-bg-input);
    border: 1px solid var(--vc-border-default);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--vc-text-disabled);
    flex-shrink: 0;
}

.sm-file-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: rgba(239, 68, 68, 0.8);
    transform: scale(1.1);
}

.sm-file-remove svg {
    width: 14px;
    height: 14px;
}

/* --- File Details Container --- */
.cs-file-details-container {
    margin-top: 16px;
    padding: 16px;
    background: none; 
    border: 1px solid var(--vc-border-default);
    border-radius: 12px;
}

.cs-file-details-container h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--vc-text-primary);
}

.cs-file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-file-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: var(--vc-glass-bg);
    border: 1px solid var(--vc-border-default);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.cs-file-item:hover {
    background: rgba(67, 132, 255, 0.03);
    border-color: rgba(67, 132, 255, 0.12);
}

.cs-file-item.matched {
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.03);
}

/* --- Upload Status Items (Compact Version) --- */
.upload-status-list.compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-upload-status-item.compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--vc-glass-bg);
    border: 1px solid var(--vc-border-default);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.cs-upload-status-item.compact:hover {
    background: rgba(67, 132, 255, 0.03);
    border-color: rgba(67, 132, 255, 0.12);
}

.cs-upload-file-info.compact {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.cs-upload-file-icon.compact {
    width: 36px;
    height: 28px;
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.15), rgba(123, 66, 255, 0.15));
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #7b42ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.cs-upload-file-details.compact {
    flex: 1;
    min-width: 0;
}

.cs-upload-file-name.compact {
    font-size: 13px;
    font-weight: 500;
    color: var(--vc-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.cs-upload-file-size {
    font-size: 11px;
    color: var(--vc-text-muted);
}

.cs-remove-file-btn {
    width: 24px;
    height: 24px;
    background: var(--vc-bg-input);
    border: 1px solid var(--vc-border-default);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--vc-text-disabled);
    flex-shrink: 0;
}

.cs-remove-file-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: rgba(239, 68, 68, 0.8);
}

/* --- Footer Section --- */
.cs-smart-match-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--vc-border-default);
    position: relative;
}

.cs-view-details-link {
    position: absolute;
    left: 0;
    background: transparent;
    border: none;
    color: var(--vc-text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cs-view-details-link:not([disabled]):hover {
    color: var(--vc-text-secondary);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
}

.cs-view-details-link[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
}

.cs-view-details-link .chevron-icon {
    transition: transform 0.3s ease;
}

/* Add More Button */
.cs-upload-add-more {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

/* --- Process Button --- */
.sm-process-btn {
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    color: white;
    border: none;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
    box-shadow: 0 4px 14px rgba(67, 132, 255, 0.25);
}

.sm-process-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 132, 255, 0.35);
    background: linear-gradient(135deg, #5494ff, #8452ff);
}

.sm-process-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- Gradient Definitions --- */
/* SVG gradients are defined in the HTML, these are CSS gradient references */
.cs-smart-icon path {
    stroke: url(#smart-gradient);
}

/* --- Processing Spinner (if needed) --- */
.processing-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--vc-border-default);
    border-top-color: #4384ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Smart Match Hint (below the container) --- */
.cs-smart-match-hint {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(67, 132, 255, 0.05);
    border: 1px solid rgba(67, 132, 255, 0.15);
    border-radius: 12px;
    margin: 0 0 32px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--vc-text-secondary);
}

.cs-smart-match-hint svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: rgba(67, 132, 255, 0.8);
}

.cs-smart-match-hint strong {
    color: var(--vc-text-primary);
    font-weight: 600;
}

/* ============================================================================
   CLASS-BASED TOGGLE STATES (More reliable than inline styles)
   ============================================================================ */

/* Closed state class - overrides everything */
.cs-smart-match-panel.cs-smart-match-closed {
    display: none !important;
    max-height: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
}

/* Open state class - overrides everything */
.cs-smart-match-panel.cs-smart-match-open {
    display: block !important;
    max-height: 3000px !important;
    padding: 24px !important;
    opacity: 1 !important;
    overflow: visible !important;
}

/* Ensure transitions work smoothly */
.cs-smart-match-panel.cs-smart-match-open .cs-smart-match-content,
.cs-smart-match-panel.cs-smart-match-open .cs-smart-match-upload-area {
    animation: fadeInContent 0.3s ease-out;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Match Status Message (replaces progress bar) --- */
.cs-match-status {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    margin-bottom: 24px;
    animation: fadeInScale 0.4s ease-out;
}

.cs-match-status.active {
    display: flex !important;
}

.cs-status-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.2));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cs-status-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--vc-status-supported);
    stroke-width: 2.5;
}

.cs-status-text {
    flex: 1;
}

.cs-status-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--vc-text-primary);
    margin-bottom: 4px;
}

.cs-status-subtitle {
    font-size: 14px;
    color: var(--vc-text-secondary);
}