/**
 * AI Chat Assistant - Admin Styles
 */

/* Variables */
:root {
    --aca-primary: #667eea;
    --aca-secondary: #764ba2;
    --aca-success: #10b981;
    --aca-warning: #f59e0b;
    --aca-error: #ef4444;
    --aca-gray-50: #f9fafb;
    --aca-gray-100: #f3f4f6;
    --aca-gray-200: #e5e7eb;
    --aca-gray-300: #d1d5db;
    --aca-gray-600: #4b5563;
    --aca-gray-800: #1f2937;
}

/* Admin Wrap */
.chatly-admin-wrap {
    margin-right: 20px;
}

.chatly-admin-wrap h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 28px;
    font-weight: 600;
    color: var(--aca-gray-800);
}

.chatly-admin-wrap h1 .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: var(--aca-primary);
}

/* Nav Tabs */
.chatly-nav-tabs {
    margin-top: 20px !important;
    border-bottom: 1px solid var(--aca-gray-200);
}

.chatly-nav-tabs .nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--aca-gray-600);
    margin-bottom: -1px;
}

.chatly-nav-tabs .nav-tab:hover {
    color: var(--aca-primary);
    background: none;
}

.chatly-nav-tabs .nav-tab-active {
    color: var(--aca-primary);
    border-bottom-color: var(--aca-primary);
    background: none;
}

.chatly-nav-tabs .nav-tab .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Settings Content */
.chatly-settings-content {
    margin-top: 20px;
}

/* Settings Section */
.chatly-settings-section {
    background: #fff;
    border: 1px solid var(--aca-gray-200);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
}

.chatly-settings-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--aca-gray-800);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--aca-gray-100);
}

/* Form Tables */
.chatly-settings-section .form-table {
    margin: 0;
}

.chatly-settings-section .form-table th {
    padding: 15px 10px 15px 0;
    width: 200px;
    font-weight: 500;
    color: var(--aca-gray-800);
}

.chatly-settings-section .form-table td {
    padding: 15px 0;
}

.chatly-settings-section .form-table input[type="text"],
.chatly-settings-section .form-table input[type="password"],
.chatly-settings-section .form-table input[type="url"],
.chatly-settings-section .form-table input[type="email"],
.chatly-settings-section .form-table input[type="number"],
.chatly-settings-section .form-table select {
    border: 1px solid var(--aca-gray-300);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
}

.chatly-settings-section .form-table input:focus,
.chatly-settings-section .form-table select:focus,
.chatly-settings-section .form-table textarea:focus {
    border-color: var(--aca-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    outline: none;
}

.chatly-settings-section .form-table textarea {
    border: 1px solid var(--aca-gray-300);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    min-height: 100px;
}

.chatly-settings-section .description {
    color: var(--aca-gray-600);
    font-size: 13px;
    margin-top: 6px;
}

/* Toggle Switch */
.chatly-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.chatly-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.chatly-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--aca-gray-300);
    transition: 0.3s;
    border-radius: 24px;
}

.chatly-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.chatly-switch input:checked + .chatly-slider {
    background: linear-gradient(135deg, var(--aca-primary) 0%, var(--aca-secondary) 100%);
}

.chatly-switch input:checked + .chatly-slider:before {
    transform: translateX(24px);
}

/* Status Grid */
.chatly-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.chatly-status-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    background: var(--aca-gray-50);
    border-radius: 8px;
    border: 1px solid var(--aca-gray-100);
}

.chatly-status-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatly-status-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: white;
}

.chatly-status-icon.status-ok {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.chatly-status-icon.status-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.chatly-status-icon.status-off {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.chatly-status-icon.status-info {
    background: linear-gradient(135deg, var(--aca-primary) 0%, var(--aca-secondary) 100%);
}

.chatly-status-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--aca-gray-600);
}

.chatly-status-info p {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--aca-gray-800);
}

/* Provider Selector */
.chatly-provider-selector {
    display: flex;
    gap: 16px;
}

.chatly-provider-option {
    flex: 1;
    cursor: pointer;
}

.chatly-provider-option input {
    display: none;
}

.chatly-provider-card {
    padding: 20px;
    border: 2px solid var(--aca-gray-200);
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s;
}

.chatly-provider-card strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--aca-gray-800);
}

.chatly-provider-card span {
    font-size: 13px;
    color: var(--aca-gray-600);
}

.chatly-provider-option.selected .chatly-provider-card,
.chatly-provider-option input:checked + .chatly-provider-card {
    border-color: var(--aca-primary);
    background: rgba(102, 126, 234, 0.05);
}

.chatly-provider-option:hover .chatly-provider-card {
    border-color: var(--aca-primary);
}

/* Password Toggle */
.chatly-toggle-password {
    margin-left: 5px !important;
    vertical-align: middle;
}

/* Test API Button */
.chatly-test-api {
    margin-left: 5px !important;
}

.chatly-test-result {
    display: inline-block;
    margin-left: 10px;
    font-size: 13px;
}

.chatly-test-result.success {
    color: var(--aca-success);
}

.chatly-test-result.error {
    color: var(--aca-error);
}

/* Appearance Layout */
.chatly-appearance-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
}

@media (max-width: 1200px) {
    .chatly-appearance-layout {
        grid-template-columns: 1fr;
    }
}

.chatly-appearance-preview {
    background: var(--aca-gray-100);
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 50px;
}

.chatly-appearance-preview h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
}

.chatly-preview-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-height: 300px;
    position: relative;
}

/* Color Picker */
.wp-picker-container {
    display: inline-block;
}

.wp-picker-container .wp-color-result.button {
    margin: 0;
    border-radius: 4px;
}

/* Settings Footer */
.chatly-settings-footer {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: white;
    border: 1px solid var(--aca-gray-200);
    border-radius: 8px;
    margin-top: 20px;
}

.chatly-settings-footer .button-primary {
    background: linear-gradient(135deg, var(--aca-primary) 0%, var(--aca-secondary) 100%);
    border: none;
    padding: 8px 24px;
    height: auto;
    font-size: 14px;
    border-radius: 6px;
}

.chatly-settings-footer .button-primary:hover,
.chatly-settings-footer .button-primary:focus {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.chatly-save-status {
    font-size: 13px;
    color: var(--aca-gray-600);
}

/* Prompt Tips */
.chatly-prompt-tips {
    margin-top: 15px;
    padding: 15px;
    background: var(--aca-gray-50);
    border-radius: 6px;
    font-size: 13px;
}

.chatly-prompt-tips strong {
    display: block;
    margin-bottom: 10px;
    color: var(--aca-gray-800);
}

.chatly-prompt-tips ul {
    margin: 0;
    padding-left: 20px;
}

.chatly-prompt-tips li {
    margin-bottom: 5px;
    color: var(--aca-gray-600);
}

/* Integration Settings */
.chatly-integration-settings {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--aca-gray-100);
}

/* Status Badges */
.chatly-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.chatly-status-badge.status-new {
    background: #dbeafe;
    color: #1d4ed8;
}

.chatly-status-badge.status-contacted {
    background: #fef3c7;
    color: #d97706;
}

.chatly-status-badge.status-converted {
    background: #d1fae5;
    color: #059669;
}

/* Empty State */
.chatly-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--aca-gray-50);
    border-radius: 8px;
}

.chatly-empty-state .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: var(--aca-gray-300);
    margin-bottom: 15px;
}

.chatly-empty-state h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: var(--aca-gray-600);
}

.chatly-empty-state p {
    margin: 0;
    color: var(--aca-gray-600);
}

/* Coming Soon */
.chatly-coming-soon {
    text-align: center;
    padding: 80px 20px;
    background: var(--aca-gray-50);
    border-radius: 8px;
}

.chatly-coming-soon .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: var(--aca-primary);
    margin-bottom: 20px;
}

.chatly-coming-soon h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: var(--aca-gray-800);
}

.chatly-coming-soon p {
    margin: 0;
    font-size: 16px;
    color: var(--aca-gray-600);
}

/* Responsive */
@media (max-width: 782px) {
    .chatly-provider-selector {
        flex-direction: column;
    }
    
    .chatly-status-grid {
        grid-template-columns: 1fr;
    }
    
    .chatly-settings-section .form-table th {
        width: auto;
        display: block;
        padding-bottom: 5px;
    }
    
    .chatly-settings-section .form-table td {
        display: block;
        padding-top: 0;
    }
}

/* License Status */
.chatly-license-status {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.chatly-license-status.status-valid { background: #d1fae5; color: #059669; }
.chatly-license-status.status-developer { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #ffffff; }
.chatly-license-status.status-inactive { background: #f3f4f6; color: #6b7280; }
.chatly-license-status.status-expired, .chatly-license-status.status-invalid, .chatly-license-status.status-disabled { background: #fee2e2; color: #dc2626; }
.chatly-license-status.status-grace { background: #fef3c7; color: #d97706; }
.chatly-license-result { display: inline-block; margin-left: 10px; font-size: 13px; }
.chatly-license-result.success { color: #059669; }
.chatly-license-result.error { color: #dc2626; }
.chatly-developer-notice { display: flex; align-items: flex-start; gap: 16px; background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%); border: 2px solid #667eea; border-radius: 12px; padding: 20px; }
.chatly-developer-notice .dashicons { font-size: 40px; width: 40px; height: 40px; color: #667eea; }
.chatly-developer-notice h3 { margin: 0 0 8px 0; font-size: 18px; color: #667eea; }
.chatly-developer-notice p { margin: 0 0 4px 0; color: #6b7280; }

/* Modal */
.chatly-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 100000; display: flex; align-items: center; justify-content: center; }
.chatly-modal-content { background: #fff; border-radius: 8px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.chatly-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e5e7eb; }
.chatly-modal-header h3 { margin: 0; font-size: 18px; }
.chatly-modal-close { background: none; border: none; font-size: 28px; cursor: pointer; color: #6b7280; }
.chatly-modal-body { padding: 20px; }
.chatly-modal-body label { display: block; font-weight: 500; margin-bottom: 5px; }
.chatly-modal-body p { margin: 0 0 15px 0; }
.chatly-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid #e5e7eb; background: #f9fafb; }

/* Stats Grid */
.chatly-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.chatly-stat-box { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; text-align: center; }
.chatly-stat-number { font-size: 32px; font-weight: 700; color: #667eea; }
.chatly-stat-label { font-size: 14px; color: #6b7280; margin-top: 5px; }

/* Conversation Messages */
.chatly-msg { padding: 10px 14px; margin-bottom: 10px; border-radius: 8px; }
.chatly-msg-user { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; margin-left: 20%; }
.chatly-msg-bot { background: #f3f4f6; color: #333; margin-right: 20%; }
.chatly-msg strong { display: block; font-size: 12px; margin-bottom: 4px; opacity: 0.8; }

/* Empty State */
.chatly-empty-state { text-align: center; padding: 60px 20px; background: #f9fafb; border-radius: 8px; }
.chatly-empty-state .dashicons { font-size: 48px; width: 48px; height: 48px; color: #d1d5db; }
.chatly-empty-state h3 { margin: 16px 0 8px; color: #374151; }
.chatly-empty-state p { color: #6b7280; margin: 0; }
