<?php

/*----------------------------------------------------------------------------------*/

$medical_coach_common_inline_css = '';

$medical_coach_scroll_top_alignment = get_theme_mod('medical_coach_scroll_top_alignment', 'Right');

$medical_coach_alignment_styles = [
    'Left' => 'left: 20px;',
    'Center' => 'right: 50%; left: 50%;',
    'Right' => 'right: 20px;'
];

$alignment_style = $medical_coach_alignment_styles[$medical_coach_scroll_top_alignment] ?? $medical_coach_alignment_styles['Right'];

$medical_coach_common_inline_css .= "a.scrollup,button#scroll_2 { $alignment_style }";

/*----------------------------------------------------------------------------------*/

$medical_coach_footer_background_color = get_theme_mod('medical_coach_footer_background_color', 'var(--second-color)');

if (!empty($medical_coach_footer_background_color)) {
    $medical_coach_common_inline_css .= ".footer-widgets { background: " . esc_attr($medical_coach_footer_background_color) . "}";
}

/*----------------------------------------------------------------------------------*/

$medical_coach_footer_background_image = get_theme_mod('medical_coach_footer_background_image', '');

if (!empty($medical_coach_footer_background_image)) {
    $medical_coach_common_inline_css .= ".footer-widgets { background-image: url('" . esc_url($medical_coach_footer_background_image) . "') !important; background-size: cover; background-repeat: no-repeat; }";
}

/*----------------------------------------------------------------------------------*/

$medical_coach_copyright_alignment = get_theme_mod('medical_coach_copyright_alignment', 'Center');

$medical_coach_copyright_alignment_styles = [
    'Left' => 'text-align: left;',
    'Center' => 'text-align: center;',
    'Right' => 'text-align: right;'
];

$alignment_style = $medical_coach_copyright_alignment_styles[$medical_coach_copyright_alignment] ?? $medical_coach_copyright_alignment_styles['Center'];

$medical_coach_common_inline_css .= "#footer-copyright p { $alignment_style }";

/*----------------------------------------------------------------------------------*/

$medical_coach_container_width = get_theme_mod('medical_coach_container_width');

if (!empty($medical_coach_container_width)) {
    $medical_coach_common_inline_css .= "@media (min-width: 1024px) { 
        body, .navbar-area.header-fixed, .admin-bar .header-fixed,.loading { 
            width: " . esc_attr($medical_coach_container_width) . "%; 
            margin: 0 auto; 
        } 
        .admin-bar .header-fixed { 
            margin-top: 32px; 
        } 
    }";
}

/*----------------------------------------------------------------------------------*/ 

/*---------------------------Global Color-------------------*/

$medical_coach_theme_color_1 = get_theme_mod('medical_coach_theme_color_1');
$medical_coach_theme_color_2 = get_theme_mod('medical_coach_theme_color_2');
$medical_coach_theme_color_3 = get_theme_mod('medical_coach_theme_color_3');

/*--- First Global Color ---*/

if ($medical_coach_theme_color_1) {
  $medical_coach_common_inline_css .= ':root {';
  $medical_coach_common_inline_css .= '--first-color: ' . esc_attr($medical_coach_theme_color_1) . ' !important;';
  $medical_coach_common_inline_css .= '} ';
}

/*--- Second Global Color ---*/

if ($medical_coach_theme_color_2) {
  $medical_coach_common_inline_css .= ':root {';
  $medical_coach_common_inline_css .= '--second-color: ' . esc_attr($medical_coach_theme_color_2) . ' !important;';
  $medical_coach_common_inline_css .= '} ';
}

/*--- Third Global Color ---*/

if ($medical_coach_theme_color_3) {
  $medical_coach_common_inline_css .= ':root {';
  $medical_coach_common_inline_css .= '--third-color: ' . esc_attr($medical_coach_theme_color_3) . ' !important;';
  $medical_coach_common_inline_css .= '} ';
}