/* Heat Map Wrapper */
.exaig-heatmap-wrapper{font-family:inherit;margin:20px 0;margin-bottom:60px;padding-bottom:20px}
.exaig-heatmap-scroll{overflow:auto;max-width:100%;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,0.1)}
.exaig-heatmap-table{border-collapse:separate;border-spacing:2px;width:max-content;min-width:50%;background:#fff}
.exaig-heatmap-table th,.exaig-heatmap-table td{padding:10px 12px;text-align:center;border:1px solid #e2e8f0;font-size:13px;line-height:1.4;white-space:nowrap;transition:background-color 0.2s ease}
.exaig-heatmap-table th.exaig-hm-sticky{position:sticky;left:0;background:#fff;z-index:2;font-weight:600;box-shadow:2px 0 4px rgba(0,0,0,0.05)}
.exaig-heatmap-table thead th{position:sticky;top:0;background:#f8f9fa;z-index:1;font-weight:600;border-bottom:2px solid #e2e8f0;box-shadow:0 2px 4px rgba(0,0,0,0.05)}
.exaig-hm-cell{color:#0f172a;font-weight:600;cursor:pointer;transition:transform 0.1s ease,box-shadow 0.1s ease}
.exaig-hm-cell:hover{transform:scale(1.05);box-shadow:0 2px 4px rgba(0,0,0,0.15);z-index:10;position:relative}
.exaig-heatmap-legend{margin:16px 0;padding:12px;background:#f8f9fa;border-radius:6px}
.exaig-hm-legend-bar{height:12px;border-radius:6px;box-shadow:0 1px 2px rgba(0,0,0,0.1)}
.exaig-hm-legend-labels{display:flex;justify-content:space-between;font-size:12px;color:#475569;margin-top:6px;font-weight:500}
.exaig-heatmap-error{background:#fef2f2;color:#7f1d1d;border:1px solid #fecaca;padding:12px 16px;border-radius:6px;margin:12px 0;display:flex;align-items:flex-start;gap:8px}
.exaig-heatmap-error:before{content:"⚠";font-size:18px;line-height:1}
.exaig-heatmap-info{background:#eff6ff;color:#1e3a8a;border:1px solid #bfdbfe;padding:12px 16px;border-radius:6px;margin:12px 0;display:flex;align-items:flex-start;gap:8px}
.exaig-heatmap-info:before{content:"ℹ";font-size:18px;line-height:1}

/* Modal Styles */
.exaig-modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.7);z-index:100000;display:flex;align-items:center;justify-content:center;padding:20px;overflow-y:auto}
.exaig-modal-container{background:#fff;border-radius:8px;box-shadow:0 4px 20px rgba(0,0,0,0.3);max-width:900px;width:100%;max-height:90vh;display:flex;flex-direction:column;position:relative}
.exaig-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e2e8f0;flex-shrink:0}
.exaig-modal-header h2{margin:0;font-size:20px;font-weight:600;color:#1e293b}
.exaig-modal-close{background:none;border:none;cursor:pointer;padding:4px;color:#6b7280;font-size:20px;line-height:1;transition:color 0.2s ease;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:4px}
.exaig-modal-close:hover{color:#374151;background:#f3f4f6}
.exaig-modal-content{flex:1;overflow-y:auto;padding:0}
.exaig-modal-open{overflow:hidden}
.exaig-edit-link{cursor:pointer;color:#2271b1;text-decoration:none}
.exaig-edit-link:hover{color:#135e96;text-decoration:underline}

/* Admin Form Improvements */
.exaig-admin-form-wrapper{background:#fff;padding:24px;border-radius:0;box-shadow:none;margin-bottom:0}
.exaig-form-section{margin-bottom:24px;padding-bottom:24px;border-bottom:1px solid #e2e8f0}
.exaig-form-section:last-child{border-bottom:none;margin-bottom:0;padding-bottom:0}
.exaig-form-section-title{margin:0 0 16px 0;font-size:16px;font-weight:600;color:#1e293b}
.exaig-field-group{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}
.exaig-field-group label{font-weight:500;color:#374151;font-size:14px;display:flex;align-items:center;gap:6px}
.exaig-field-group label .dashicons{font-size:16px;color:#6b7280}
.exaig-field-group input[type="text"],.exaig-field-group textarea{border:1px solid #d1d5db;border-radius:6px;padding:8px 12px;font-size:14px;transition:border-color 0.2s ease,box-shadow 0.2s ease}
.exaig-field-group input[type="text"]:focus,.exaig-field-group textarea:focus{border-color:#3b82f6;outline:none;box-shadow:0 0 0 3px rgba(59,130,246,0.1)}
.exaig-field-group textarea.code{font-family:'Courier New',Courier,monospace;font-size:13px;line-height:1.6}
.exaig-field-help{font-size:13px;color:#6b7280;margin-top:4px;line-height:1.5}
.exaig-field-help code{background:#f3f4f6;padding:2px 6px;border-radius:4px;font-size:12px;color:#374151}
.exaig-field-error{color:#dc2626;font-size:13px;margin-top:4px;display:flex;align-items:center;gap:4px}
.exaig-field-error:before{content:"✕";font-size:14px}
.exaig-field-success{color:#059669;font-size:13px;margin-top:4px;display:flex;align-items:center;gap:4px}
.exaig-field-success:before{content:"✓";font-size:14px}

/* SQL Validation */
.exaig-sql-validation{position:relative}
.exaig-sql-validation-status{position:absolute;right:12px;top:12px;font-size:18px;z-index:10}
.exaig-sql-validation-status.valid{color:#059669}
.exaig-sql-validation-status.invalid{color:#dc2626}
.exaig-sql-validation-status.loading{color:#6b7280;animation:spin 1s linear infinite}
@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
.exaig-validation-messages{margin-top:8px;padding:12px;background:#f9fafb;border-radius:6px;border-left:3px solid #e5e7eb;max-height:200px;overflow-y:auto}
.exaig-validation-messages.has-errors{border-left-color:#dc2626;background:#fef2f2}
.exaig-validation-messages.has-success{border-left-color:#059669;background:#f0fdf4}
.exaig-validation-message{margin:4px 0;font-size:13px;line-height:1.5;display:flex;align-items:flex-start;gap:8px}
.exaig-validation-message.error{color:#dc2626}
.exaig-validation-message.success{color:#059669}
.exaig-validation-message:before{content:"•";font-weight:bold;font-size:16px;line-height:1}

/* Loading States */
.exaig-loading{display:inline-flex;align-items:center;gap:8px;color:#6b7280;font-size:14px}
.exaig-loading-spinner{width:16px;height:16px;border:2px solid #e5e7eb;border-top-color:#3b82f6;border-radius:50%;animation:spin 0.8s linear infinite}
.exaig-submit-loading{opacity:0.6;pointer-events:none;position:relative}
.exaig-submit-loading:after{content:"";position:absolute;top:50%;left:50%;width:20px;height:20px;margin:-10px 0 0 -10px;border:2px solid #fff;border-top-color:transparent;border-radius:50%;animation:spin 0.8s linear infinite}

/* Preview Section */
.exaig-preview-section{margin-top:0!important;margin-bottom:0!important;padding-bottom:0!important}
.exaig-heatmap-preview{background:#f9fafb;border:1px solid #e2e8f0;border-radius:8px;padding:20px;margin-top:16px;min-height:200px}
.exaig-heatmap-preview:empty:before{content:"Select a heat map to preview.";color:#9ca3af;font-style:italic;display:block}

/* Selected Row Highlighting */
.exaig-graph-row{transition:background-color 0.2s ease}
.exaig-graph-row:hover{background-color:#f9fafb}
.exaig-graph-row.exaig-row-selected{background-color:#e0f2fe!important;border-left:3px solid #0ea5e9}
.exaig-graph-row.exaig-row-selected td{background-color:transparent}
.exaig-preview-link{color:#2271b1;text-decoration:none;cursor:pointer;display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}
.exaig-preview-link:hover{color:#135e96;text-decoration:underline}
.exaig-graph-row td:first-child{position:relative;padding-right:0;width:40%}
.exaig-graph-row .row-actions{visibility:hidden;opacity:0;transition:opacity 0.2s ease;margin-top:4px;font-size:12px;line-height:1.8}
.exaig-graph-row:hover .row-actions{visibility:visible;opacity:1}
.exaig-graph-row .row-actions a{color:#2271b1;text-decoration:none}
.exaig-graph-row .row-actions a:hover{color:#135e96}
.exaig-graph-row .row-actions .submitdelete{color:#b32d2e}
.exaig-graph-row .row-actions .submitdelete:hover{color:#8a2424}
.exaig-graph-row .row-actions .preview{float:none!important}
.exaig-premium-badge{display:inline-block!important;margin-left:8px;padding:2px 8px;background:#ffc107;color:#856404;font-size:11px;font-weight:600;border-radius:3px;vertical-align:middle;line-height:1.5;text-transform:uppercase;letter-spacing:0.5px;box-shadow:0 1px 2px rgba(0,0,0,0.1)}
.exaig-graph-row td:first-child strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.exaig-graph-row td:first-child strong a{max-width:100%;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.exaig-graph-row th.check-column{padding:11px 0 0 3px;vertical-align:middle}
.exaig-graph-row th.check-column input[type="checkbox"]{margin:0}
#exaig-graphs-table thead th.check-column{padding:11px 0 0 3px}
#exaig-graphs-table{position:relative}
#exaig-graphs-table thead{position:sticky;top:0;background:#fff;z-index:10;box-shadow:0 1px 0 #c3c4c7}

/* Responsive Design */
@media (max-width:782px){
	.exaig-admin-form-wrapper{padding:16px}
	.exaig-field-group{flex-direction:column}
	.exaig-heatmap-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
	.exaig-heatmap-table th,.exaig-heatmap-table td{padding:8px;font-size:12px}
}

/* Accessibility */
.exaig-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}
.exaig-heatmap-table th[scope="row"]{font-weight:600}
.exaig-heatmap-table th[scope="col"]{font-weight:600}
.exaig-hm-cell:focus{outline:2px solid #3b82f6;outline-offset:2px}

/* Color Picker Improvements */
.exaig-color-field-group{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.exaig-color-field-wrapper{display:flex;align-items:center;gap:8px}
.exaig-color-field-wrapper label{font-weight:500;min-width:50px;font-size:14px}
.exaig-color-field{width:80px!important;height:36px!important;border-radius:6px!important;border:1px solid #d1d5db!important;cursor:pointer}
.exaig-color-preview{width:40px;height:40px;border-radius:6px;border:2px solid #e2e8f0;box-shadow:0 1px 3px rgba(0,0,0,0.1)}

/* Premium Features */
.exaig-premium-notice{margin:16px 0}

/* Page Title Actions Alignment */
.wrap h1.wp-heading-inline + div[style*="display:inline-flex"]{display:inline-flex!important;align-items:center;vertical-align:middle}
.wrap h1.wp-heading-inline + div[style*="display:inline-flex"] form{display:inline-block!important;margin:0;vertical-align:middle}
.wrap h1.wp-heading-inline + div[style*="display:inline-flex"] form .button{vertical-align:middle;margin:0}
#exaig-restore-defaults-link{display:inline-block;font-size:13px;line-height:2.15384615;margin:0;text-decoration:none;color:#2271b1;cursor:pointer;vertical-align:middle}
#exaig-restore-defaults-link:hover{color:#135e96;text-decoration:underline}
#exaig-restore-defaults-link:focus{color:#135e96;outline:1px solid #2271b1;outline-offset:2px;border-radius:2px}
.exaig-chart-wrapper{margin:20px 0;padding:20px;background:#fff;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,0.1);position:relative;min-height:300px}
.exaig-chart-wrapper canvas{max-width:100%!important}
.exaig-chart-wrapper[data-chart-type="pie"]{min-height:400px}
.exaig-chart-wrapper[data-chart-type="line"]{min-height:350px}
.exaig-chart-wrapper[data-chart-type="bar"]{min-height:350px}
.exaig-chart-loading{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#f9fafb;border-radius:8px;z-index:10}
.exaig-loading-spinner{width:40px;height:40px;border:4px solid #e5e7eb;border-top-color:#3b82f6;border-radius:50%;animation:exaig-spin 1s linear infinite;margin-bottom:12px}
.exaig-loading-text{color:#6b7280;font-size:14px;font-weight:500}
.exaig-loading-error{color:#dc2626;font-size:14px;font-weight:500;text-align:center}
@keyframes exaig-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}
.exaig-export-wrapper{margin-bottom:16px;display:none!important;align-items:center;gap:8px}
.exaig-export-btn{display:inline-flex;align-items:center;gap:4px;transition:all 0.2s ease;cursor:pointer;border:none}
.exaig-export-btn:hover{transform:translateY(-1px);box-shadow:0 2px 4px rgba(0,0,0,0.1)}
.exaig-export-btn.exaig-export-processing{opacity:0.6;cursor:wait;pointer-events:none}
.exaig-export-btn:disabled{opacity:0.6;cursor:not-allowed}
.exaig-export-loading{color:#6b7280;font-size:13px;display:none!important;align-items:center;gap:8px}
.exaig-export-loading.show{display:flex!important}
.exaig-export-loading .spinner{width:16px;height:16px}

/* Slicers */
.exaig-slicers-wrapper{background:#f9fafb;border:1px solid #e2e8f0;border-radius:8px;padding:16px;margin-bottom:16px;position:relative;z-index:1}
.exaig-slicers-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;cursor:pointer}
.exaig-slicers-header h4{margin:0;font-size:14px;font-weight:600;color:#374151;display:flex;align-items:center;gap:6px;flex:1}
.exaig-filter-count{font-weight:400}
.exaig-slicers-toggle{background:none;border:1px solid #d1d5db;padding:6px 12px;cursor:pointer;color:#1f2937;font-weight:500;font-size:13px;transition:all 0.2s ease;display:flex;align-items:center;justify-content:center;gap:6px;border-radius:6px;background-color:#fff}
.exaig-slicers-toggle:hover{color:#111827;background-color:#f9fafb;border-color:#9ca3af;box-shadow:0 1px 2px rgba(0,0,0,0.05)}
.exaig-slicers-toggle:focus{outline:2px solid #3b82f6;outline-offset:2px}
.exaig-slicers-toggle .dashicons{font-size:16px;width:16px;height:16px;margin-top:1px}
.exaig-slicers-toggle-text{font-weight:500}
.exaig-slicers-filters{overflow:hidden;transition:max-height 0.3s ease}
.exaig-slicers-wrapper.exaig-slicers-collapsed .exaig-slicers-filters,.exaig-slicers-filters.exaig-slicers-collapsed-init{max-height:0;margin-bottom:0;display:none}
.exaig-slicers-filters{display:flex;flex-direction:row;gap:20px;flex-wrap:wrap;align-items:flex-start}
.exaig-slicer-group{display:flex;flex-direction:column;gap:8px;flex:1;min-width:200px;max-width:300px}
.exaig-slicer-group label{font-weight:500;font-size:13px;color:#374151;display:flex;align-items:center;gap:6px;white-space:nowrap}
.exaig-slicer-select{display:block;width:100%;min-height:120px;max-height:200px;padding:8px;border:1px solid #d1d5db;border-radius:6px;font-size:13px;background:#fff;transition:border-color 0.2s ease;overflow-y:auto;font-family:inherit}
.exaig-slicer-select:focus{border-color:#3b82f6;outline:none;box-shadow:0 0 0 3px rgba(59,130,246,0.1)}
.exaig-slicer-select option{padding:6px 8px;cursor:pointer;display:block}
.exaig-slicer-select option:hover,.exaig-slicer-select option:checked{background-color:#3b82f6;color:#fff}
.exaig-slicer-select option:checked{font-weight:600}
.exaig-slicer-help{font-size:11px;color:#6b7280;margin-top:4px;font-style:italic}
.exaig-range-container{position:relative;width:100%;margin:12px 0;height:40px;display:flex;align-items:center}
.exaig-slicer-range{width:100%;height:8px;border-radius:4px;background:#e5e7eb;outline:none;transition:background 0.2s ease;position:absolute;top:50%;left:0;transform:translateY(-50%);-webkit-appearance:none;appearance:none}
.exaig-slicer-range:hover{background:#d1d5db}
.exaig-slicer-range::-webkit-slider-thumb{appearance:none;width:20px;height:20px;border-radius:50%;background:#3b82f6;cursor:pointer;box-shadow:0 2px 4px rgba(0,0,0,0.2);transition:transform 0.2s ease;position:relative;z-index:2}
.exaig-slicer-range::-webkit-slider-thumb:hover{transform:scale(1.1)}
.exaig-slicer-range::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:#3b82f6;cursor:pointer;border:none;box-shadow:0 2px 4px rgba(0,0,0,0.2);position:relative;z-index:2}
.exaig-slicer-range:first-of-type{z-index:1}
.exaig-slicer-range:last-of-type{z-index:2}
.exaig-range-labels{display:flex;justify-content:space-between;font-size:12px;color:#374151;margin-top:4px;font-weight:600}
.exaig-slicer-actions{width:100%;margin-top:12px;display:flex;align-items:center;gap:12px;flex-basis:100%}
.exaig-filter-status{font-size:12px;font-weight:500}
.exaig-value-display{font-weight:600;color:#3b82f6;margin-left:4px}

/* Linked Charts Dashboard */
.exaig-linked-charts-dashboard{margin:24px 0}
.exaig-dashboard-header{margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid #e2e8f0}
.exaig-dashboard-header h3{margin:0 0 8px 0;font-size:18px;font-weight:600;color:#1e293b}
.exaig-dashboard-charts{display:grid;grid-template-columns:repeat(auto-fit,minmax(400px,1fr));gap:24px;margin-top:20px}
.exaig-dashboard-chart-item{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:16px;box-shadow:0 1px 3px rgba(0,0,0,0.1)}

/* WordPress Admin Footer Spacing */
body.wp-admin .exaig-heatmap-wrapper{margin-bottom:80px;padding-bottom:40px}
body.wp-admin .exaig-slicers-wrapper{margin-bottom:20px}

@media (max-width:782px){
	.exaig-slicers-filters{flex-direction:column}
	.exaig-slicer-group{width:100%;max-width:100%}
	.exaig-slicer-select{min-height:80px}
	.exaig-dashboard-charts{grid-template-columns:1fr;gap:16px}
	body.wp-admin .exaig-heatmap-wrapper{margin-bottom:100px;padding-bottom:50px}
}

