<?php
namespace Bookaro\Controller\Admin\Settings;

defined( 'ABSPATH' ) || exit;

final class AppearanceTab extends AbstractSettingsTab
{
    public function get_key(): string
    {
        return 'appearance';
    }

    public function get_section(): array
    {
        return [
            'id'    => 'bookaro_appearance',
            'title' => __( 'Branding', 'mybookaro' ),
            'page'  => 'bookaro-booking-settings-appearance',
            'desc'  => __( 'Customize booking UI colors, typography, and layout.', 'mybookaro' ),
        ];
    }

    public function get_fields(): array
    {
        return [
            [
                'id' => 'heading_brand_colors',
                'label' => '',
                'callback' => 'render_heading_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Brand colors', 'mybookaro' ),
                    'description' => __( 'Set the primary and secondary accent colors used on buttons.', 'mybookaro' ),
                    'field_type' => 'heading',
                ],
            ],
            [ 'id'=>'appearance_primary_color', 'label'=>__( 'Primary Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#007cba','description'=>__( 'Main call-to-action button color.', 'mybookaro' ),'tooltip'=>__( 'Used for primary booking actions.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_secondary_color', 'label'=>__( 'Secondary Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#6c757d','description'=>__( 'Secondary button and subtle actions color.', 'mybookaro' ),'tooltip'=>__( 'Used for secondary actions and muted buttons.', 'mybookaro' ) ] ],
            [
                'id' => 'heading_modal_layout',
                'label' => '',
                'callback' => 'render_heading_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Modal and layout', 'mybookaro' ),
                    'description' => __( 'Adjust the booking modal container, spacing, and overlays.', 'mybookaro' ),
                    'field_type' => 'heading',
                ],
            ],
            [ 'id'=>'appearance_modal_bg_color', 'label'=>__( 'Modal Background Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#ffffff','tooltip'=>__( 'Background color for the booking modal.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_overlay_color', 'label'=>__( 'Modal Overlay Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'rgba(0,0,0,0.5)','description'=>__( 'Overlay tint behind the modal.', 'mybookaro' ),'tooltip'=>__( 'Controls the dimmed background behind the modal.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_close_btn_color', 'label'=>__( 'Close Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#000000','tooltip'=>__( 'Default close icon color.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_close_btn_hover_color', 'label'=>__( 'Close Button Hover Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#333333','tooltip'=>__( 'Hover state for the close icon.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_modal_max_width', 'label'=>__( 'Modal Max Width', 'mybookaro' ), 'callback'=>'render_text_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'min(96vw, 86rem)','tooltip'=>__( 'Maximum width of the booking modal.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_dashboard_max_width', 'label'=>__( 'Dashboard Max Width', 'mybookaro' ), 'callback'=>'render_text_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'800px','tooltip'=>__( 'Maximum width of provider and customer dashboards.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_modal_padding', 'label'=>__( 'Modal Padding', 'mybookaro' ), 'callback'=>'render_text_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'2rem','tooltip'=>__( 'Inner padding for the booking modal.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_border_radius', 'label'=>__( 'Border Radius', 'mybookaro' ), 'callback'=>'render_text_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'1.5rem','tooltip'=>__( 'Corner rounding for modal and cards.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_shadow_opacity', 'label'=>__( 'Shadow Opacity (0-1)', 'mybookaro' ), 'callback'=>'render_number_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'0.1','min'=>0,'max'=>1,'step'=>'0.1','tooltip'=>__( 'Drop shadow intensity for the modal.', 'mybookaro' ) ] ],
            [
                'id' => 'heading_typography',
                'label' => '',
                'callback' => 'render_heading_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Typography', 'mybookaro' ),
                    'description' => __( 'Fonts used inside the booking UI.', 'mybookaro' ),
                    'field_type' => 'heading',
                ],
            ],
            [ 'id'=>'appearance_body_font_preset', 'label'=>__( 'Body Font', 'mybookaro' ), 'callback'=>'render_select_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[
                'options'=>[
                    'system'=>__( 'System default (recommended)', 'mybookaro' ),
                    'theme'=>__( 'Use my theme font', 'mybookaro' ),
                    'sans'=>__( 'Sans-serif (Arial)', 'mybookaro' ),
                    'serif'=>__( 'Serif (Georgia)', 'mybookaro' ),
                    'mono'=>__( 'Monospace', 'mybookaro' ),
                    'custom'=>__( 'Custom…', 'mybookaro' ),
                ],
                'default'=>'system',
                'description'=>__( 'Font for body text in the booking UI and dashboards.', 'mybookaro' ),
                'tooltip'=>__( 'System default stays consistent on any theme. Pick "Use my theme font" to inherit your site font, or "Custom" to enter your own font stack.', 'mybookaro' ),
            ] ],
            [ 'id'=>'appearance_body_font', 'label'=>__( 'Custom Body Font Stack', 'mybookaro' ), 'callback'=>'render_text_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[
                'default'=>'system-ui, sans-serif',
                'tooltip'=>__( 'A CSS font-family stack, e.g. Poppins, sans-serif. Applied only when Body Font is set to Custom.', 'mybookaro' ),
                'depends'=>[ [ 'field'=>'appearance_body_font_preset', 'operator'=>'equals', 'value'=>'custom' ] ],
            ] ],
            [ 'id'=>'appearance_heading_font_preset', 'label'=>__( 'Heading Font', 'mybookaro' ), 'callback'=>'render_select_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[
                'options'=>[
                    'body'=>__( 'Same as body (recommended)', 'mybookaro' ),
                    'theme'=>__( 'Use my theme font', 'mybookaro' ),
                    'system'=>__( 'System', 'mybookaro' ),
                    'sans'=>__( 'Sans-serif (Arial)', 'mybookaro' ),
                    'serif'=>__( 'Serif (Georgia)', 'mybookaro' ),
                    'mono'=>__( 'Monospace', 'mybookaro' ),
                    'custom'=>__( 'Custom…', 'mybookaro' ),
                ],
                'default'=>'body',
                'description'=>__( 'Font for headings in the booking UI. "Same as body" keeps everything consistent.', 'mybookaro' ),
                'tooltip'=>__( 'Leave on "Same as body" for a consistent look, or choose a different font for headings only.', 'mybookaro' ),
            ] ],
            [ 'id'=>'appearance_heading_font', 'label'=>__( 'Custom Heading Font Stack', 'mybookaro' ), 'callback'=>'render_text_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[
                'default'=>'',
                'tooltip'=>__( 'A CSS font-family stack for headings. Applied only when Heading Font is set to Custom.', 'mybookaro' ),
                'depends'=>[ [ 'field'=>'appearance_heading_font_preset', 'operator'=>'equals', 'value'=>'custom' ] ],
            ] ],
            [
                'id' => 'heading_calendar',
                'label' => '',
                'callback' => 'render_heading_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Calendar and timeslots', 'mybookaro' ),
                    'description' => __( 'Customize the calendar header and timeslot styling.', 'mybookaro' ),
                    'field_type' => 'heading',
                ],
            ],
            [ 'id'=>'appearance_calendar_header_color', 'label'=>__( 'Calendar Header Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#f7f7f7','tooltip'=>__( 'Header background for the booking calendar.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_slot_border_color', 'label'=>__( 'Timeslot Border Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#dee2e6','tooltip'=>__( 'Border color for available timeslots.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_slot_selected_color', 'label'=>__( 'Timeslot Selected Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#007cba','tooltip'=>__( 'Highlight color for selected timeslots.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_slot_disabled_color', 'label'=>__( 'Timeslot Disabled Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#cccccc','tooltip'=>__( 'Color for disabled or unavailable timeslots.', 'mybookaro' ) ] ],
            [
                'id' => 'heading_dashboard_ui',
                'label' => '',
                'callback' => 'render_heading_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Dashboard UI', 'mybookaro' ),
                    'description' => __( 'Control density and surface style in provider/customer dashboards.', 'mybookaro' ),
                    'field_type' => 'heading',
                ],
            ],
            [
                'id' => 'appearance_dashboard_density',
                'label' => __( 'Dashboard Density', 'mybookaro' ),
                'callback' => 'render_select_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'options' => [
                        'comfortable' => __( 'Comfortable', 'mybookaro' ),
                        'compact' => __( 'Compact', 'mybookaro' ),
                    ],
                    'default' => 'comfortable',
                    'description' => __( 'Controls padding and row height in dashboard tables and cards.', 'mybookaro' ),
                    'tooltip' => __( 'Adjusts spacing across dashboard lists and cards.', 'mybookaro' ),
                ],
            ],
            [
                'id' => 'appearance_dashboard_density_note_comfortable',
                'label' => '',
                'callback' => 'render_note_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Comfortable spacing', 'mybookaro' ),
                    'description' => __( 'Best for readability with larger padding and roomier tables.', 'mybookaro' ),
                    'variant' => 'info',
                    'field_type' => 'note',
                    'depends' => [
                        [ 'field' => 'appearance_dashboard_density', 'operator' => 'equals', 'value' => 'comfortable' ],
                    ],
                ],
            ],
            [
                'id' => 'appearance_dashboard_density_note_compact',
                'label' => '',
                'callback' => 'render_note_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Compact spacing', 'mybookaro' ),
                    'description' => __( 'Shows more rows and cards by tightening padding.', 'mybookaro' ),
                    'variant' => 'info',
                    'field_type' => 'note',
                    'depends' => [
                        [ 'field' => 'appearance_dashboard_density', 'operator' => 'equals', 'value' => 'compact' ],
                    ],
                ],
            ],
            [
                'id' => 'appearance_dashboard_surface_style',
                'label' => __( 'Dashboard Surface Style', 'mybookaro' ),
                'callback' => 'render_select_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'options' => [
                        'soft' => __( 'Soft', 'mybookaro' ),
                        'flat' => __( 'Flat', 'mybookaro' ),
                    ],
                    'default' => 'soft',
                    'description' => __( 'Soft uses shadows and depth; Flat uses borders only.', 'mybookaro' ),
                    'tooltip' => __( 'Choose between elevated cards or flat bordered surfaces.', 'mybookaro' ),
                ],
            ],
            [
                'id' => 'appearance_dashboard_surface_note_soft',
                'label' => '',
                'callback' => 'render_note_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Soft surfaces', 'mybookaro' ),
                    'description' => __( 'Uses depth and shadows for cards and panels.', 'mybookaro' ),
                    'variant' => 'info',
                    'field_type' => 'note',
                    'depends' => [
                        [ 'field' => 'appearance_dashboard_surface_style', 'operator' => 'equals', 'value' => 'soft' ],
                    ],
                ],
            ],
            [
                'id' => 'appearance_dashboard_surface_note_flat',
                'label' => '',
                'callback' => 'render_note_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Flat surfaces', 'mybookaro' ),
                    'description' => __( 'Uses clean borders without shadows for a minimal look.', 'mybookaro' ),
                    'variant' => 'info',
                    'field_type' => 'note',
                    'depends' => [
                        [ 'field' => 'appearance_dashboard_surface_style', 'operator' => 'equals', 'value' => 'flat' ],
                    ],
                ],
            ],
            [
                'id' => 'appearance_dashboard_shadow_depth',
                'label' => __( 'Dashboard Shadow Depth', 'mybookaro' ),
                'callback' => 'render_select_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'options' => [
                        'subtle' => __( 'Subtle', 'mybookaro' ),
                        'medium' => __( 'Medium', 'mybookaro' ),
                        'deep' => __( 'Deep', 'mybookaro' ),
                    ],
                    'default' => 'medium',
                    'description' => __( 'Controls the shadow size used in soft dashboard surfaces.', 'mybookaro' ),
                    'tooltip' => __( 'Visible only when Surface Style is set to Soft.', 'mybookaro' ),
                    'depends' => [
                        [ 'field' => 'appearance_dashboard_surface_style', 'operator' => 'equals', 'value' => 'soft' ],
                    ],
                ],
            ],
            [
                'id' => 'appearance_dashboard_shadow_opacity',
                'label' => __( 'Dashboard Shadow Opacity (0-1)', 'mybookaro' ),
                'callback' => 'render_number_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'default' => '0.1',
                    'min' => 0,
                    'max' => 1,
                    'step' => '0.1',
                    'description' => __( 'Controls how strong the soft shadow appears.', 'mybookaro' ),
                    'tooltip' => __( 'Visible only when Surface Style is set to Soft.', 'mybookaro' ),
                    'depends' => [
                        [ 'field' => 'appearance_dashboard_surface_style', 'operator' => 'equals', 'value' => 'soft' ],
                    ],
                ],
            ],
            [
                'id' => 'appearance_dashboard_border_color',
                'label' => __( 'Dashboard Border Color', 'mybookaro' ),
                'callback' => 'render_color_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'default' => '#e2e8f0',
                    'description' => __( 'Border color used for flat dashboard surfaces.', 'mybookaro' ),
                    'tooltip' => __( 'Visible only when Surface Style is set to Flat.', 'mybookaro' ),
                    'depends' => [
                        [ 'field' => 'appearance_dashboard_surface_style', 'operator' => 'equals', 'value' => 'flat' ],
                    ],
                ],
            ],
            [
                'id' => 'appearance_dashboard_border_width',
                'label' => __( 'Dashboard Border Width (px)', 'mybookaro' ),
                'callback' => 'render_number_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'default' => '1',
                    'min' => 0,
                    'max' => 6,
                    'step' => '1',
                    'description' => __( 'Border thickness used for flat dashboard surfaces.', 'mybookaro' ),
                    'tooltip' => __( 'Visible only when Surface Style is set to Flat.', 'mybookaro' ),
                    'depends' => [
                        [ 'field' => 'appearance_dashboard_surface_style', 'operator' => 'equals', 'value' => 'flat' ],
                    ],
                ],
            ],
            [
                'id' => 'heading_dashboard_actions',
                'label' => '',
                'callback' => 'render_heading_field',
                'section' => 'bookaro_appearance',
                'page' => 'bookaro-booking-settings-appearance',
                'args' => [
                    'title' => __( 'Dashboard Actions', 'mybookaro' ),
                    'description' => __( 'Customize action button colors for frontend dashboards.', 'mybookaro' ),
                    'field_type' => 'heading',
                ],
            ],
            [ 'id'=>'appearance_action_approve_color', 'label'=>__( 'Approve Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#22c55e','tooltip'=>__( 'Color for approve actions.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_action_reject_color', 'label'=>__( 'Reject Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#ef4444','tooltip'=>__( 'Color for reject actions.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_action_view_color', 'label'=>__( 'View Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#2563eb','tooltip'=>__( 'Color for view actions.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_action_note_color', 'label'=>__( 'Add Note Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#0ea5e9','tooltip'=>__( 'Color for add note actions.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_action_cancel_color', 'label'=>__( 'Cancel Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#dc2626','tooltip'=>__( 'Color for cancel actions.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_action_reschedule_color', 'label'=>__( 'Reschedule Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#6366f1','tooltip'=>__( 'Color for reschedule actions.', 'mybookaro' ) ] ],
            [ 'id'=>'appearance_action_complete_color', 'label'=>__( 'Complete Button Color', 'mybookaro' ), 'callback'=>'render_color_field', 'section'=>'bookaro_appearance', 'page'=>'bookaro-booking-settings-appearance', 'args'=>[ 'default'=>'#16a34a','tooltip'=>__( 'Color for complete actions.', 'mybookaro' ) ] ],
        ];
    }
}
