<?php
/**
 * Packers Movers Company Dynamic Styles
 *
 * @package Packers Movers Company
 */

// Enqueue the main stylesheet
function packers_movers_company_enqueue_styles() {
    // Replace 'your-main-stylesheet-handle' with your actual stylesheet handle
    wp_enqueue_style('packers-movers-company-style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'packers_movers_company_enqueue_styles');

// Function to add dynamic CSS
function packers_movers_company_dynamic_css() {
    // Get default theme options
    $packers_movers_company_default = packers_movers_company_get_default_theme_options();

    // Sanitize and get theme customizations
    $packers_movers_company_default_text_color = esc_attr(get_theme_mod('packers_movers_company_default_text_color', '')); // Default value if needed
    $packers_movers_company_logo_width_range = absint(get_theme_mod('packers_movers_company_logo_width_range', $packers_movers_company_default['packers_movers_company_logo_width_range']));
    $packers_movers_company_breadcrumb_font_size = absint(get_theme_mod('packers_movers_company_breadcrumb_font_size', $packers_movers_company_default['packers_movers_company_breadcrumb_font_size']));
    $packers_movers_company_menu_font_size = absint(get_theme_mod('packers_movers_company_menu_font_size', $packers_movers_company_default['packers_movers_company_menu_font_size']));
    $packers_movers_company_border_color = esc_attr(get_theme_mod('packers_movers_company_border_color', '')); // Default value if needed
    $packers_movers_company_background_color = '#' . ltrim(esc_attr(get_theme_mod('background_color', $packers_movers_company_default['packers_movers_company_background_color'])), '#');

    // Create dynamic CSS
    $packers_movers_company_dynamic_css = "
        body,
        .offcanvas-wraper,
        .header-searchbar-inner {
            background-color: {$packers_movers_company_background_color};
        }

        a:not(:hover):not(:focus):not(.btn-fancy),
        body, button, input, select, optgroup, textarea {
            color: {$packers_movers_company_default_text_color};
        }

        .site-topbar, .site-navigation,
        .offcanvas-main-navigation li,
        .offcanvas-main-navigation .sub-menu,
        .offcanvas-main-navigation .submenu-wrapper .submenu-toggle,
        .post-navigation,
        .widget .tab-head .twp-nav-tabs,
        .widget-area-wrapper .widget,
        .footer-widgetarea,
        .site-info,
        .right-sidebar .widget-area-wrapper,
        .left-sidebar .widget-area-wrapper,
        .widget-title,
        .widget_block .wp-block-group > .wp-block-group__inner-container > h2,
        input[type='text'],
        input[type='password'],
        input[type='email'],
        input[type='url'],
        input[type='date'],
        input[type='month'],
        input[type='time'],
        input[type='datetime'],
        input[type='datetime-local'],
        input[type='week'],
        input[type='number'],
        input[type='search'],
        input[type='tel'],
        input[type='color'],
        textarea {
            border-color: {$packers_movers_company_border_color};
        }

        .site-logo .custom-logo-link img{
            width: {$packers_movers_company_logo_width_range}px;
            object-fit: object-fit  ;
        }

        .site-navigation .primary-menu > li a {
            font-size: {$packers_movers_company_menu_font_size}px;
        }

        .breadcrumbs,.woocommerce-breadcrumb {
            font-size: {$packers_movers_company_breadcrumb_font_size}px !important;
        }
    ";

    // Add inline styles to the main stylesheet
    wp_add_inline_style('packers-movers-company-style', $packers_movers_company_dynamic_css); // Replace with your actual stylesheet handle
}

add_action('wp_enqueue_scripts', 'packers_movers_company_dynamic_css');