/* ============================================================================
   SMART MATCHING SLIDE-IN PANEL
   Premium slide-in panel for Smart Matching functionality
   ============================================================================ */

/* Panel Overlay (Backdrop) */
.sm-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    pointer-events: none;
}

.sm-panel-overlay.active {
    background: rgba(0, 0, 0, 0.4);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Panel Container */
.sm-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    background: linear-gradient(135deg, var(--vc-bg-surface) 0%, var(--vc-bg-body) 100%);
    border-left: 1px solid rgba(67, 132, 255, 0.2);
    box-shadow: -10px 0 60px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sm-panel.active {
    transform: translateX(0);
}

/* Panel Header */
.sm-panel-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--vc-border-emphasis);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sm-panel-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sm-panel-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sm-panel-icon svg {
    width: 22px;
    height: 22px;
    stroke: white;
    stroke-width: 2;
}

.sm-panel-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--vc-text-primary);
    margin: 0;
}

.sm-panel-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--vc-bg-input);
    border: 1px solid var(--vc-border-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--vc-text-muted);
}

.sm-panel-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: rgba(239, 68, 68, 0.8);
    transform: scale(1.05);
}

.sm-panel-close svg {
    width: 20px;
    height: 20px;
}

/* Panel Body (Scrollable) */
.sm-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sm-panel-body::-webkit-scrollbar {
    width: 6px;
}

.sm-panel-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.sm-panel-body::-webkit-scrollbar-thumb {
    background: rgba(67, 132, 255, 0.3);
    border-radius: 3px;
}

.sm-panel-body::-webkit-scrollbar-thumb:hover {
    background: rgba(67, 132, 255, 0.5);
}

/* Uploaded Files Counter (Outside Upload Box) */
.sm-files-counter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.08), rgba(123, 66, 255, 0.08));
    border: 1px solid rgba(67, 132, 255, 0.15);
    border-radius: 10px;
    margin-bottom: 20px;
}

.sm-files-counter-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, rgba(67, 132, 255, 0.15), rgba(123, 66, 255, 0.15));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sm-files-counter-icon svg {
    width: 18px;
    height: 18px;
    stroke: url(#smart-gradient-panel);
}

.sm-files-counter-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--vc-text-primary);
}

.sm-files-counter-number {
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Panel Footer */
.sm-panel-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--vc-border-emphasis);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

/* Start Smart Matching Button in Panel */
.sm-panel-footer .sm-process-btn,
.sm-panel-footer #startSmartMatchBtn {
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    color: white !important;
    border: none;
    padding: 14px 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);
    width: 100%;
    max-width: 300px;
}

.sm-panel-footer .sm-process-btn:hover:not(:disabled),
.sm-panel-footer #startSmartMatchBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 132, 255, 0.35);
    background: linear-gradient(135deg, #5494ff, #8452ff);
}

.sm-panel-footer .sm-process-btn:disabled,
.sm-panel-footer #startSmartMatchBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: linear-gradient(135deg, #4384ff, #7b42ff);
}

/* Completion Message */
.sm-completion-message {
    display: none;
    text-align: center;
    padding: 40px 20px;
    animation: fadeInScale 0.4s ease-out;
}

.sm-completion-message.active {
    display: block;
}

.sm-completion-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: successPulse 1s ease-in-out;
}

.sm-completion-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--vc-status-supported);
    stroke-width: 3;
}

.sm-completion-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--vc-text-primary);
    margin-bottom: 8px;
}

.sm-completion-subtitle {
    font-size: 14px;
    color: var(--vc-text-muted);
}

/* Trigger Button (in section headers) */
.sm-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #4384ff, #7b42ff);
    border: 1px solid rgba(67, 132, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: -0.01em;
    box-shadow: 0 4px 14px rgba(67, 132, 255, 0.25);
}

.sm-trigger-btn:hover {
    background: linear-gradient(135deg, #5494ff, #8452ff);
    border-color: rgba(67, 132, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 132, 255, 0.35);
}

.sm-trigger-btn svg {
    width: 18px;
    height: 18px;
}

/* Panel Content Adjustments */
.sm-panel-body .cs-smart-match-upload-area {
    min-height: 160px;
    padding: 28px;
}

.sm-panel-body .cs-upload-actions {
    flex-direction: column;
    width: 100%;
}

.sm-panel-body .cs-upload-action-btn {
    width: 100%;
    justify-content: center;
}

.sm-panel-body #smartMatchResults {
    max-height: 700px;
}

/* Animations */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sm-panel {
        width: 100%;
        max-width: 100%;
    }
    
    .sm-panel-header,
    .sm-panel-body,
    .sm-panel-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
}

.sm-files-counter-simple {
    font-size: 17px;
    font-weight: 600;
    color: var(--vc-text-secondary);
    margin-bottom: 0;
    padding: 0;
    letter-spacing: 0.02em;
}

/* Privacy Mode Selector */
.privacy-mode-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.privacy-mode-option {
    flex: 1;
    cursor: pointer;
    border: 2px solid var(--vc-border-emphasis);
    border-radius: 12px;
    padding: 16px;
    background: var(--vc-glass-bg);
    transition: all 0.3s ease;
}

.privacy-mode-option:hover {
    border-color: rgba(74, 144, 226, 0.4);
    background: rgba(74, 144, 226, 0.05);
}

.privacy-mode-option.selected {
    border-color: #4A90E2;
    background: rgba(74, 144, 226, 0.1);
}

.privacy-mode-option input[type="radio"] {
    display: none;
}

.mode-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mode-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #E8E8E8;
}

.mode-header svg {
    flex-shrink: 0;
}

.mode-title {
    font-size: 15px;
}

.mode-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: rgba(74, 144, 226, 0.2);
    border: 1px solid #4A90E2;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #4A90E2;
}

.mode-description {
    font-size: 13px;
    color: #B0B0B0;
    line-height: 1.4;
    margin: 0;
}

.privacy-details-section {
    margin-bottom: 20px;
}

.private-mode-explanation {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.private-feature {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: rgba(74, 144, 226, 0.05);
    border-left: 3px solid #4A90E2;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #D0D0D0;
}

.private-feature svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #4A90E2;
}

.private-feature strong {
    color: #E8E8E8;
    font-weight: 600;
}

.private-feature.warning {
    background: rgba(255, 165, 0, 0.05);
    border-left-color: #FFA500;
}

.private-feature.warning svg {
    color: #FFA500;
}

.private-feature.warning strong {
    color: #FFA500;
}