/**
 * Process Image Extraction Tool Styles
 */

/* Container */
.process-image-extraction {
    padding: 20px;
}

.process-image-extraction .tool-header {
    margin-bottom: 30px;
    position: relative;
}

/* Backend Status Indicator */
.backend-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-secondary, #181825);
    border-radius: 6px;
    font-size: 13px;
    margin-top: 10px;
}

.backend-status .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary, #a6adc8);
}

.backend-status .status-text {
    color: var(--text-secondary, #a6adc8);
}

.backend-status.connected .status-text {
    color: var(--success, #a6e3a1);
}

.backend-status.disconnected .status-text {
    color: var(--error, #f38ba8);
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 2px dashed var(--border-color, #45475a);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    background: var(--bg-secondary, #181825);
    transition: border-color 0.2s;
    cursor: pointer;
}

.upload-area.dragover {
    border-color: var(--accent-primary, #89b4fa);
}

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

.upload-icon {
    color: var(--text-secondary, #a6adc8);
    opacity: 0.7;
}

.upload-area h3 {
    margin: 0;
    color: var(--text-primary, #cdd6f4);
}

.upload-area p {
    margin: 0;
    color: var(--text-secondary, #a6adc8);
}

.upload-hint {
    font-size: 12px;
    opacity: 0.7;
}

/* Image Preview */
.image-preview-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-secondary, #181825);
    border-radius: 12px;
    border: 1px solid var(--border-color, #45475a);
}

.image-preview-section h3 {
    margin: 0 0 15px 0;
}

.image-preview-container {
    max-height: 400px;
    overflow: auto;
    border-radius: 8px;
    background: var(--bg-tertiary, #11111b);
    padding: 10px;
}

.preview-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

.preview-info {
    margin-top: 15px;
    padding: 10px;
    background: var(--bg-tertiary, #11111b);
    border-radius: 6px;
}

.preview-info .filename {
    font-family: monospace;
    font-size: 14px;
    color: var(--text-secondary, #a6adc8);
}

.preview-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Model Selection Section */
.model-selection-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-secondary, #181825);
    border-radius: 12px;
    border: 1px solid var(--border-color, #45475a);
}

.model-selection-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: var(--text-primary, #cdd6f4);
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.model-dropdown {
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #45475a);
    background: var(--bg-tertiary, #11111b);
    color: var(--text-primary, #cdd6f4);
    font-size: 14px;
    min-width: 200px;
    cursor: pointer;
}

.model-dropdown:focus {
    outline: none;
    border-color: var(--accent-primary, #89b4fa);
}

.model-dropdown option {
    background: var(--bg-tertiary, #11111b);
    color: var(--text-primary, #cdd6f4);
    padding: 8px;
}

.model-hint {
    font-size: 13px;
    color: var(--text-secondary, #a6adc8);
}

/* Info Section */
.info-section {
    margin-top: 40px;
}

.info-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary, #cdd6f4);
}

/* How it works section */
.how-it-works {
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #45475a);
    background: var(--bg-secondary, #181825);
}

.how-it-works p {
    margin: 0 0 12px 0;
    color: var(--text-secondary, #a6adc8);
    font-size: 14px;
    line-height: 1.6;
}

.how-it-works p:last-child {
    margin-bottom: 0;
}

/* Processing Section */
.processing-section-simple {
    text-align: center;
    padding: 80px 40px;
}

.processing-section-simple h3 {
    margin: 0 0 10px 0;
    color: var(--text-primary, #cdd6f4);
}

.processing-section-simple p {
    margin: 0;
    color: var(--text-secondary, #a6adc8);
    font-size: 14px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color, #45475a);
    border-top-color: var(--accent-primary, #89b4fa);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results Section */
.results-summary {
    margin-bottom: 30px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.summary-card {
    padding: 20px;
    background: var(--bg-secondary, #181825);
    border-radius: 8px;
    border: 1px solid var(--border-color, #45475a);
    text-align: center;
}

.summary-card .card-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--accent-primary, #89b4fa);
}

.summary-card .card-label {
    font-size: 12px;
    color: var(--text-secondary, #a6adc8);
    margin-top: 5px;
}

/* Results Comparison */
.results-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.comparison-panel {
    background: var(--bg-secondary, #181825);
    border-radius: 8px;
    border: 1px solid var(--border-color, #45475a);
    padding: 20px;
}

.comparison-panel h3 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color, #45475a);
}

.comparison-image {
    max-height: 400px;
    overflow: auto;
}

.comparison-image img {
    max-width: 100%;
    border-radius: 4px;
}

.extracted-elements-list {
    max-height: 400px;
    overflow-y: auto;
}

.element-group {
    margin-bottom: 20px;
}

.element-group h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--text-secondary, #a6adc8);
}

.element-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.element-group li {
    padding: 8px 12px;
    background: var(--bg-tertiary, #11111b);
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 14px;
}

.element-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
}

.element-type.task {
    background: var(--accent-primary, #89b4fa);
    color: var(--bg-primary, #1e1e2e);
}

.element-type.gateway {
    background: var(--warning, #f9e2af);
    color: var(--bg-primary, #1e1e2e);
}

.element-type.event {
    background: var(--success, #a6e3a1);
    color: var(--bg-primary, #1e1e2e);
}

.no-elements {
    color: var(--text-secondary, #a6adc8);
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.result-note {
    text-align: center;
    padding: 15px;
}

.result-note p {
    margin: 0;
    color: var(--text-secondary, #a6adc8);
    font-size: 14px;
}

/* Error Section */
.error-section {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.error-message {
    padding: 30px;
    background: var(--bg-secondary, #181825);
    border-radius: 8px;
    border: 1px solid var(--error, #f38ba8);
    margin-bottom: 30px;
}

.error-message h3 {
    color: var(--error, #f38ba8);
    margin: 0 0 10px 0;
}

.error-suggestions {
    text-align: left;
    padding: 20px;
    background: var(--bg-secondary, #181825);
    border-radius: 8px;
    margin-bottom: 30px;
}

.error-suggestions h4 {
    margin: 0 0 15px 0;
}

.error-suggestions ul {
    margin: 0;
    padding-left: 20px;
}

.error-suggestions li {
    margin-bottom: 8px;
    color: var(--text-secondary, #a6adc8);
}

.error-actions {
    margin-top: 20px;
}

/* ── Evaluation Section ──────────────────────────────────────────────── */
.evaluation-section {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #313244);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.evaluation-section h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: var(--text-primary, #cdd6f4);
    display: flex;
    align-items: center;
    gap: 8px;
}

.eval-badge {
    font-size: 11px;
    font-weight: 500;
    background: var(--accent-blue, #89b4fa);
    color: #1e1e2e;
    border-radius: 4px;
    padding: 2px 6px;
}

.eval-description {
    font-size: 13px;
    color: var(--text-muted, #6c7086);
    margin: 0 0 14px 0;
}

.eval-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.eval-filename {
    font-size: 13px;
    color: var(--text-secondary, #a6adc8);
}

.eval-error {
    background: rgba(243, 139, 168, 0.1);
    border: 1px solid #f38ba8;
    border-radius: 6px;
    padding: 10px 14px;
    color: #f38ba8;
    font-size: 13px;
    margin-top: 12px;
}

.eval-results {
    margin-top: 16px;
}

.eval-counts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary, #a6adc8);
}

.eval-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.eval-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #6c7086);
    border-bottom: 1px solid var(--border-color, #313244);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.eval-table td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(49, 50, 68, 0.5);
    vertical-align: middle;
    color: var(--text-secondary, #a6adc8);
}

.eval-table td:nth-child(2) {
    font-weight: 600;
    color: var(--text-primary, #cdd6f4);
    white-space: nowrap;
}

.eval-table td:last-child {
    font-size: 12px;
    color: var(--text-muted, #6c7086);
    max-width: 260px;
}

.eval-section-header td {
    background: rgba(49, 50, 68, 0.5);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary, #a6adc8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 10px;
}

.eval-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eval-bar {
    height: 8px;
    border-radius: 4px;
    min-width: 2px;
    transition: width 0.4s ease;
}

.eval-bar.good   { background: #a6e3a1; }
.eval-bar.medium { background: #fab387; }
.eval-bar.poor   { background: #f38ba8; }

.eval-bar-wrap span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #cdd6f4);
    white-space: nowrap;
}

.eval-na {
    color: var(--text-muted, #6c7086);
    font-size: 12px;
}

.eval-ref {
    font-size: 11px;
    color: var(--text-muted, #6c7086);
    font-weight: 400;
}

.eval-ref-note {
    font-size: 11px;
    color: var(--text-muted, #6c7086);
    margin-top: 12px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .results-comparison {
        grid-template-columns: 1fr;
    }

    .processing-section {
        flex-direction: column;
    }

    .image-preview-small {
        width: 100%;
    }
}
