/* --- Main parameters --- */

/* Define parameters */
:root {
    /* Police */
    --font_family: Arial, Helvetica, sans-serif;
    /* Build Order (BO) panel */
    --bo_panel_text_color: rgb(255, 255, 255);
    --bo_panel_background_color: rgb(70, 70, 70);
    --bo_panel_emphasis_color: rgb(0, 62, 124);
    --number_select_width: 40px;
    --number_select_radius: 5px;
    --slider_horizontal_space: 15px;
    --bo_panel_padding: 10px;
    --bo_panel_lines_half_vertical_spacing: 5px;
    --bo_line_config_elements_gap: 10px;
    --bo_line_resources_elements_gap: 8px;
    --bo_line_note_elements_gap: 5px;
    --bo_timing_note_min_width: 40px;
    --bo_timing_padding_right: 10px;
    /* Images selection */
    --images_copy_min_width: 40%;
    --images_bo_display_background_color: rgb(70, 70, 70);
    --images_bo_display_border_radius: 10px;
    --images_bo_display_padding: 8px;
    --images_bo_display_gap: 5px;
    /* Configuration page */
    --main_column_gap: 5px;
    --config_row_gap: 5px;
    --text_full_line_horizontal_space: 10px;
    --text_full_line_vertical_space: 10px;
    --timer_offset_width: 40px;
    --configuration_text_font_size: 0.9em;
    --main_instructions_font_size: 0.95em;
    --search_key_font_size: 0.9em;
    --search_key_selected_color: rgb(185, 0, 0);
    --reference_color: rgb(120, 120, 120);
    --background_color: rgb(220, 220, 220);
    --footer_color: rgb(120, 120, 120);
    --footer_font_size: 0.85em;
    --footer_top_space: 10px;
    --page_top_space: 20px;
    --preview_panel_top_space: 30px;
    --images_bo_display_top_space: 10px;
    --div_vertical_space: 10px;
    --radio_button_text: 0.85em;
    --side_selection_text_space: 5px;
    /* Toggle */
    --toggle_radius: 10px;
    --toggle_slider_diameter: 12px;
    --toggle_slider_horizontal_shift: 6px;
    --toggle_slider_vertical_shift: 4px;
    --toggle_slider_translation: 16px;
    --toggle_translation_time: 0.5s;
    --toggle_left_color: rgb(7, 34, 97);
    --toggle_right_color: rgb(185, 0, 0);
    --toggle_slider_color: rgb(255, 255, 255);
    /* Build order design */
    --bo_text_area_width: 100%;
    --bo_text_area_height: 55%;
    --bo_text_area_color: rgb(0, 0, 0);
    --bo_text_area_background_color: rgb(255, 255, 255);
    --bo_text_area_font_size: 1.05em;
    --bo_text_area_text_inner_padding: 15px;
    --bo_text_area_border_size: 2px;
    --bo_text_area_border_color: rgb(0, 0, 0);
    --bo_design_border_radius: 10px;
    --bo_visual_desing_max_width: 50vw;
    --bo_visual_desing_max_height: 60vh;
    --bo_design_buttons_space: 5px;
    --bo_design_select_space: 10px;
    --bo_design_non_editable_color: rgb(180, 180, 180);
    --bo_design_vertical_space: 5px;
    --bo_visual_design_padding: 15px;
    --bo_visual_design_line_start: 2.5%;
    --bo_visual_design_line_size: 95%;
    --bo_visual_design_line_color: rgb(150, 150, 150);
    /* Grid image selector with '@' suggestions */
    --grid_selector_background_color: rgb(0, 0, 0);
    /* Buttons */
    --button_color: rgb(255, 255, 255);
    --no_selected_button_color: rgb(210, 210, 210);
    --button_border_size: 1px;
    --button_border_color: rgb(0, 0, 0);
    --button_border_radius: 5px;
    --button_vertical_padding: 3px;
    --button_horizontal_padding: 6px;
    --button_shadow_offset_x: 2px;
    --button_shadow_offset_y: 2px;
    --button_shadow_blur_radius: 2px;
    --button_shadow_color: rgb(0, 0, 0);
    --button_hover_left_shift: -2px;
    --button_hover_top_shift: -2px;
    /* Tooltips */
    --tooltip_color: rgb(255, 255, 255);
    --tooltip_background_color: rgb(0, 0, 0);
    --tooltip_border_radius: 5px;
    --tooltip_padding_vertical: 12px;
    --tooltip_padding_horizontal: 12px;
    --tooltip_shift: calc(100% + 5px);
    --tooltip_delay: 1.5s;
    --tooltip_rts_info_delay: 0s;
}


/* --- Configuration window --- */

/* Main body */
html,
body {
    height: 100%;
}

body {
    font-family: var(--font_family);
    display: flex;
    flex-direction: column;
    background-color: var(--background_color);
}

/* references */
a {
    color: var(--reference_color);
    font-weight: bold;
    text-decoration: none;
}

/* Main body of the configuration page in two columns */
#body_config {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    flex: 1 0 auto;
}

/* Each column has its elements on the left */
.main_column {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: var(--main_column_gap);
    margin-top: var(--page_top_space);
}

/* Row of elements for the configuration */
.config_row {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--config_row_gap);
}

/* Text with full line on the side */
.text_full_line_row {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid;
    line-height: 0.1em;
    margin-top: var(--text_full_line_vertical_space);
    margin-bottom: var(--text_full_line_vertical_space);
}

.text_full_line_row span {
    background: var(--background_color);
    padding: 0 var(--text_full_line_horizontal_space);
    font-size: var(--configuration_text_font_size);
}

/* Buttons */
.button {
    background-color: var(--button_color);
    border: var(--button_border_size) var(--button_border_color) solid;
    border-radius: var(--button_border_radius);
    padding-top: var(--button_vertical_padding);
    padding-bottom: var(--button_vertical_padding);
    padding-left: var(--button_horizontal_padding);
    padding-right: var(--button_horizontal_padding);
}

.button:hover {
    box-shadow: var(--button_shadow_offset_x) var(--button_shadow_offset_y) var(--button_shadow_blur_radius) var(--button_shadow_color);
    position: relative;
    left: var(--button_hover_left_shift);
    top: var(--button_hover_top_shift);
}

/* Search library line */
.search_key_line {
    font-size: var(--search_key_font_size);
}

.search_key_select {
    font-weight: bold;
    color: var(--search_key_selected_color);
}

/* Radio buttons to select the main configuration */
.radio_selector input[type="radio"] {
    display: none;
}

.radio_selector label {
    background-color: var(--no_selected_button_color);
    font-size: var(--radio_button_text);
}

.radio_selector input[type="radio"]:checked+label {
    background-color: var(--button_color);
}

/* Space between specific <div> sections */
.div_space {
    margin-top: var(--div_vertical_space);
}

/* Optional timing offset */
#time_offset {
    width: var(--timer_offset_width);
}

/* Vertical space to the preview panel/salamander icon */
#bo_panel_salamander {
    padding-top: var(--preview_panel_top_space);
}

/* Tooltip */
.tooltip {
    /* Tooltip position is relative to its parent */
    position: relative;
}

.tooltip .tooltiptext_left,
.tooltip .tooltiptext_right {
    /* Tooltip format */
    white-space: nowrap;
    color: var(--tooltip_color);
    background-color: var(--tooltip_background_color);
    border-radius: var(--tooltip_border_radius);
    padding-top: var(--tooltip_padding_vertical);
    padding-bottom: var(--tooltip_padding_vertical);
    padding-left: var(--tooltip_padding_horizontal);
    padding-right: var(--tooltip_padding_horizontal);

    /* Tooltip position */
    position: absolute;
    z-index: 1;

    /* Tooltip not visible by default */
    opacity: 0;
    visibility: hidden;
}

.tooltip .tooltiptext_left {
    /* Tooltip on the left */
    right: var(--tooltip_shift);
}

.tooltip .tooltiptext_right {
    /* Tooltip on the right */
    left: var(--tooltip_shift);
}

.tooltip:hover .tooltiptext_left,
.tooltip:hover .tooltiptext_right {
    /* Tooltip visible after a short hovering time */
    opacity: 1;
    visibility: visible;
    transition: opacity;
    transition-delay: var(--tooltip_delay);
}

#tooltip_rts_overlay_info {
    font-size: var(--main_instructions_font_size);
    /* Overwrite the hovering time for the main RTS Overlay info */
    transition-delay: var(--tooltip_rts_info_delay);
}

/* Selection for the build order panel */
.bo_panel_number_select {
    width: var(--number_select_width);
    border-radius: var(--number_select_radius);
}

#bo_fontsize_value {
    padding-right: var(--slider_horizontal_space);
}

/* Text on the configuration window (not inside widget) */
.configuration_text {
    font-size: var(--configuration_text_font_size);
}

/* Text on to select the overlay side */
#side_selection_text {
    padding-left: var(--side_selection_text_space);
}

/* Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: calc(var(--toggle_slider_diameter) + var(--toggle_slider_translation) + 2 * var(--toggle_slider_horizontal_shift));
    height: calc(var(--toggle_slider_diameter) + 2 * var(--toggle_slider_vertical_shift));
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle_left_color);
    -webkit-transition: var(--toggle_translation_time);
    transition: var(--toggle_translation_time);
}

.slider:before {
    position: absolute;
    content: "";
    height: var(--toggle_slider_diameter);
    width: var(--toggle_slider_diameter);
    left: var(--toggle_slider_horizontal_shift);
    bottom: var(--toggle_slider_vertical_shift);
    background-color: var(--toggle_slider_color);
    -webkit-transition: var(--toggle_translation_time);
    transition: var(--toggle_translation_time);
}

input:checked+.slider {
    background-color: var(--toggle_right_color);
}

input:checked+.slider:before {
    -webkit-transform: translateX(var(--toggle_slider_translation));
    -ms-transform: translateX(var(--toggle_slider_translation));
    transform: translateX(var(--toggle_slider_translation));
}

.slider.round {
    border-radius: var(--toggle_radius);
}

.slider.round:before {
    border-radius: 50%;
}

/* BO text area (raw JSON) */
#bo_design_raw {
    width: var(--bo_text_area_width);
    height: var(--bo_text_area_height);

    color: var(--bo_text_area_color);
    background-color: var(--bo_text_area_background_color);
    font-size: var(--bo_text_area_font_size);

    /* Inner padding from text to border */
    padding: var(--bo_text_area_text_inner_padding);
    box-sizing: border-box;

    /* Border */
    border: var(--bo_text_area_border_size), var(--bo_text_area_border_color) solid;
    border-radius: var(--bo_design_border_radius);
}

/* Bo visual design */
#bo_design_visual {
    max-width: var(--bo_visual_desing_max_width);
    max-height: var(--bo_visual_desing_max_height);
    overflow: auto;
}

.bo_design_visual_table {
    color: var(--bo_panel_text_color);
    background-color: var(--bo_panel_background_color);
    border-radius: var(--bo_design_border_radius);
    border-collapse: collapse;
}

.bo_design_visual_table td {
    vertical-align: middle;
    padding: var(--bo_visual_design_padding);
}

.bo_design_visual_table img {
    vertical-align: middle;
}

.bo_design_visual_table .circle_button {
    background-color: transparent;
    border: none;
    padding: 0;
}

.bo_design_visual_table .circle_button:hover {
    border-radius: 50%;
}

.bo_visu_design_buttons_left,
.bo_visu_design_buttons_right {
    display: flex;
    flex-direction: row;
    gap: var(--bo_design_buttons_space);
}

.bo_visu_design_buttons_left {
    justify-content: flex-start;
}

.bo_visu_design_buttons_right {
    justify-content: flex-end;
}

.bo_design_select_with_image {
    display: flex;
    flex-direction: row;
    gap: var(--bo_design_select_space);
}

.non_editable_field {
    color: var(--bo_design_non_editable_color);
    font-style: italic;
}

#bo_design_visual_header {
    margin-bottom: var(--bo_design_vertical_space);
}

#bo_design_visual_header td {
    text-align: left;
}

#bo_design_visual_content td {
    text-align: center;
}

#bo_design_visual_content .border_top {
    position: relative;
}

#bo_design_visual_content .border_top::after {
    content: '';
    position: absolute;
    top: 0;
    left: var(--bo_visual_design_line_start);
    width: var(--bo_visual_design_line_size);
    border: 1px solid var(--bo_visual_design_line_color);
}

/* Line with RTS Overlay info and BO design indication */
#info_bo_validity {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Grid image selector with '@' suggestions */
#image_selector_grid {
    width: fit-content;
    display: grid;
    background-color: var(--grid_selector_background_color);
}

/* Footer */
footer {
    display: flex;
    flex-direction: row;
    justify-content: center;
    color: var(--footer_color);
    font-size: var(--footer_font_size);
    margin-top: var(--footer_top_space);
    font-style: italic;
}


/* --- Overlay window --- */

/* Body of the overlay */
#body_overlay {
    margin: 0;
    padding: 0;
    background-color: var(--bo_panel_background_color);
    display: inline-block;
    /* Hide scroll bars */
    overflow: hidden;
}


/* --- Build Order (BO) panel --- */

/* Start or end justify-content for flexbox */
.justify_flex_start {
    justify-content: flex-start;
}

.justify_flex_end {
    justify-content: flex-end;
}

/* BO container */
#bo_panel {
    color: var(--bo_panel_text_color);
    background-color: var(--bo_panel_background_color);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Single line of the BO panel */
.bo_line {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding-left: var(--bo_panel_padding);
    padding-right: var(--bo_panel_padding);
}

/* Configuration line of the BO panel */
.bo_line_config {
    column-gap: var(--bo_line_config_elements_gap);
    padding-top: var(--bo_panel_padding);
    padding-bottom: var(--bo_panel_lines_half_vertical_spacing);
}

/* Resrouces line of the BO panel */
.bo_line_resources {
    justify-content: flex-start;
    column-gap: var(--bo_line_resources_elements_gap);
    padding-top: var(--bo_panel_lines_half_vertical_spacing);
}

/* Single note line of the BO panel */
.bo_line_note {
    justify-content: flex-start;
    column-gap: var(--bo_line_note_elements_gap);
}

/* First note line of the BO panel */
.bo_line_note_first {
    padding-bottom: var(--bo_panel_lines_half_vertical_spacing);
}

/* Middle (not first, not last) note line of the BO panel */
.bo_line_note_middle {
    padding-top: var(--bo_panel_lines_half_vertical_spacing);
    padding-bottom: var(--bo_panel_lines_half_vertical_spacing);
}

/* Last note line of the BO panel */
.bo_line_note_last {
    padding-top: var(--bo_panel_lines_half_vertical_spacing);
    padding-bottom: var(--bo_panel_padding);
}

/* Color for a BO step with emphasis */
.bo_line_emphasis {
    background-color: var(--bo_panel_emphasis_color);
}

/* Spacing for timing indication in the BO */
.bo_line_note_timing {
    text-align: right;
    min-width: var(--bo_timing_note_min_width);
    padding-right: var(--bo_timing_padding_right);
}

/* Image selection result (for copy) */
#image_copy {
    min-width: var(--images_copy_min_width);
}

/* Instructions for drag & drop */
#drag_and_drop_note {
    font-size: 90%;
    font-style: italic;
}

/* Images category selection line */
#image_category_line {
    margin-top: var(--images_bo_display_top_space);
}

/* Images selection display: main rows */
#images_bo_display {
    display: flex;
    flex-direction: column;
    background-color: var(--images_bo_display_background_color);
    border-radius: var(--images_bo_display_border_radius);
    padding: var(--images_bo_display_padding);
    row-gap: var(--images_bo_display_gap);
    margin-top: var(--images_bo_display_top_space);
}

/* Images selection display: single row content */
#images_bo_display .row {
    display: flex;
    flex-direction: row;
    column-gap: var(--images_bo_display_gap);
}


/* --- Footer --- */
#footer {
    text-align: center;
}