<?php
defined("ABSPATH") || exit;
/**
 * Common widget config — merged into EVERY widget by getWidgetSettings().
 * - 'icons': default icons added to every widget's icon list
 * - 'settings': common setting groups (appearance, branding) appended to settings UI
 */
return [
    // Default icons for all widgets (widget can add its own extras)
    'icons' => ['chevron-down', 'search', 'x', 'search-error'],

    // Defaults for all widgets
    'defaults' => [
        'theme' => 'auto',
        'transparent_bg' => false,
    ],

    // Common settings groups
    'settings' => [
        'appearance' => [
            'label'  => 'Appearance',
            'pkg'    => 1,
            'fields' => [
                'lang' => [
                    'type'        => 'select',
                    'label'       => 'Language',
                    'description' => 'Language used for all text inside the widget.',
                    'default'     => 'en',
                    'key'         => 'lang',
                    'pkg'         => 1,
                    'options'     => array_map(fn($l) => $l['name'], VUNELIX_AVAILABLE_LANGS),
                ],
                'theme' => [
                    'type'        => 'select',
                    'label'       => 'Theme',
                    'description' => 'Auto matches your site\'s dark/light mode — when visitors switch your site theme, the widget follows automatically. Choose Light or Dark to keep it fixed.',
                    'default'     => 'auto',
                    'key'         => 'theme',
                    'pkg'         => 1,
                    'options' => [
                        'auto'  => 'Auto (Detect from site)',
                        'light' => 'Light',
                        'dark'  => 'Dark',
                    ],
                ],
                'transparent_bg' => [
                    'type'        => 'toggle',
                    'label'       => 'Transparent Background',
                    'description' => 'Remove the widget background color so it blends with your page.',
                    'default'     => false,
                    'key'         => 'transparent_bg',
                    'pkg'         => 1,
                ],
                'loading_el' => [
                    'type'        => 'text',
                    'label'       => 'Custom Loading Placeholder',
                    'description' => 'If you have your own loading spinner or skeleton on the page, enter its ID or class here (e.g. #my-loader). The widget will remove it once data is ready.',
                    'default'     => '',
                    'key'         => 'loading_el',
                    'pkg'         => 1,
                    'placeholder' => '#my-loader, .my-skeleton',
                ],
                /* 'open_shadow' => [
                    'type'    => 'toggle',
                    'label'   => 'Open Shadow DOM',
                    'description' => 'When enabled, Google can read and index the widget content for better SEO.',
                    'default' => false,
                    'key'     => 'open_shadow',
                    'pkg'     => 3,
                ], */
                'positive_color' => [
                    'type'        => 'color-pair',
                    'label'       => 'Positive Color',
                    'description' => 'Color for positive values (gains, up arrows).',
                    'default'     => '',
                    'key'         => 'positive_color',
                    'pkg'         => 1,
                    'light'       => '#10b981',
                    'dark'        => '#22c55e',
                ],
                'negative_color' => [
                    'type'        => 'color-pair',
                    'label'       => 'Negative Color',
                    'description' => 'Color for negative values (losses, down arrows).',
                    'default'     => '',
                    'key'         => 'negative_color',
                    'pkg'         => 1,
                    'light'       => '#ef4444',
                    'dark'        => '#f87171',
                ],
                'bg_color' => [
                    'type'        => 'color-pair',
                    'label'       => 'Background',
                    'description' => 'Main background color of the widget.',
                    'default'     => '',
                    'key'         => 'bg_color',
                    'pkg'         => 1,
                    'light'       => '#ffffff',
                    'dark'        => '#0f0f0f',
                ],
                'bg_secondary_color' => [
                    'type'        => 'color-pair',
                    'label'       => 'Card / Hover Background',
                    'description' => 'Background color for cards, rows, and hover states.',
                    'default'     => '',
                    'key'         => 'bg_secondary_color',
                    'pkg'         => 1,
                    'light'       => '#f8fafc',
                    'dark'        => '#181818',
                ],
                'text_color' => [
                    'type'        => 'color-pair',
                    'label'       => 'Text Color',
                    'description' => 'Primary text color for headings and values.',
                    'default'     => '',
                    'key'         => 'text_color',
                    'pkg'         => 1,
                    'light'       => '#0f172a',
                    'dark'        => '#f1f1f1',
                ],
                'text_secondary_color' => [
                    'type'        => 'color-pair',
                    'label'       => 'Secondary Text',
                    'description' => 'Color for labels, descriptions, and muted text.',
                    'default'     => '',
                    'key'         => 'text_secondary_color',
                    'pkg'         => 1,
                    'light'       => '#475569',
                    'dark'        => '#aaaaaa',
                ],
                'border_color' => [
                    'type'        => 'color-pair',
                    'label'       => 'Border Color',
                    'description' => 'Color for borders, dividers, and outlines.',
                    'default'     => '',
                    'key'         => 'border_color',
                    'pkg'         => 1,
                    'light'       => '#e2e8f0',
                    'dark'        => '#303030',
                ],
            ],
        ],
    ],
];
