/**
 * Admin styles for AI Concierge Search
 *
 * @package Solun_ACS_Search
 */

/* Table Layout Adjustments */
.wp-list-table .ai-response-column {
    min-width: 300px;
    width: 40%;
}

.ai-response-cell {
    position: relative;
    min-width: 300px;
    max-width: none;
}

.ai-response-preview {
    margin-bottom: 8px;
    word-wrap: break-word;
}

.ai-response-full {
    margin-top: 8px;
    padding: 12px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    word-wrap: break-word;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
    line-height: 1.6;
}

.ai-response-full::-webkit-scrollbar {
    width: 8px;
}

.ai-response-full::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ai-response-full::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.ai-response-full::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.ai-response-cell .toggle-response {
    margin-top: 4px;
}

/* Unified Column Styles */
.wp-list-table td code {
    display: block;
    margin-top: 4px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ai-response-full {
        background-color: #2c3338;
        border-color: #3c434a;
        color: #f0f0f1;
    }
}

/* Session List Styles */
.session-list-container {
    margin-top: 20px;
}

.session-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.session-item {
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    transition: box-shadow 0.2s;
}

.session-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.session-link {
    display: block;
    padding: 16px;
    text-decoration: none;
    color: inherit;
}

.session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 12px;
}

.session-id {
    font-size: 13px;
    font-family: monospace;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 3px;
    font-weight: normal;
}

.session-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #2271b1;
}

.session-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.last-updated {
    display: inline-block;
}

/* Session Detail Styles */
.session-detail-container {
    margin-top: 20px;
}

.session-detail-container h2 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.session-detail-container h2 code {
    font-size: 14px;
    font-weight: normal;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 3px;
    margin-left: 8px;
}

.session-logs-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.log-item {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    padding: 16px;
    border-left: 4px solid #ddd;
}

.log-item.log-type-chat {
    border-left-color: #2271b1;
}

.log-item.log-type-search {
    border-left-color: #00a32a;
}

.log-item.log-type-error {
    border-left-color: #d63638;
}

.log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.log-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.log-type-badge.log-type-chat {
    background: #e7f3ff;
    color: #2271b1;
}

.log-type-badge.log-type-search {
    background: #e7f5e7;
    color: #00a32a;
}

.log-type-badge.log-type-error {
    background: #ffe7e7;
    color: #d63638;
}

.log-time {
    font-size: 12px;
    color: #666;
}

.log-content {
    margin-top: 12px;
}

.log-field {
    margin-bottom: 12px;
}

.log-field:last-child {
    margin-bottom: 0;
}

.log-field strong {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    color: #1d2327;
}

.log-field p {
    margin: 4px 0 0 0;
    word-wrap: break-word;
}

.log-field code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.solun-acs-log-turn {
    border-left: 4px solid #2271b1;
}

.solun-acs-turn-id-field code {
    font-size: 11px;
}

.solun-acs-pipeline-field-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.solun-acs-pipeline-field-header strong {
    display: inline;
    margin: 0;
    font-size: 13px;
}

.solun-acs-pipeline-panel {
    margin-top: 8px;
}

.solun-acs-pipeline-panel .solun-acs-pipeline {
    margin-top: 0;
}

.solun-acs-pipeline {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background: #fcfcfc;
}

.solun-acs-pipeline-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-bottom: 1px solid #dcdcde;
}

.solun-acs-pipeline-step:last-child {
    border-bottom: none;
}

.solun-acs-pipeline-step-num {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 50%;
    background: #2271b1;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.solun-acs-pipeline-step-body {
    flex: 1;
    min-width: 0;
}

.solun-acs-pipeline-step-title {
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    margin-bottom: 4px;
}

.solun-acs-pipeline-note {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #50575e;
}

.solun-acs-pipeline-sub {
    font-size: 12px;
    color: #50575e;
    margin-top: 4px;
}

.solun-acs-pipeline-queries {
    margin: 8px 0 0 0;
    padding-left: 1.2em;
    font-size: 12px;
}

.solun-acs-pipeline-queries li {
    margin-bottom: 4px;
}

.solun-acs-pipeline-query-ms {
    color: #646970;
}

.solun-acs-pipeline-duration {
    margin-top: 8px;
    font-size: 12px;
    color: #50575e;
}

.solun-acs-pipeline-duration strong {
    display: inline;
    margin-right: 4px;
    font-size: 12px;
    color: #1d2327;
}

.solun-acs-pipeline-tool-wrap {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    line-height: 1.5;
}

.solun-acs-pipeline-tool + .solun-acs-pipeline-tool {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #dcdcde;
}

.solun-acs-pipeline-tool-name {
    margin-bottom: 8px;
}

.solun-acs-pipeline-tool-kv {
    margin-top: 8px;
}

.solun-acs-pipeline-tool-label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: #1d2327;
}

.solun-acs-pipeline-tool-ol,
.solun-acs-pipeline-tool-ul {
    margin: 4px 0 0 0;
    padding-left: 1.4em;
}

.solun-acs-pipeline-tool-ol li,
.solun-acs-pipeline-tool-ul li {
    margin-bottom: 3px;
    word-break: break-word;
}

.solun-acs-pipeline-tool-ul.solun-acs-pipeline-tool-skipped code {
    color: #646970;
}

.solun-acs-pipeline-tool-budget {
    margin-top: 8px;
    font-size: 12px;
    color: #50575e;
}

.solun-acs-pipeline-tool-json {
    margin: 8px 0 0 0;
    padding: 8px;
    max-height: 240px;
    overflow: auto;
    font-size: 11px;
    line-height: 1.4;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 3px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Dark mode support for new styles */
@media (prefers-color-scheme: dark) {
    .session-item {
        border-color: #3c434a;
        background: #1d2327;
    }

    .session-id {
        background: #2c3338;
        color: #f0f0f1;
    }

    .stat-label {
        color: #a7aaad;
    }

    .session-detail-container h2 {
        border-bottom-color: #3c434a;
    }

    .session-detail-container h2 code {
        background: #2c3338;
        color: #f0f0f1;
    }

    .log-item {
        border-color: #3c434a;
        background: #1d2327;
    }

    .log-field strong {
        color: #f0f0f1;
    }

    .log-field code {
        background: #2c3338;
        color: #f0f0f1;
    }

    .solun-acs-pipeline {
        border-color: #3c434a;
        background: #1d2327;
    }

    .solun-acs-pipeline-step {
        border-bottom-color: #3c434a;
    }

    .solun-acs-pipeline-step-title {
        color: #f0f0f1;
    }

    .solun-acs-pipeline-note,
    .solun-acs-pipeline-sub,
    .solun-acs-pipeline-duration,
    .solun-acs-pipeline-query-ms {
        color: #a7aaad;
    }

    .solun-acs-pipeline-duration strong {
        color: #f0f0f1;
    }

    .solun-acs-pipeline-tool-wrap {
        border-color: #3c434a;
        background: #2c3338;
    }

    .solun-acs-pipeline-tool + .solun-acs-pipeline-tool {
        border-top-color: #3c434a;
    }

    .solun-acs-pipeline-tool-label {
        color: #f0f0f1;
    }

    .solun-acs-pipeline-tool-ul.solun-acs-pipeline-tool-skipped code {
        color: #a7aaad;
    }

    .solun-acs-pipeline-tool-budget {
        color: #a7aaad;
    }

    .solun-acs-pipeline-tool-json {
        background: #1d2327;
        border-color: #3c434a;
        color: #f0f0f1;
    }
}
