/**
 * MAI Smart Assistant - Settings Page Styles
 *
 * @package MAI_SMART_ASSISTANT
 * @since 1.0.0
 */

/* ========================================
   General Settings Page
   ======================================== */
.mai-smart-assistant-settings {
    max-width: 1200px;
}

.mai-smart-assistant-settings .nav-tab-wrapper {
    margin-bottom: 20px;
}

.mai-smart-assistant-settings .nav-tab {
    font-size: 14px;
}

.mai-smart-assistant-settings .nav-tab .dashicons {
    margin-right: 5px;
    font-size: 16px;
    vertical-align: middle;
}

/* ========================================
   Utility Classes
   ======================================== */
.mai-icon-padding {
    padding-top: 4px;
}

.mai-smart-assistant-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 8px;
}

/* ========================================
   Provider Cards
   ======================================== */
.mai-smart-assistant-provider-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.mai-smart-assistant-provider-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.mai-smart-assistant-provider-card.configured {
    border-left: 4px solid #46b450;
}

/* Enhanced admin notices */
.mai-smart-assistant-providers .notice {
    margin: 20px 0;
    padding: 15px;
    border-left-width: 4px;
    font-size: 14px;
}

.mai-smart-assistant-providers .notice-success {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.mai-smart-assistant-providers .notice-error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.mai-smart-assistant-providers .notice strong {
    font-weight: 600;
    display: inline-block;
    margin-right: 5px;
}

.mai-smart-assistant-providers .notice p {
    margin: 0.5em 0;
    line-height: 1.5;
}

.mai-smart-assistant-providers .notice.is-dismissible {
    padding-right: 38px;
}

.mai-smart-assistant-provider-card:not(.configured) {
    border-left: 4px solid #dc3232;
}

.mai-smart-assistant-provider-card .provider-header h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mai-smart-assistant-provider-card .status-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 3px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mai-smart-assistant-provider-card .status-badge.configured {
    background: #d7f5dc;
    color: #2e7d32;
}

.mai-smart-assistant-provider-card .status-badge.not-configured {
    background: #fce4e4;
    color: #c62828;
}

.mai-smart-assistant-provider-card .status-badge .dashicons {
    font-size: 14px;
}

.mai-smart-assistant-provider-card .provider-field {
    margin-bottom: 15px;
}

.mai-smart-assistant-provider-card .provider-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.mai-smart-assistant-provider-card .provider-field .required {
    color: #dc3232;
}

.mai-smart-assistant-provider-card .provider-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.mai-smart-assistant-provider-card .provider-test-result {
    margin-top: 15px;
    padding: 12px;
    border-radius: 3px;
    font-size: 13px;
}

.mai-smart-assistant-provider-card .provider-test-result.success {
    background: #d7f5dc;
    border-left: 4px solid #46b450;
}

.mai-smart-assistant-provider-card .provider-test-result.error {
    background: #fce4e4;
    border-left: 4px solid #dc3232;
}

.mai-smart-assistant-provider-card .provider-test-result p {
    margin: 5px 0;
}

.mai-smart-assistant-provider-card .provider-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dcdcde;
}

.mai-smart-assistant-provider-card .provider-info h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.mai-smart-assistant-provider-card .provider-models {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mai-smart-assistant-provider-card .provider-models li code {
    background: #f0f0f1;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
}

/* ========================================
   Spinning Animation
   ======================================== */
.dashicons.spinning {
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Training Page
   ======================================== */
.mai-smart-assistant-stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mai-smart-assistant-bulk-actions {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.mai-smart-assistant-bulk-actions h3 {
    margin: 0 0 15px 0;
}

.bulk-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bulk-index-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #f0f0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.progress-text {
    font-size: 13px;
    color: #646970;
    margin: 0;
}

.mai-smart-assistant-content-list {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.mai-smart-assistant-content-list h3 {
    margin: 0 0 15px 0;
}

/* ========================================
   Predefined Questions
   ======================================== */
.predefined-question-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.predefined-question-item input[type="text"] {
    flex: 1;
}

.predefined-question-item .remove-question {
    flex-shrink: 0;
}

#mai-smart-assistant-add-question {
    margin-top: 10px;
}

/* ========================================
   Analytics Dashboard
   ======================================== */
.mai-smart-assistant-analytics-dashboard {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 30px;
    margin-top: 20px;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 768px) {
    .mai-smart-assistant-provider-cards {
        grid-template-columns: 1fr;
    }

    .mai-smart-assistant-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .bulk-action-buttons {
        flex-direction: column;
    }

    .bulk-action-buttons .button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .mai-smart-assistant-stats-cards {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Visibility Classes for Inline Style Replacement
   ======================================== */
/* Initial hidden state for custom model input */
.mai-smart-assistant-custom-model-input {
    display: none;
    margin-top: 8px;
}

/* Visible state for when custom model input should be shown */
.mai-smart-assistant-custom-model-input.mai-smart-assistant-visible {
    display: block;
}

/* Visibility classes for provider elements */
#mai-smart-assistant-provider-notice,
.provider-result {
    display: none;
}

#mai-smart-assistant-provider-notice.mai-smart-assistant-visible,
.provider-result.mai-smart-assistant-visible {
    display: block;
}

/* Avatar preview styles */
.mai-smart-assistant-avatar-preview img {
    max-width: 60px;
    max-height: 60px;
    border-radius: 50%;
    display: block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Inline style replacement classes */
.mai-smart-assistant-border-radius-input {
    width: 200px;
}

.mai-smart-assistant-remove-avatar {
    display: none;
}

.mai-smart-assistant-avatar-preview-container {
    margin-top: 10px;
}

.mai-smart-assistant-block-label {
    display: block;
    margin-bottom: 8px;
}

.mai-smart-assistant-post-type-name {
    color: #666;
    font-size: 12px;
}

.mai-smart-assistant-indented-description {
    margin-left: 24px;
    margin-top: 4px;
}

.mai-smart-assistant-block-label-no-margin {
    display: block;
}

/* Loading and modal styles */
.analytics-loading,
.automation-loading,
.mai-smart-assistant-modal,
.notice.notice-error#task-error {
    display: none;
}

.analytics-loading.mai-smart-assistant-visible,
.automation-loading.mai-smart-assistant-visible,
.mai-smart-assistant-modal.mai-smart-assistant-visible,
.notice.notice-error#task-error.mai-smart-assistant-visible {
    display: block;
}

.mai-smart-assistant-remove-avatar.mai-smart-assistant-visible {
    display: inline-block;
}

/* Additional classes for remaining inline styles */
.mai-smart-assistant-block-label {
    display: block;
    margin-bottom: 8px;
}

.mai-smart-assistant-indented-description {
    margin-left: 24px;
    margin-top: 4px;
}

.mai-smart-assistant-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
