/**
 * Crawler Panel Styles
 * 
 * Styles for the web crawler UI including:
 * - Modal overlay and container
 * - Step indicators
 * - Configuration form
 * - Progress display
 * - Content curation list
 * - Editor modal
 * - Toast notifications
 * 
 * @version 1.0.0
 * @date 2025-12-16
 */

/* ========================================
   MODAL OVERLAY & CONTAINER
   ======================================== */

.crawler-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.crawler-modal {
    background: var(--bg-primary, #ffffff);
    border-radius: 16px;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.crawler-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.crawler-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    display: flex;
    align-items: center;
    gap: 12px;
}

.crawler-modal-header h3 i {
    color: var(--theme-primary, #3b82f6);
}

.crawler-close-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.crawler-close-btn:hover {
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text-primary, #1f2937);
}

/* ========================================
   STEP INDICATORS
   ======================================== */

.crawler-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px;
    gap: 8px;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.crawler-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-primary, #ffffff);
    border: 1px solid var(--border-light, #e5e7eb);
    transition: all 0.2s ease;
}

.crawler-step .step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-tertiary, #e5e7eb);
    color: var(--text-muted, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.crawler-step .step-label {
    font-size: 14px;
    color: var(--text-secondary, #4b5563);
}

.crawler-step.active {
    background: linear-gradient(135deg, var(--theme-primary, #3b82f6), var(--theme-primary-dark, #2563eb));
    border-color: transparent;
}

.crawler-step.active .step-number {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.crawler-step.active .step-label {
    color: white;
    font-weight: 500;
}

.crawler-step.completed {
    background: var(--success-color, #10b981);
    border-color: transparent;
}

.crawler-step.completed .step-number {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.crawler-step.completed .step-label {
    color: white;
}

.crawler-step-arrow {
    color: var(--text-muted, #9ca3af);
    font-size: 18px;
}

/* ========================================
   CONTENT AREA
   ======================================== */

.crawler-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.crawler-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
    border-radius: 0 0 16px 16px;
}

/* ========================================
   CONFIGURE STEP
   ======================================== */

.crawler-configure {
    max-width: 600px;
    margin: 0 auto;
}

.crawler-configure h4 {
    margin: 0 0 24px 0;
    font-size: 18px;
    color: var(--text-primary, #1f2937);
}

.crawler-configure .form-group {
    margin-bottom: 20px;
}

.crawler-configure .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.crawler-configure .radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crawler-configure .radio-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.crawler-configure .radio-option:hover {
    border-color: var(--theme-primary, #3b82f6);
    background: var(--bg-secondary, #f9fafb);
}

.crawler-configure .radio-option input[type="radio"] {
    margin-top: 4px;
}

.crawler-configure .radio-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crawler-configure .radio-label strong {
    color: var(--text-primary, #1f2937);
}

.crawler-configure .radio-label small {
    color: var(--text-muted, #6b7280);
    font-size: 12px;
}

.crawler-usage-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 8px;
    color: var(--text-secondary, #4b5563);
    font-size: 13px;
    margin-top: 20px;
}

.crawler-usage-info i {
    color: var(--theme-primary, #3b82f6);
}

.crawler-limit-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: var(--danger-color, #ef4444);
    font-size: 13px;
    margin-top: 12px;
}

.crawler-limit-warning a {
    color: var(--danger-color, #ef4444);
    text-decoration: underline;
}

/* ----------------------------------------
   BILLING CARD (Configure Step)
   ---------------------------------------- */

.crawler-billing-card {
    background: linear-gradient(135deg, var(--bg-secondary, #f9fafb) 0%, var(--bg-primary, #ffffff) 100%);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.crawler-billing-card.crawler-disabled {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0.02) 100%);
    border-color: rgba(239, 68, 68, 0.2);
}

.billing-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

.billing-card-header i {
    color: var(--theme-primary, #3b82f6);
    font-size: 16px;
}

.crawler-disabled .billing-card-header i {
    color: #dc2626;
}

.billing-tier-badge {
    margin-left: auto;
    background: var(--theme-primary, #3b82f6);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.billing-card-stats {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
}

.billing-card-stats .stat-used {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.billing-card-stats .stat-divider {
    font-size: 20px;
    color: var(--text-muted, #9ca3af);
}

.billing-card-stats .stat-limit {
    font-size: 16px;
    color: var(--text-secondary, #6b7280);
}

.billing-card-stats .stat-percent {
    margin-left: auto;
    font-size: 14px;
    font-weight: 600;
}

.billing-card-bar {
    height: 8px;
    background: var(--border-light, #e5e7eb);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

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

.billing-card-remaining {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
}

.billing-card-remaining .overage-rate {
    color: var(--text-secondary, #6b7280);
}

.billing-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.billing-warning i {
    flex-shrink: 0;
}

.billing-disabled-message {
    text-align: center;
    padding: 20px 0;
}

.billing-disabled-message p {
    margin: 0 0 8px 0;
    color: var(--text-secondary, #6b7280);
    font-size: 14px;
}

.billing-disabled-message .upgrade-prompt {
    color: #dc2626;
    font-weight: 500;
    margin-bottom: 16px;
}

.crawler-configure .radio-option.disabled,
.crawler-configure .checkbox-group.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ========================================
   CRAWLING PROGRESS STEP
   ======================================== */

.crawler-progress {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.crawler-progress-header {
    margin-bottom: 32px;
}

.crawler-progress-header i {
    color: var(--theme-primary, #3b82f6);
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.crawler-progress-header h4 {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary, #1f2937);
}

.crawler-progress-bar-container {
    width: 100%;
    height: 12px;
    background: var(--bg-tertiary, #e5e7eb);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 24px;
}

.crawler-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--theme-primary, #3b82f6), var(--theme-primary-light, #60a5fa));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.crawler-progress-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 24px;
}

.progress-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.progress-stat .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.progress-stat .stat-label {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.crawler-current-url {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-secondary, #4b5563);
    word-break: break-all;
}

.crawler-current-url i {
    color: var(--theme-primary, #3b82f6);
    flex-shrink: 0;
}

.crawler-feed {
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: var(--text-secondary, #4b5563);
}

.crawler-content-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary, #4b5563);
}

.crawler-content-stats i {
    margin-right: 4px;
    color: var(--text-muted, #9ca3af);
}

/* ========================================
   CURATE STEP
   ======================================== */

.crawler-curate {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.curate-header {
    margin-bottom: 16px;
}

.curate-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.curate-filters select,
.curate-filters input {
    padding: 8px 12px;
    font-size: 13px;
}

.curate-filters input {
    flex: 1;
    min-width: 200px;
}

.curate-bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--theme-primary-light, #dbeafe);
    border-radius: 8px;
    margin-bottom: 16px;
}

.curate-bulk-actions #selectedCount {
    font-weight: 600;
    color: var(--theme-primary-dark, #1d4ed8);
}

.curate-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 8px;
}

.select-all-row {
    padding: 12px 16px;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.content-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    transition: background 0.2s ease;
}

.content-item:hover {
    background: var(--bg-secondary, #f9fafb);
}

.content-item:last-child {
    border-bottom: none;
}

.content-item-checkbox {
    flex-shrink: 0;
}

.content-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 8px;
    color: var(--text-muted, #6b7280);
    flex-shrink: 0;
}

.content-item-info {
    flex: 1;
    min-width: 0;
}

.content-item-title {
    font-weight: 500;
    color: var(--text-primary, #1f2937);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-item-meta {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-item-preview {
    font-size: 12px;
    color: var(--text-secondary, #4b5563);
    margin-top: 8px;
    line-height: 1.5;
}

.content-item-status {
    flex-shrink: 0;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
}

.content-item-collection {
    width: 180px;
    flex-shrink: 0;
}

.content-item-collection select {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
}

.content-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-primary, #ffffff);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-btn:hover {
    border-color: var(--theme-primary, #3b82f6);
    color: var(--theme-primary, #3b82f6);
}

.action-btn.approve:hover,
.action-btn.approve.active {
    background: var(--success-color, #10b981);
    border-color: var(--success-color, #10b981);
    color: white;
}

.action-btn.reject:hover,
.action-btn.reject.active {
    background: var(--danger-color, #ef4444);
    border-color: var(--danger-color, #ef4444);
    color: white;
}

.action-btn.edit:hover {
    background: var(--theme-primary, #3b82f6);
    border-color: var(--theme-primary, #3b82f6);
    color: white;
}

.curate-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
}

.curate-pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-primary, #ffffff);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary, #4b5563);
    transition: all 0.2s ease;
}

.curate-pagination button:hover {
    border-color: var(--theme-primary, #3b82f6);
    color: var(--theme-primary, #3b82f6);
}

.curate-pagination button.active {
    background: var(--theme-primary, #3b82f6);
    border-color: var(--theme-primary, #3b82f6);
    color: white;
}

.curate-summary {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
    margin-top: 16px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary, #4b5563);
}

.summary-item i {
    font-size: 14px;
}

.summary-item i.fa-check-circle { color: var(--success-color, #10b981); }
.summary-item i.fa-clock { color: var(--theme-primary, #3b82f6); }
.summary-item i.fa-times-circle { color: var(--danger-color, #ef4444); }

/* ========================================
   EDITOR MODAL
   ======================================== */

.crawler-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.crawler-editor-modal {
    background: var(--bg-primary, #ffffff);
    border-radius: 12px;
    width: 95%;
    max-width: 1100px;
    height: 90vh;
    max-height: 850px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

/* Header with tabs integrated */
.crawler-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
    gap: 16px;
}

.editor-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-type-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.editor-type-badge.html {
    background: #dbeafe;
    color: #1d4ed8;
}

.editor-type-badge.pdf {
    background: #fce7f3;
    color: #be185d;
}

.editor-type-badge.image {
    background: #d1fae5;
    color: #047857;
}

.editor-source-link {
    color: var(--text-muted, #6b7280);
    font-size: 12px;
    padding: 4px;
}

.editor-source-link:hover {
    color: var(--theme-primary, #3b82f6);
}

.editor-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-primary, #ffffff);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--border-light, #e5e7eb);
}

.editor-tab {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary, #4b5563);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
}

.editor-tab:hover {
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-primary, #1f2937);
}

.editor-tab.active {
    background: var(--theme-primary, #3b82f6);
    color: #ffffff;
}

/* Toolbar with title + collection side by side */
.crawler-editor-toolbar {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-primary, #ffffff);
}

.editor-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.editor-field .form-input {
    height: 34px;
    font-size: 13px;
    padding: 0 10px;
}

.title-field {
    flex: 2;
}

.collection-field {
    flex: 1;
    min-width: 200px;
}

.collection-input-group {
    display: flex;
    gap: 4px;
}

.collection-input-group select {
    flex: 1;
}

.btn-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 6px;
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-secondary, #4b5563);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: var(--theme-primary, #3b82f6);
    color: #ffffff;
    border-color: var(--theme-primary, #3b82f6);
}

/* Editor content area - maximize space */
.crawler-editor-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.editor-panel,
.preview-panel {
    flex: 1;
    border: none;
    border-radius: 0;
    overflow-y: auto;
    min-height: 0; /* Important for flex children to scroll */
}

.editor-panel textarea {
    width: 100%;
    min-height: 100%;
    padding: 16px;
    border: none;
    resize: none;
    font-family: 'Monaco', 'Consolas', 'SF Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: var(--bg-primary, #ffffff);
    color: var(--text-primary, #1f2937);
    box-sizing: border-box;
}

.editor-panel textarea:focus {
    outline: none;
}

.preview-panel {
    padding: 16px 20px;
    overflow-y: auto;
    background: var(--bg-primary, #ffffff);
}

#previewContent {
    line-height: 1.7;
    color: var(--text-primary, #1f2937);
    max-width: 800px;
}

#previewContent h1,
#previewContent h2,
#previewContent h3 {
    margin-top: 20px;
    margin-bottom: 10px;
}

#previewContent p {
    margin-bottom: 12px;
}

#previewContent a {
    color: var(--theme-primary, #3b82f6);
}

.compare-panel {
    display: flex;
    gap: 1px;
    flex: 1;
    background: var(--border-light, #e5e7eb);
    overflow: hidden;
    min-height: 0; /* Critical for flex children to scroll */
}

.compare-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #ffffff);
    overflow: hidden;
    min-height: 0; /* Critical for flex children to respect overflow */
}

.compare-side h5 {
    margin: 0;
    padding: 8px 16px;
    background: var(--bg-secondary, #f9fafb);
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.compare-side iframe,
.compare-side .compare-frame {
    flex: 1;
    border: none;
    width: 100%;
    min-height: 0;
    background: #fff;
    overflow: auto;
}

.compare-side .compare-content,
.compare-side #compareMarkdown {
    flex: 1;
    border: none;
    padding: 16px;
    overflow-y: auto;
    background: var(--bg-primary, #ffffff);
    min-height: 0;
    max-height: 100%; /* Constrain height to parent */
    line-height: 1.6;
}


/* Footer - compact */
.crawler-editor-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
}

.footer-spacer {
    flex: 1;
}

/* ========================================
   UPLOAD STEP
   ======================================== */

.crawler-upload {
    max-width: 600px;
    margin: 0 auto;
}

.crawler-upload h4 {
    margin: 0 0 24px 0;
    font-size: 18px;
    color: var(--text-primary, #1f2937);
    text-align: center;
}

.upload-summary {
    background: var(--bg-secondary, #f9fafb);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.upload-summary h5 {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--text-secondary, #4b5563);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 20px;
}

.upload-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-stat i {
    font-size: 24px;
    color: var(--theme-primary, #3b82f6);
}

.upload-stat .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.upload-stat .stat-label {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
}

.upload-total {
    text-align: center;
    font-size: 16px;
    color: var(--text-primary, #1f2937);
    padding-top: 16px;
    border-top: 1px solid var(--border-light, #e5e7eb);
}

.upload-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 16px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 6px;
    color: var(--warning-color, #f59e0b);
    font-size: 13px;
}

.upload-options {
    margin-bottom: 24px;
}

/* ========================================
   COMPLETE STEP
   ======================================== */

.crawler-complete {
    text-align: center;
    padding: 40px 20px;
}

.complete-icon {
    margin-bottom: 24px;
}

.complete-icon i {
    font-size: 64px;
    color: var(--success-color, #10b981);
}

.crawler-complete h4 {
    margin: 0 0 16px 0;
    font-size: 24px;
    color: var(--text-primary, #1f2937);
}

.crawler-complete p {
    color: var(--text-secondary, #4b5563);
    margin-bottom: 8px;
}

.crawler-complete p.warning {
    color: var(--warning-color, #f59e0b);
}

.crawler-complete p.info {
    color: var(--text-muted, #6b7280);
    font-size: 13px;
}

.crawler-complete p.error-detail {
    color: var(--text-muted, #6b7280);
    font-size: 13px;
}

/* Error state */
.crawler-complete.error .complete-icon i {
    color: var(--danger-color, #ef4444);
}

.crawler-complete.warning .complete-icon i {
    color: var(--warning-color, #f59e0b);
}

.complete-icon.error i {
    color: var(--danger-color, #ef4444);
}

.complete-icon.warning i {
    color: var(--warning-color, #f59e0b);
}

.error-list {
    text-align: left;
    max-width: 500px;
    margin: 24px auto 0;
    padding: 16px;
    background: var(--danger-bg, #fef2f2);
    border: 1px solid var(--danger-border, #fecaca);
    border-radius: 8px;
}

.error-list h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--danger-color, #ef4444);
}

.error-list ul {
    margin: 0;
    padding-left: 20px;
    font-size: 12px;
    color: var(--text-secondary, #4b5563);
}

.error-list li {
    margin-bottom: 4px;
}

.next-steps {
    text-align: left;
    max-width: 400px;
    margin: 32px auto 0;
    padding: 20px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 12px;
}

.next-steps h5 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text-primary, #1f2937);
}

.next-steps ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary, #4b5563);
}

.next-steps li {
    margin-bottom: 8px;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.crawler-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-primary, #ffffff);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    z-index: 10002;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.crawler-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.crawler-toast.success {
    border-left: 4px solid var(--success-color, #10b981);
}

.crawler-toast.success i { color: var(--success-color, #10b981); }

.crawler-toast.error {
    border-left: 4px solid var(--danger-color, #ef4444);
}

.crawler-toast.error i { color: var(--danger-color, #ef4444); }

.crawler-toast.warning {
    border-left: 4px solid var(--warning-color, #f59e0b);
}

.crawler-toast.warning i { color: var(--warning-color, #f59e0b); }

.crawler-toast.info {
    border-left: 4px solid var(--theme-primary, #3b82f6);
}

.crawler-toast.info i { color: var(--theme-primary, #3b82f6); }

/* ========================================
   NOTIFICATION BANNER
   ======================================== */

.crawler-notification-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--success-color, #10b981), #059669);
    color: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
    z-index: 10002;
}

.crawler-notification-banner button {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 13px;
}

.crawler-notification-banner button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.crawler-notification-banner .close-btn {
    background: none;
    padding: 4px 8px;
    font-size: 18px;
}

/* ========================================
   LOADING & EMPTY STATES
   ======================================== */

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted, #6b7280);
}

.loading-spinner i {
    font-size: 24px;
    color: var(--theme-primary, #3b82f6);
}

.empty-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted, #6b7280);
}

.empty-message i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: var(--danger-color, #ef4444);
}

/* ========================================
   DARK THEME
   ======================================== */

[data-theme="dark"] .crawler-modal,
[data-theme="dark"] .crawler-editor-modal {
    background: var(--bg-primary);
}

[data-theme="dark"] .crawler-modal-header,
[data-theme="dark"] .crawler-editor-header {
    border-color: var(--border-light);
}

[data-theme="dark"] .crawler-steps {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

[data-theme="dark"] .crawler-step {
    background: var(--bg-primary);
    border-color: var(--border-light);
}

[data-theme="dark"] .curate-list {
    border-color: var(--border-light);
}

[data-theme="dark"] .content-item {
    border-color: var(--border-light);
}

[data-theme="dark"] .action-btn {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

[data-theme="dark"] .editor-panel textarea {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .crawler-modal,
    .crawler-editor-modal {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .crawler-steps {
        flex-wrap: wrap;
        padding: 12px;
    }
    
    .crawler-step-arrow {
        display: none;
    }
    
    .crawler-configure .form-row {
        grid-template-columns: 1fr;
    }
    
    .curate-filters {
        flex-direction: column;
    }
    
    .curate-filters input {
        min-width: auto;
    }
    
    .content-item {
        flex-wrap: wrap;
    }
    
    .content-item-collection,
    .content-item-actions {
        width: 100%;
        margin-top: 12px;
    }
    
    .compare-panel {
        flex-direction: column;
    }
    
    .upload-stats {
        flex-direction: column;
        gap: 16px;
    }
}

/* ============================================
   Image Preview Styles
   ============================================ */

.image-preview-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.image-preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    overflow: hidden;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-preview-container.large {
    min-height: 400px;
}

.image-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6b7280);
    gap: 12px;
}

.image-error i {
    font-size: 48px;
    opacity: 0.5;
}

.image-error p {
    margin: 0;
    font-size: 14px;
}

.image-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px 0;
    border-top: 1px solid var(--border-light, #e5e7eb);
    margin-top: 20px;
}

.image-metadata .meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-metadata .meta-item label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
    letter-spacing: 0.5px;
}

.image-metadata .meta-item span,
.image-metadata .meta-item a {
    font-size: 13px;
    color: var(--text-primary, #1f2937);
    word-break: break-all;
}

.image-metadata .source-link {
    color: var(--theme-primary, #3b82f6);
    text-decoration: none;
}

.image-metadata .source-link:hover {
    text-decoration: underline;
}

.image-metadata .rag-filename,
.pdf-metadata .rag-filename {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12px;
    background: var(--bg-secondary, #f3f4f6);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--theme-primary, #3b82f6);
}

/* ========================================
   PDF PREVIEW STYLES
   ======================================== */

.pdf-preview-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

.pdf-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
    min-height: 400px;
    overflow: hidden;
    position: relative;
}

.pdf-preview-container iframe {
    flex: 1;
    border: none;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.pdf-preview-container embed {
    flex: 1;
    border: none;
    border-radius: 8px;
}

.pdf-fallback {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-secondary, #f9fafb);
}

.pdf-fallback i {
    font-size: 64px;
    color: #ef4444;
    opacity: 0.7;
}

.pdf-fallback p {
    color: var(--text-muted, #6b7280);
    margin: 0;
}

.btn-action.primary {
    background: var(--theme-primary, #3b82f6);
    color: white;
}

.btn-action.primary:hover {
    background: var(--theme-primary-dark, #2563eb);
}

.btn-action.large {
    padding: 12px 24px;
    font-size: 15px;
}

/* Mobile/Tablet PDF Card */
.pdf-preview-container.mobile-view {
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.pdf-mobile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 24px;
    max-width: 400px;
    width: 100%;
}

.pdf-icon-large {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.15);
}

.pdf-icon-large i {
    font-size: 56px;
    color: #dc2626;
}

.pdf-card-info h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    word-break: break-word;
}

.pdf-card-info p {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted, #6b7280);
}

.pdf-card-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.pdf-card-actions .btn-action {
    justify-content: center;
    width: 100%;
}

.pdf-preview-container.large {
    min-height: 500px;
}

.pdf-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6b7280);
    gap: 16px;
    padding: 40px;
    height: 100%;
}

.pdf-error i {
    font-size: 64px;
    color: #ef4444;
    opacity: 0.7;
}

.pdf-error p {
    margin: 0;
    font-size: 14px;
}

.pdf-error .btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--theme-primary, #3b82f6);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.pdf-error .btn-download:hover {
    background: var(--theme-primary-dark, #2563eb);
}

.pdf-metadata {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 16px 24px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
}

.pdf-metadata .meta-item {
    flex: 1 1 auto;
    min-width: 120px;
}

.pdf-metadata .meta-item.pdf-actions {
    flex: 0 0 auto;
    margin-left: auto;
}

.pdf-metadata .meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pdf-metadata .meta-item label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted, #6b7280);
    letter-spacing: 0.5px;
}

.pdf-metadata .meta-item span,
.pdf-metadata .meta-item a {
    font-size: 13px;
    color: var(--text-primary, #1f2937);
    word-break: break-all;
}

.pdf-metadata .source-link {
    color: var(--theme-primary, #3b82f6);
    text-decoration: none;
}

.pdf-metadata .source-link:hover {
    text-decoration: underline;
}

.pdf-metadata .pdf-actions {
    flex-direction: row;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.pdf-metadata .btn-action,
.image-metadata .btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text-primary, #1f2937);
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.pdf-metadata .btn-action:hover,
.image-metadata .btn-action:hover {
    background: var(--border-light, #e5e7eb);
}

.pdf-metadata .btn-action i,
.image-metadata .btn-action i {
    color: var(--theme-primary, #3b82f6);
    font-size: 12px;
}

.pdf-link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    background: var(--bg-primary, #ffffff);
    border: 2px dashed var(--border-light, #e5e7eb);
    border-radius: 8px;
    color: var(--text-secondary, #6b7280);
    text-decoration: none;
    transition: all 0.2s;
    height: 100%;
}

.pdf-link-card:hover {
    border-color: var(--theme-primary, #3b82f6);
    color: var(--theme-primary, #3b82f6);
}

.pdf-link-card i {
    font-size: 48px;
    color: #ef4444;
}

.pdf-link-card span {
    font-size: 14px;
    font-weight: 500;
}
