/* All widget styles are scoped under .chat-widget-wrap */
.chat-widget-wrap,
.chat-widget-wrap *,
.chat-widget-wrap *::before,
.chat-widget-wrap *::after {
    box-sizing: border-box;
}

.chat-widget-wrap {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 40px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    line-height: 1.5;
}

.chat-widget-wrap .chat-widget-header {
    text-align: center;
    margin-bottom: 30px;
}

.chat-widget-wrap .chat-widget-header h2 {
    color: #333;
    font-size: 26px;
    margin: 0 0 10px;
    font-weight: 700;
}

.chat-widget-wrap .chat-widget-header p {
    color: #666;
    font-size: 14px;
    margin: 4px 0 0;
}

.chat-widget-wrap .chat-widget-error {
    background: #fee;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    border-radius: 4px;
    color: #c0392b;
    margin-bottom: 20px;
    display: none;
    white-space: pre-wrap;
}

.chat-widget-wrap .chat-widget-error.show {
    display: block;
}

.chat-widget-wrap .chat-widget-upload {
    background: #f8f9fa;
    border: 2px dashed #667eea;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    margin-bottom: 20px;
}

.chat-widget-wrap .chat-widget-upload:hover {
    background: #f0f4ff;
    border-color: #764ba2;
}

.chat-widget-wrap .chat-widget-upload.drag-over {
    background: #e8eef7;
    border-color: #764ba2;
    transform: scale(1.02);
}

.chat-widget-wrap .chat-widget-upload.disabled {
    background: #f3f4f6;
    border-color: #c7ced9;
    cursor: not-allowed;
    opacity: 0.7;
}

.chat-widget-wrap .chat-widget-upload.disabled:hover {
    background: #f3f4f6;
    border-color: #c7ced9;
}

.chat-widget-wrap .chat-widget-upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.chat-widget-wrap .chat-widget-upload p {
    color: #666;
    margin: 10px 0;
    font-size: 14px;
}

.chat-widget-wrap .chat-widget-button,
.chat-widget-wrap .chat-widget-upload-button {
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.chat-widget-wrap .chat-widget-upload-button,
.chat-widget-wrap .chat-widget-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.chat-widget-wrap .chat-widget-upload-button {
    padding: 10px 20px;
    font-size: 14px;
    margin-top: 8px;
}

.chat-widget-wrap .chat-widget-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.chat-widget-wrap .chat-widget-button-primary {
    flex: 1;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
}

.chat-widget-wrap .chat-widget-button-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.chat-widget-wrap .chat-widget-button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-widget-wrap .chat-widget-upload-button:disabled,
.chat-widget-wrap .chat-widget-button-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.chat-widget-wrap .chat-widget-button-secondary {
    background: #e0e0e0;
    color: #333;
    padding: 12px 20px;
    font-size: 16px;
}

.chat-widget-wrap .chat-widget-button-secondary:hover:not(:disabled) {
    background: #d0d0d0;
}

.chat-widget-wrap .chat-widget-file-info {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
}

.chat-widget-wrap .chat-widget-file-info p {
    color: #333;
    font-size: 14px;
    margin: 5px 0;
}

.chat-widget-wrap .chat-widget-file-info [data-cw="file-name"] {
    font-weight: bold;
    color: #667eea;
}

.chat-widget-wrap .chat-widget-file-info.show {
    display: block;
}

.chat-widget-wrap .chat-widget-processing {
    display: none;
    text-align: center;
    padding: 20px;
    background: #f0f4ff;
    border-radius: 8px;
    margin-bottom: 20px;
}

.chat-widget-wrap .chat-widget-processing.show {
    display: block;
}

.chat-widget-wrap .chat-widget-processing-text {
    color: #333;
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0;
}

.chat-widget-wrap .chat-widget-processing-text [data-cw="stage"] {
    color: #667eea;
    font-weight: 700;
}

.chat-widget-wrap .chat-widget-processing-time {
    color: #666;
    font-size: 14px;
}

.chat-widget-wrap .chat-widget-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: chat-widget-spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes chat-widget-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-widget-wrap .chat-widget-results {
    display: none;
    margin-top: 30px;
}

.chat-widget-wrap .chat-widget-results.show {
    display: block;
}

.chat-widget-wrap .chat-widget-result-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.chat-widget-wrap .chat-widget-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chat-widget-wrap .chat-widget-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chat-widget-wrap .chat-widget-label {
    color: #666;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.chat-widget-wrap .chat-widget-value {
    color: #333;
    font-size: 16px;
    font-weight: bold;
}

.chat-widget-wrap .chat-widget-conclusion {
    background: #fff5f5;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.chat-widget-wrap .chat-widget-conclusion.safe {
    background: #f0fdf4;
    border-left-color: #00b894;
}

.chat-widget-wrap .chat-widget-conclusion .chat-widget-value {
    color: #e74c3c;
}

.chat-widget-wrap .chat-widget-conclusion.safe .chat-widget-value {
    color: #00b894;
}

.chat-widget-wrap .chat-widget-list {
    list-style: none;
    counter-reset: chat-widget-counter;
    padding: 0;
}

.chat-widget-wrap .chat-widget-list-item {
    counter-increment: chat-widget-counter;
    background: #f8f9fa;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 3px solid #667eea;
    color: #333;
    font-size: 13px;
    line-height: 1.6;
}

.chat-widget-wrap .chat-widget-list-item::before {
    content: counter(chat-widget-counter);
    background: #667eea;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 12px;
    font-weight: bold;
}

.chat-widget-wrap .chat-widget-tips {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
}

.chat-widget-wrap .chat-widget-tips .chat-widget-label {
    color: #856404;
}

.chat-widget-wrap .chat-widget-risk-low { color: #00b894; }
.chat-widget-wrap .chat-widget-risk-medium { color: #f39c12; }
.chat-widget-wrap .chat-widget-risk-high { color: #e74c3c; }
.chat-widget-wrap .chat-widget-risk-extreme { color: #c0392b; }

@media (max-width: 768px) {
    .chat-widget-wrap {
        padding: 20px;
    }

    .chat-widget-wrap .chat-widget-header h2 {
        font-size: 21px;
    }

    .chat-widget-wrap .chat-widget-grid {
        grid-template-columns: 1fr;
    }
}
