/**
 * Centralized CSS selectors for all E2E specs.
 *
 * Tauri (WebKit2GTK via tauri-driver) and Electrobun (WebKitGTK) render
 * different Svelte frontends with different class names. These selectors
 * use CSS comma syntax (selector1, selector2) to match both stacks.
 *
 * Convention: data-testid where available, CSS class fallback with dual selectors.
 */

// ── App Shell ──
export const APP_SHELL = '.app-shell';
export const WORKSPACE = '.workspace';
export const PROJECT_GRID = '.project-grid';

// ── Sidebar ──
// Tauri: .sidebar-rail  |  Electrobun: .sidebar
export const SIDEBAR = '.sidebar-rail, .sidebar';
export const SIDEBAR_RAIL = '[data-testid="sidebar-rail"], .sidebar';
export const SIDEBAR_PANEL = '.sidebar-panel';
export const SIDEBAR_ICON = '.sidebar-icon, .rail-btn';
export const SETTINGS_BTN = '[data-testid="settings-btn"], .sidebar-icon';
export const PANEL_CLOSE = '.panel-close, .settings-close';

// ── Groups ──
// Electrobun has numbered group circles; Tauri uses GlobalTabBar (no groups).
// Tests should gracefully skip if these don't exist.
export const GROUP_BTN = '.group-btn';
export const GROUP_CIRCLE = '.group-circle';
export const GROUP_BTN_ACTIVE = '.group-btn.active';
export const ADD_GROUP_BTN = '.add-group-btn';
export const GROUP_BADGE = '.group-badge';

// ── Project Cards ──
// Tauri: .project-box  |  Electrobun: .project-card
export const PROJECT_CARD = '.project-box, .project-card';
export const PROJECT_HEADER = '.project-header';
export const AGOR_TITLE = '.agor-title';

// ── Status Bar ──
// Both use [data-testid="status-bar"] and .status-bar
export const STATUS_BAR = '[data-testid="status-bar"], .status-bar';
export const STATUS_BAR_CLASS = '.status-bar';
export const STATUS_BAR_VERSION = '.status-bar .version';
export const BURN_RATE = '.burn-rate';
export const AGENT_COUNTS = '.agent-counts';
export const ATTENTION_QUEUE = '.attention-queue, .attention-btn';
export const FLEET_TOKENS = '.fleet-tokens, .tokens';
export const FLEET_COST = '.fleet-cost, .cost';
export const PROJECT_COUNT = '.project-count';

// ── Settings ──
// Tauri: .settings-panel inside .sidebar-panel  |  Electrobun: .settings-drawer
export const SETTINGS_DRAWER = '.settings-panel, .settings-drawer, .sidebar-panel';
export const SETTINGS_TAB = '.settings-tab, .sidebar-item';
export const SETTINGS_TAB_ACTIVE = '.settings-tab.active, .sidebar-item.active';
export const SETTINGS_CLOSE = '.settings-close, .panel-close';
export const SETTINGS_CAT_BTN = '.cat-btn, .sidebar-item';
export const THEME_SECTION = '.theme-section';
export const FONT_STEPPER = '.font-stepper, .stepper, .size-stepper';
export const FONT_DROPDOWN = '.font-dropdown, .custom-dropdown';
export const STEP_UP = '.font-stepper .step-up, .stepper .step-up';
export const SIZE_VALUE = '.font-stepper .size-value, .stepper .size-value';
export const UPDATE_ROW = '.update-row';
export const VERSION_LABEL = '.version-label';

// ── Terminal ──
export const TERMINAL_SECTION = '.terminal-section';
export const TERMINAL_TABS = '.terminal-tabs, [data-testid="terminal-tabs"]';
export const TERMINAL_TAB = '.terminal-tab';
export const TERMINAL_TAB_ACTIVE = '.terminal-tab.active';
export const TAB_ADD_BTN = '.tab-add-btn';
export const TAB_CLOSE = '.tab-close';
export const TERMINAL_COLLAPSE_BTN = '.terminal-collapse-btn';
export const XTERM = '.xterm';
export const XTERM_TEXTAREA = '.xterm-helper-textarea';

// ── Agent ──
export const CHAT_INPUT = '.chat-input';
export const CHAT_INPUT_TEXTAREA = '.chat-input textarea';
export const CHAT_INPUT_ALT = '.chat-input input';
export const SEND_BTN = '.send-btn';
export const AGENT_MESSAGES = '.agent-messages';
export const AGENT_STATUS = '.agent-status';
export const AGENT_STATUS_TEXT = '.agent-status .status-text';
export const PROVIDER_BADGE = '.provider-badge';
export const AGENT_COST = '.agent-cost';
export const MODEL_LABEL = '.model-label';
export const STOP_BTN = '.stop-btn';

// ── Search Overlay ──
// Tauri: .search-backdrop, .search-overlay  |  Electrobun: .overlay-backdrop, .overlay-panel
export const OVERLAY_BACKDROP = '.overlay-backdrop, .search-backdrop';
export const OVERLAY_PANEL = '.overlay-panel, .search-overlay';
export const SEARCH_INPUT = '.search-input';
export const NO_RESULTS = '.no-results';
export const ESC_HINT = '.esc-hint';
export const LOADING_DOT = '.loading-dot';
export const RESULTS_LIST = '.results-list';
export const GROUP_LABEL = '.group-label';

// ── Command Palette ──
export const PALETTE_BACKDROP = '.palette-backdrop';
// Tauri: .palette [data-testid="command-palette"]  |  Electrobun: .palette-panel
export const PALETTE_PANEL = '.palette-panel, .palette, [data-testid="command-palette"]';
export const PALETTE_INPUT = '.palette-input';
export const PALETTE_ITEM = '.palette-item';
export const CMD_LABEL = '.cmd-label';
export const CMD_SHORTCUT = '.cmd-shortcut';

// ── File Browser ──
export const FILE_BROWSER = '.file-browser';
export const FB_TREE = '.fb-tree';
export const FB_VIEWER = '.fb-viewer';
export const FB_DIR = '.fb-dir';
export const FB_FILE = '.fb-file';
export const FB_EMPTY = '.fb-empty';
export const FB_CHEVRON = '.fb-chevron';
export const FB_EDITOR_HEADER = '.fb-editor-header';
export const FB_IMAGE_WRAP = '.fb-image-wrap';
export const FB_ERROR = '.fb-error';
export const FILE_TYPE = '.file-type';

// ── Communications ──
export const COMMS_TAB = '.comms-tab';
export const COMMS_MODE_BAR = '.comms-mode-bar';
export const MODE_BTN = '.mode-btn';
export const MODE_BTN_ACTIVE = '.mode-btn.active';
export const COMMS_SIDEBAR = '.comms-sidebar';
export const CH_HASH = '.ch-hash';
export const COMMS_MESSAGES = '.comms-messages';
export const MSG_INPUT_BAR = '.msg-input-bar';
export const MSG_SEND_BTN = '.msg-send-btn';

// ── Task Board ──
export const TASK_BOARD = '.task-board';
export const TB_TITLE = '.tb-title';
export const TB_COLUMN = '.tb-column';
export const TB_COL_LABEL = '.tb-col-label';
export const TB_COL_COUNT = '.tb-col-count';
export const TB_ADD_BTN = '.tb-add-btn';
export const TB_CREATE_FORM = '.tb-create-form';
export const TB_COUNT = '.tb-count';

// ── Theme ──
export const DD_BTN = '.dd-btn, .dropdown-btn';
export const DD_LIST = '.dd-list, .dropdown-menu';
export const DD_GROUP_LABEL = '.dd-group-label, .dropdown-group-label';
export const DD_ITEM = '.dd-item, .dropdown-item';
export const DD_ITEM_SELECTED = '.dd-item.selected, .dropdown-item.active';
export const SIZE_STEPPER = '.size-stepper, .font-stepper, .stepper';
export const THEME_ACTION_BTN = '.theme-action-btn';

// ── Notifications ──
// Tauri: .bell-btn, .notification-center .panel  |  Electrobun: .notif-btn, .notif-drawer
export const NOTIF_BTN = '.notif-btn, .bell-btn, [data-testid="notification-bell"]';
export const NOTIF_DRAWER = '.notif-drawer, .notification-center .panel, [data-testid="notification-panel"]';
export const DRAWER_TITLE = '.drawer-title, .panel-title';
export const CLEAR_BTN = '.clear-btn, .action-btn';
export const NOTIF_EMPTY = '.notif-empty, .empty';
export const NOTIF_ITEM = '.notif-item, .notification-item';
export const NOTIF_BACKDROP = '.notif-backdrop, .notification-center .backdrop';

// ── Splash ──
export const SPLASH = '.splash';
export const LOGO_TEXT = '.logo-text';
export const SPLASH_VERSION = '.splash .version';
export const SPLASH_DOT = '.splash .dot';

// ── Diagnostics (Electrobun-only) ──
export const DIAGNOSTICS = '.diagnostics';
export const DIAG_HEADING = '.diagnostics .sh';
export const DIAG_KEY = '.diag-key';
export const DIAG_LABEL = '.diag-label';
export const DIAG_FOOTER = '.diag-footer';
export const REFRESH_BTN = '.refresh-btn';

// ── Right Bar (Electrobun-only) ──
export const RIGHT_BAR = '.right-bar';
export const CLOSE_BTN = '.close-btn';

// ── Context Tab ──
export const CONTEXT_TAB = '.context-tab';
export const TOKEN_METER = '.token-meter';
export const FILE_REFS = '.file-refs';
export const TURN_COUNT = '.turn-count';

// ── Worktree ──
export const CLONE_BTN = '.clone-btn';
export const BRANCH_DIALOG = '.branch-dialog';
export const WT_BADGE = '.wt-badge';
export const CLONE_GROUP = '.clone-group';

// ── Toast / Errors ──
export const TOAST_ERROR = '.toast-error';
export const LOAD_ERROR = '.load-error';
