/**
 * ChatReact Admin Styles
 * Light Mode - Dashboard-inspired design
 */

/* ChatReact menu icon in WordPress admin sidebar */
#adminmenu .toplevel_page_chatreact .wp-menu-image img {
    padding: 2px 0 0;
    opacity: 1;
    width: 30px;
}

/* Reset WordPress admin styles for our container */
.chatreact-admin-wrap {
    margin: 0;
    padding: 0;
    margin-left: -20px;
    margin-top: -10px;
    min-height: 100vh;
}

/* Light theme container */
.chatreact-admin {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
    min-height: 100vh;
    padding: 24px 32px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1e293b;
}

/* Header */
.chatreact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

.chatreact-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chatreact-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
    flex-shrink: 0;
}

.chatreact-logo-container svg {
    width: 24px;
    height: 24px;
    color: white;
}

.chatreact-header-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.chatreact-header-subtitle {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: #64748b;
}

.chatreact-header-right {
    display: flex;
    gap: 12px;
}

/* Buttons */
.chatreact-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.chatreact-btn-primary {
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.chatreact-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
    color: white;
}

.chatreact-btn-secondary {
    background: white;
    color: #475569;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chatreact-btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.chatreact-btn-ghost {
    background: transparent;
    color: #64748b;
    padding: 8px 12px;
}

.chatreact-btn-ghost:hover {
    color: #1e293b;
    background: rgba(0, 0, 0, 0.05);
}

.chatreact-btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.chatreact-btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.chatreact-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Tabs */
.chatreact-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: white;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chatreact-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatreact-tab:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.chatreact-tab.active {
    color: #7c3aed;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
}

.chatreact-tab svg {
    width: 18px;
    height: 18px;
}

.chatreact-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    border-radius: 10px;
    color: white;
}

/* Tab Content */
.chatreact-tab-content {
    display: none;
}

.chatreact-tab-content.active {
    display: block;
}

/* Cards */
.chatreact-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chatreact-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.chatreact-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.chatreact-card-title svg {
    width: 20px;
    height: 20px;
    color: #8b5cf6;
}

.chatreact-card-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #64748b;
}

/* Widget Assignment Table */
.chatreact-assignments-table {
    width: 100%;
    border-collapse: collapse;
}

.chatreact-assignments-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
}

.chatreact-assignments-table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.chatreact-assignments-table tr:hover td {
    background: #f8fafc;
}

.chatreact-assignments-table .chatreact-assignment-page {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatreact-page-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 10px;
}

.chatreact-page-icon svg {
    width: 18px;
    height: 18px;
    color: #8b5cf6;
}

.chatreact-page-icon-everywhere {
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
}

.chatreact-page-icon-everywhere svg {
    color: white;
}

.chatreact-page-title {
    font-weight: 500;
    color: #1e293b;
}

.chatreact-page-type {
    font-size: 12px;
    color: #64748b;
}

.chatreact-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
}

.chatreact-badge-purple {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.chatreact-badge-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.chatreact-badge-green {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

/* Action buttons in table */
.chatreact-actions {
    display: flex;
    gap: 4px;
}

/* Empty State */
.chatreact-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.chatreact-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 20px;
    margin-bottom: 24px;
}

.chatreact-empty-icon svg {
    width: 40px;
    height: 40px;
    color: #8b5cf6;
    opacity: 0.6;
}

.chatreact-empty-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.chatreact-empty-text {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: #64748b;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Form Elements */
.chatreact-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.chatreact-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatreact-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    letter-spacing: -0.01em;
}

.chatreact-admin .chatreact-input,
.chatreact-admin input[type="text"].chatreact-input {
    padding: 10px 16px;
    font-size: 14px;
    color: #1e293b;
    background: white;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    height: 42px;
    box-sizing: border-box;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.chatreact-admin .chatreact-input:hover,
.chatreact-admin input[type="text"].chatreact-input:hover {
    border-color: #cbd5e1 !important;
}

.chatreact-admin .chatreact-input:focus,
.chatreact-admin input[type="text"].chatreact-input:focus {
    outline: none !important;
    border-color: #8b5cf6 !important;
    background: white;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.chatreact-admin .chatreact-input::placeholder {
    color: #94a3b8;
}

/* Custom Searchable Select */
.chatreact-select-wrapper {
    position: relative;
}

.chatreact-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 14px;
    color: #1e293b;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    height: 42px;
    box-sizing: border-box;
}

.chatreact-select-trigger:hover {
    border-color: #cbd5e1;
}

.chatreact-select-trigger.open {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.chatreact-select-trigger .placeholder {
    color: #94a3b8;
}

.chatreact-select-trigger .selected-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatreact-select-trigger .selected-type {
    font-size: 11px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.chatreact-select-trigger svg {
    width: 18px;
    height: 18px;
    color: #64748b;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.chatreact-select-trigger.open svg {
    transform: rotate(180deg);
}

.chatreact-admin .chatreact-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #8b5cf6;
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none !important;
    max-height: 320px;
    overflow: hidden;
}

.chatreact-admin .chatreact-select-dropdown.open {
    display: block !important;
}

.chatreact-select-search {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.chatreact-select-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.chatreact-select-search input:focus {
    outline: none;
    border-color: #8b5cf6;
    background-color: white;
}

.chatreact-select-search input::placeholder {
    color: #94a3b8;
}

.chatreact-select-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px;
}

.chatreact-select-group {
    margin-bottom: 8px;
}

.chatreact-select-group:last-child {
    margin-bottom: 0;
}

.chatreact-select-group-label {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chatreact-select-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font-size: 14px;
    color: #1e293b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chatreact-select-option:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
}

.chatreact-select-option.selected {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.12) 100%);
    color: #7c3aed;
    font-weight: 500;
}

.chatreact-select-option .option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 8px;
    flex-shrink: 0;
}

.chatreact-select-option .option-icon svg {
    width: 16px;
    height: 16px;
    color: #8b5cf6;
}

.chatreact-select-option .option-content {
    flex: 1;
    min-width: 0;
}

.chatreact-select-option .option-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatreact-select-option .option-type {
    font-size: 12px;
    color: #64748b;
}

.chatreact-select-no-results {
    padding: 24px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

/* Everywhere option styling */
.chatreact-select-option-everywhere {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-bottom: none;
    margin: 0 8px 0 8px;
    border-radius: 8px;
}

.chatreact-select-option-everywhere:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.12) 100%) !important;
}

.chatreact-select-option-everywhere .option-icon-everywhere {
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
}

.chatreact-select-option-everywhere .option-icon-everywhere svg {
    color: white;
}

.chatreact-select-option .option-subtitle {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.chatreact-select-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 8px 16px;
}

/* Hidden native select for form submission */
.chatreact-native-select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Action Bar */
.chatreact-action-bar {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.chatreact-btn-save {
    padding: 12px 24px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.chatreact-btn-save:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

/* New Row Styling */
.chatreact-new-row {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%) !important;
}

.chatreact-new-row td {
    padding: 12px 16px !important;
}

/* Inline Select */
.chatreact-inline-select-wrapper {
    position: relative;
}

.chatreact-inline-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 13px;
    color: #1e293b;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
}

.chatreact-inline-select-trigger:hover {
    border-color: #cbd5e1;
}

.chatreact-inline-select-trigger:focus,
.chatreact-inline-select-trigger.open {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.chatreact-inline-select-trigger .placeholder {
    color: #94a3b8;
}

.chatreact-inline-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    min-width: 250px;
}

.chatreact-inline-select-dropdown.open {
    display: block;
}

.chatreact-inline-select-search {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.chatreact-inline-select-search input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    outline: none;
}

.chatreact-inline-select-search input:focus {
    border-color: #8b5cf6;
}

.chatreact-inline-select-options {
    padding: 4px;
}

.chatreact-inline-select-group-label {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chatreact-inline-select-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font-size: 13px;
    color: #334155;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chatreact-inline-select-option:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
}

.chatreact-inline-select-option.selected {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.chatreact-inline-select-option .option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 8px;
    flex-shrink: 0;
}

.chatreact-inline-select-option .option-icon svg {
    width: 16px;
    height: 16px;
    color: #8b5cf6;
}

.chatreact-inline-select-option .option-content {
    flex: 1;
    min-width: 0;
}

.chatreact-inline-select-option .option-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatreact-inline-select-option .option-type {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

/* Divider in inline select */
.chatreact-inline-select-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 8px 12px;
}

/* Everywhere option in inline select */
.chatreact-inline-select-option-everywhere {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
    margin-bottom: 4px;
}

.chatreact-inline-select-option-everywhere:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.12) 100%) !important;
}

.chatreact-inline-select-option-everywhere .option-icon-everywhere {
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
}

.chatreact-inline-select-option-everywhere .option-icon-everywhere svg {
    color: white;
}

/* AJAX Search elements */
.chatreact-inline-select-hint {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.chatreact-inline-select-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: #64748b;
    font-size: 13px;
}

.chatreact-inline-select-no-results {
    padding: 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.chatreact-inline-select-ajax-results {
    max-height: 180px;
    overflow-y: auto;
}

/* Post Types Settings Panel */
.chatreact-post-types-panel {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 0%, rgba(59, 130, 246, 0.03) 100%);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.chatreact-post-types-header {
    margin-bottom: 16px;
}

.chatreact-post-types-header h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.chatreact-post-types-header p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.chatreact-post-types-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    min-height: 40px;
}

.chatreact-post-types-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 13px;
}

.chatreact-post-type-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 13px;
}

.chatreact-post-type-item:hover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.03);
}

.chatreact-post-type-item input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #8b5cf6;
}

.chatreact-post-type-label {
    font-weight: 500;
    color: #1e293b;
}

.chatreact-post-type-slug {
    color: #94a3b8;
    font-size: 11px;
}

.chatreact-post-types-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(139, 92, 246, 0.1);
}

/* Add Assignment Form (legacy - keep for compatibility) */
.chatreact-add-form {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 0%, rgba(59, 130, 246, 0.03) 100%);
    border: 2px dashed rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
}

.chatreact-add-form-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: #7c3aed;
}

.chatreact-add-form-title svg {
    width: 20px;
    height: 20px;
}

/* Documentation Cards */
.chatreact-doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.chatreact-doc-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s ease;
}

.chatreact-doc-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.08);
}

.chatreact-doc-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 12px;
    margin-bottom: 16px;
}

.chatreact-doc-card-icon svg {
    width: 24px;
    height: 24px;
    color: #8b5cf6;
}

.chatreact-doc-card h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.chatreact-doc-card p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

/* Code Blocks */
.chatreact-code {
    display: block;
    background: #475569;
    color: #f8fafc;
    padding: 16px 20px;
    border-radius: 10px;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: normal;
    word-break: break-word;
}

.chatreact-code-inline {
    display: inline;
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 12px;
}

/* List styles */
.chatreact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chatreact-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.chatreact-list li:last-child {
    border-bottom: none;
}

.chatreact-list-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 6px;
    flex-shrink: 0;
    margin-top: 2px;
}

.chatreact-list-icon svg {
    width: 12px;
    height: 12px;
    color: #8b5cf6;
}

.chatreact-list-content strong {
    color: #1e293b;
}

.chatreact-list-content {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

/* Steps */
.chatreact-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatreact-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.chatreact-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.chatreact-step-content h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.chatreact-step-content p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

/* Footer */
.chatreact-footer {
    text-align: center;
    padding-top: 32px;
    margin-top: 40px;
    border-top: 1px solid #e2e8f0;
}

.chatreact-footer p {
    margin: 0;
    font-size: 13px;
    color: #94a3b8;
}

/* Alerts */
.chatreact-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.chatreact-alert-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.chatreact-alert-info svg {
    color: #2563eb;
}

.chatreact-alert-success {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.chatreact-alert-success svg {
    color: #16a34a;
}

.chatreact-alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.chatreact-alert-content {
    flex: 1;
}

.chatreact-alert-title {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.chatreact-alert-text {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

/* Notices */
.chatreact-notice {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.chatreact-notice.show {
    display: flex;
}

.chatreact-notice-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #16a34a;
}

.chatreact-notice-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

/* Responsive */
@media (max-width: 1024px) {
    .chatreact-form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 782px) {
    .chatreact-admin {
        padding: 16px;
    }
    
    .chatreact-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .chatreact-header-right {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .chatreact-header-right .chatreact-btn {
        flex: 1;
        justify-content: center;
        min-width: 140px;
    }
    
    .chatreact-tabs {
        flex-wrap: wrap;
    }
    
    .chatreact-tab {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
        font-size: 13px;
        min-width: 100px;
    }
    
    .chatreact-form-row {
        grid-template-columns: 1fr;
    }
    
    .chatreact-doc-grid {
        grid-template-columns: 1fr;
    }
    
    .chatreact-assignments-table {
        display: block;
        overflow-x: auto;
    }
    
    .chatreact-assignments-table th,
    .chatreact-assignments-table td {
        white-space: nowrap;
    }
    
    .chatreact-card {
        padding: 16px;
    }
    
    .chatreact-add-form {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .chatreact-tab {
        width: 100%;
        min-width: unset;
    }
    
    .chatreact-header-title {
        font-size: 20px;
    }
    
    .chatreact-logo-container {
        width: 40px;
        height: 40px;
    }
    
    .chatreact-logo-container svg {
        width: 20px;
        height: 20px;
    }
}

/* Loading spinner */
.chatreact-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 50%;
    border-top-color: #8b5cf6;
    animation: chatreact-spin 0.8s linear infinite;
}

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

/* WordPress admin overrides */
.chatreact-admin-wrap .notice,
.chatreact-admin-wrap .updated {
    display: none !important;
}

/* Edit Modal/Inline Form */
.chatreact-edit-row {
    background: rgba(139, 92, 246, 0.03) !important;
}

.chatreact-edit-row td {
    padding: 12px 16px !important;
}

.chatreact-inline-edit {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatreact-inline-edit .chatreact-input {
    padding: 8px 12px;
    font-size: 13px;
}

.chatreact-inline-edit .chatreact-btn {
    padding: 8px 12px;
}

/* Delete Confirmation Modal */
.chatreact-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

.chatreact-modal.open {
    display: flex;
}

.chatreact-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    animation: chatreact-fade-in 0.2s ease;
}

.chatreact-modal-container {
    position: relative;
    z-index: 1;
    animation: chatreact-slide-up 0.3s ease;
}

.chatreact-modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 90vw;
    text-align: center;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

.chatreact-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-radius: 50%;
    margin-bottom: 20px;
}

.chatreact-modal-icon svg {
    width: 28px;
    height: 28px;
    color: #ef4444;
}

.chatreact-modal-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.chatreact-modal-message {
    margin: 0 0 28px 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

.chatreact-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.chatreact-modal-actions .chatreact-btn {
    flex: 1;
    max-width: 140px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
}

.chatreact-modal-actions .chatreact-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.chatreact-btn-secondary:hover {
    background: #e2e8f0;
    color: #334155;
}

.chatreact-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chatreact-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.chatreact-btn-danger svg {
    width: 16px;
    height: 16px;
}

@keyframes chatreact-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes chatreact-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Exclude URLs Feature */
.chatreact-exclude-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.chatreact-exclude-info svg {
    width: 12px;
    height: 12px;
    color: #f59e0b;
}

.chatreact-exclude-urls-wrapper {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(139, 92, 246, 0.2);
}

.chatreact-exclude-urls-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

.chatreact-exclude-urls-label svg {
    width: 14px;
    height: 14px;
    color: #f59e0b;
}

.chatreact-admin textarea.chatreact-input,
.chatreact-admin textarea.chatreact-row-exclude-urls {
    padding: 10px 16px;
    font-size: 13px;
    color: #1e293b;
    background: white;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    resize: vertical;
    min-height: 60px;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    line-height: 1.5;
}

.chatreact-admin textarea.chatreact-input:hover,
.chatreact-admin textarea.chatreact-row-exclude-urls:hover {
    border-color: #cbd5e1 !important;
}

.chatreact-admin textarea.chatreact-input:focus,
.chatreact-admin textarea.chatreact-row-exclude-urls:focus {
    outline: none !important;
    border-color: #8b5cf6 !important;
    background: white;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.chatreact-admin textarea.chatreact-input::placeholder,
.chatreact-admin textarea.chatreact-row-exclude-urls::placeholder {
    color: #94a3b8;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
}

.chatreact-exclude-urls-hint {
    margin: 6px 0 0 0;
    font-size: 11px;
    color: #94a3b8;
}

/* Edit mode exclude URLs */
.chatreact-edit-exclude-urls {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(139, 92, 246, 0.2);
}

.chatreact-edit-exclude-urls .chatreact-exclude-urls-label {
    margin-bottom: 8px;
}

.chatreact-edit-exclude-urls textarea.chatreact-input {
    min-height: 70px;
}

/* =============================================
   Integration Tab
   ============================================= */

.chatreact-badge-green {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.chatreact-badge-gray {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.chatreact-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.chatreact-integration-key-section {
    padding: 0 24px 24px 24px;
}

.chatreact-key-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatreact-input-key {
    flex: 1;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 13px;
    letter-spacing: 0.02em;
}

.chatreact-field-hint {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.4;
}

.chatreact-sitemap-types {
    padding: 0 24px;
}

.chatreact-sitemap-type-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 10px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 4px;
}

.chatreact-sitemap-header-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chatreact-sitemap-type-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.chatreact-sitemap-type-row:last-child {
    border-bottom: none;
}

.chatreact-sitemap-type-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #334155;
}

.chatreact-sitemap-type-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #8b5cf6;
    cursor: pointer;
}

.chatreact-sitemap-type-name {
    font-weight: 500;
}

.chatreact-sitemap-type-count {
    font-size: 12px;
    color: #94a3b8;
}

.chatreact-admin select.chatreact-sitemap-priority-select {
    padding: 8px 36px 8px 14px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #475569 !important;
    background: white !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px !important;
    min-width: 130px !important;
    height: 40px !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif !important;
}

.chatreact-admin select.chatreact-sitemap-priority-select:hover {
    border-color: #cbd5e1 !important;
    background-color: white !important;
}

.chatreact-admin select.chatreact-sitemap-priority-select:focus {
    border-color: #8b5cf6 !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    background-color: white !important;
}

.chatreact-sitemap-actions {
    padding: 16px 24px 24px 24px;
}

.chatreact-endpoint-info {
    padding: 0 24px 24px 24px;
}

.chatreact-endpoint-url {
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
}

.chatreact-endpoint-url code {
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 13px;
    color: #7c3aed;
    word-break: break-all;
}

.chatreact-endpoint-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.chatreact-endpoint-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
}

.chatreact-endpoint-stats svg {
    color: #94a3b8;
}

/* Mobile responsive for Integration tab */
@media (max-width: 600px) {
    .chatreact-key-input-row {
        flex-wrap: wrap;
    }
    
    .chatreact-input-key {
        width: 100%;
    }
    
    .chatreact-sitemap-type-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .chatreact-endpoint-stats {
        flex-direction: column;
        gap: 8px;
    }
}
