/**
 * AI Chat Interface - Styles
 *
 * @package AI_Chat_Interface
 */

.aci-chat-container {
    max-width: 600px;
    margin: 20px auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.aci-messages {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.aci-message {
    margin: 10px 0;
    padding: 10px 15px;
    border-radius: 6px;
    max-width: 80%;
    word-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.aci-message-content {
    flex: 1;
}

.aci-message-user {
    background: #007cba;
    color: #fff;
    margin-left: auto;
    text-align: right;
}

.aci-message-assistant {
    background: #e0e0e0;
    color: #333;
    margin-right: auto;
}

.aci-message-error {
    background: #f44336;
    color: #fff;
}

/* Copy Button */
.aci-copy-btn {
    align-self: flex-end;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 5px;
}

.aci-copy-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.05);
}

.aci-copy-btn:active {
    transform: scale(0.95);
}

.aci-message-assistant .aci-copy-btn {
    background: rgba(0, 0, 0, 0.08);
}

.aci-message-assistant .aci-copy-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.aci-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.aci-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    font-size: 14px;
}

.aci-input:focus {
    outline: none;
    border-color: #007cba;
}

.aci-send-btn {
    padding: 10px 20px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s ease;
}

.aci-send-btn:hover {
    background: #005a87;
}

.aci-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aci-loading {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 10px;
    font-size: 14px;
}

/* Scrollbar styling for messages */
.aci-messages::-webkit-scrollbar {
    width: 8px;
}

.aci-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.aci-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.aci-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Settings Panel */
.aci-settings-panel {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.aci-settings-panel h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.aci-setting-group {
    margin-bottom: 15px;
}

.aci-setting-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.aci-model-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.aci-model-select:focus {
    outline: none;
    border-color: #007cba;
}

.aci-system-message {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.aci-system-message:focus {
    outline: none;
    border-color: #007cba;
}

/* Chat Controls */
.aci-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.aci-clear-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.aci-clear-btn:hover {
    background: #c82333;
}

.aci-clear-btn:active {
    transform: scale(0.98);
}

.aci-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.aci-message-count,
.aci-total-cost {
    font-size: 13px;
    color: #666;
}

.aci-message-count strong,
.aci-total-cost strong {
    color: #333;
    font-weight: 600;
}

.aci-total-cost strong {
    color: #28a745; /* Green for cost */
}

/* Budget Warning Banner */
.aci-budget-warning {
    display: none;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.aci-budget-warning strong {
    font-weight: 700;
}

/* ─── Conversation Toolbar (TODO B) ────────────────────────────────────────── */

.aci-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.aci-toolbar button {
    padding: 5px 12px;
    font-size: 12px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    color: #444;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.aci-toolbar button:hover {
    background: #e8e8e8;
    border-color: #aaa;
}

.aci-toolbar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aci-toolbar .aci-toolbar-compact {
    border-color: #007cba;
    color: #007cba;
}

.aci-toolbar .aci-toolbar-compact:hover {
    background: #007cba;
    color: #fff;
}

.aci-toolbar .aci-toolbar-restore {
    border-color: #28a745;
    color: #28a745;
}

.aci-toolbar .aci-toolbar-restore:hover {
    background: #28a745;
    color: #fff;
}

/* Summary block rendered by Summarise button */
.aci-summary-block {
    background: #fff8e1;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 12px 15px;
    max-width: 100%;
    margin: 10px 0;
}

.aci-summary-block strong {
    display: block;
    margin-bottom: 6px;
    color: #856404;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.aci-summary-text {
    color: #555;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Notice shown after Compact & Continue */
.aci-compact-notice {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    border-radius: 6px;
    padding: 10px 15px;
    font-size: 13px;
    max-width: 100%;
    margin: 8px 0;
}

/* Auto-save privacy notice */
.aci-autosave-notice {
    background: #e8f4fd;
    border: 1px solid #b8d9f5;
    color: #31708f;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aci-notice-dismiss {
    background: none;
    border: none;
    color: #31708f;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

.aci-notice-dismiss:hover {
    color: #245269;
}

/* ─── Restore Conversation Modal (TODO C) ────────────────────────────────── */

.aci-restore-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aci-restore-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.aci-restore-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.aci-restore-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.aci-restore-modal-close:hover {
    color: #333;
}

.aci-restore-modal-content h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #333;
}

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

.aci-conversation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

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

.aci-conv-meta {
    flex: 1;
    font-size: 13px;
}

.aci-conv-title {
    font-weight: 600;
    color: #333;
    display: block;
}

.aci-conversation-load-btn {
    padding: 5px 12px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.aci-conversation-load-btn:hover {
    background: #005a87;
}

.aci-conversation-delete-btn {
    padding: 5px 10px;
    background: none;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.aci-conversation-delete-btn:hover {
    background: #dc3545;
    color: #fff;
}
