/*
 * Copyright (C) 2018, 2019, 2022, 2024 Andrew Gegg
 *
 *	This file is part of the Garden Notebook application
 *
 * The Garden Notebook application is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
/*
    Change log
    2.3.0   Improved presentation of tabs
            Use JavaFX CSS intrinsics to colour Tree & Table rows
    2.4.0   Add entry for read-only TextFields
    2.6.0   small adjustment to mandatory field display - red means 'wrong!'
    2.9.6   Change tab close button hover colour
            Tidy up fonts
    3.0.1   Make disabled fields more legible
    3.0.4   Highlight focussed button
    3.0.5   Make scroll bar thumb (and inc/dec arrow) stand out better
    3.1.1   Better hover & focus shading for nav buttons
    3.2.0   Entries for Lifecycle Analysis
    3.2.1   Slightly round buttons Win 11 style
            Change style for mandatory fields - just underline rather than surround
 */


/* 
*   Author      Andy Gegg
*   version	3.2.1
*   since	1.0
*/
@font-face {
    -fx-font-family: "Roboto";
    src: url("Roboto-Regular.ttf");
}
@font-face {
    -fx-font-family: "Roboto Bold";
    src: url("Roboto-Bold.ttf");
}
@font-face {
    -fx-font-family: "Roboto Black";
    src: url("Roboto-Black.ttf");
}
.root {
    even-line-colour: aliceblue;
    even-line-colour-selected: #a2d3ff;
    odd-line-colour: #f0fff8;
    odd-line-colour-selected: #80ffc3;
    diary-border-colour: lightgrey;
    diary-mandatory-border-colour: mediumpurple;  /* 2.6.0 */
    diary-error-border-colour: red;  /* 3.1.0 */
    btn-background-colour: aliceblue;
    btn-background-colour-lighter-1: derive(btn-background-colour, 10%);
    btn-background-colour-lighter-2: derive(btn-background-colour, 20%);
    btn-background-colour-darker-1: derive(btn-background-colour, -10%);
    btn-background-colour-darker-2: derive(btn-background-colour, -20%);
    btn-border-colour: darkgray;
    -fx-font-family: "Roboto";
    -fx-background-color: linear-gradient(aliceblue, #f0fff8);
    -fx-background-repeat: no-repeat;    /* fills bottom of canvas with background-color */
}

/* 3.0.1  - make disabled items legible, the default value is 0.4 */
/* Solution from https://stackoverflow.com/questions/30312325/javafx-disabled-element-styling */
.combo-box:disabled, .date-picker:disabled {
    -fx-opacity: 1;
}

/* 2.3.0 */
.tab-pane, .anchor-pane, .split-pane, .vbox, .stack-pane {
    -fx-background-color: transparent;
}
/* remove grey background */
/* in the next line the spaces are important */
.tab-pane .tab-header-area .tab-header-background {
    -fx-background-color: transparent;
}
/* draw top border of content area - or the tab 'floats' and looks weird */
.tab-pane .tab-content-area {
    -fx-border-style:solid; 
    -fx-border-width: 1 0 0 0; 
    -fx-border-color: -fx-outer-border;
}
/* match the focused tab colour */
.tab-pane:focused .tab-content-area {
    -fx-border-color: -fx-focus-color;
}
/*
.tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-close-button {
    -fx-background-color: -fx-mark-color;
    -fx-shape: "M 0,0 H1 L 4,3 7,0 H8 V1 L 5,4 8,7 V8 H7 L 4,5 1,8 H0 V7 L 3,4 0,1 Z";
    -fx-scale-shape: false;
    -fx-effect: dropshadow(two-pass-box , rgba(255, 255, 255, 0.4), 1, 0.0 , 0, 1);
}
*/
.tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-close-button:hover {
    -fx-background-color: red;
}

/*  make the scroll bar thumb stand out more */
.scroll-bar .thumb {
    -fx-background-color: derive(btn-background-colour, -15%);  /* lightsteelblue, 30% */
	-fx-background-radius: 2em;
}
.scroll-bar > .increment-button > .increment-arrow,
.scroll-bar > .decrement-button > .decrement-arrow {
    /*-fx-color: lightsteelblue;*/
    -fx-color: derive(btn-background-colour, -15%);
}

/* following entries layout the navigation columns */
.notebook-nav-button {
    -fx-border-style: solid line-cap square;
    -fx-pref-height: 4em;
    -fx-background-color: btn-background-colour;
    /*-fx-font-family: "roboto-medium";*/
    -fx-font-family: "Roboto Black";
/*    -fx-font-family: "Roboto Medium";
    -fx-font-weight: bold;*/
    -fx-font-size: larger;
    -fx-text-alignment: center;
    -fx-border-radius: 3;
    -fx-background-radius: 3;
}

.notebook-nav-button:focused, .notebook-nav-button:hover {
    -fx-background-color: btn-background-colour-darker-1;
    -fx-border-radius: 1em;
    -fx-background-radius: 1em;
}

.notebook-cmd-button {
    -fx-border-style: solid line-cap square;
    -fx-border-insets: 0, 1px, 2px;
    -fx-border-width: 1, 1, 1;
    -fx-border-color: btn-border-colour, transparent, transparent;
    -fx-background-color: btn-background-colour;
/*    -fx-font-family: "Roboto Medium";*/
    -fx-font-family: "Roboto Bold";
    -fx-text-alignment: center;
    -fx-border-radius: 3;
    -fx-background-radius: 3;
}
.notebook-cmd-button:pressed, .notebook-cmd-button:selected {
    /*-fx-background-color: btn-selected-background-colour;*/
    -fx-background-color: btn-background-colour, rgba(0,0,0,0.1);
    -fx-border-color: btn-border-colour, btn-background-colour-darker-1 btn-background-colour-lighter-1 btn-background-colour-lighter-1 btn-background-colour-darker-1,
        btn-background-colour-darker-2 btn-background-colour-lighter-2 btn-background-colour-lighter-2 btn-background-colour-darker-2;
}

.notebook-cmd-button:focused {
    -fx-background-color:
        -fx-focus-color,
        -fx-control-inner-background,
        -fx-faint-focus-color,
        linear-gradient(from 0px 0px to 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background);
    -fx-background-insets: -0.2, 1, -1.4, 3;
    -fx-background-radius: 3, 2, 4, 0;
}

/* Scroll panes for Lifecycle Analysis */
/* https://stackoverflow.com/questions/40253661/javafx-scrollpane-how-set-transparent-background#:~:text=Set%20an%20id%20to%20your,%2Dbackground%2Dcolor%20%3A%20transparent. Rahul Singh */
/* For a transparent background, set the background of the scroll pane and its viewport.*/
.notebook-analysis-header {
    -fx-background-insets: 0;
    -fx-padding: 0;
    -fx-background-color: transparent
}
.notebook-analysis-header > .viewport {
    -fx-background-color: transparent
}

.notebook-analysis-viewport > .viewport {
/* https://stackoverflow.com/questions/28456225/javafx-css-background-not-showing-properly  James_D
*   In JavaFX, to set a repeating linear gradient set the size of the repeat in the from/to section; it does not work with lengths in the colour stops.
*   Note also the repeated colours to give a hard break, not a transition.
*/
   -fx-background-color: linear-gradient(from 0px 0px to 0px 60px, repeat, even-line-colour 0%, even-line-colour 50%, odd-line-colour 50%, odd-line-colour 100%);
}


.notebook-analysis-icon:hover {
    -fx-background-color: odd-line-colour-selected;
}

/*
.notebook-next-button {
    -fx-shape: 'M0 0 100 50 0 100 Z';
    -fx-border-style: solid line-cap square;
    -fx-border-insets: 0, 1px, 2px;
    -fx-border-width: 1, 1, 1;
    -fx-border-color: btn-border-colour, transparent, transparent;
    -fx-background-color: btn-background-colour;
}
.notebook-previous-button {
    -fx-shape: 'M100 0 0 50 100 100 Z';
    -fx-border-style: solid line-cap square;
    -fx-border-insets: 0, 1px, 2px;
    -fx-border-width: 1, 1, 1;
    -fx-border-color: btn-border-colour, transparent, transparent;
    -fx-background-color: btn-background-colour;
}
.notebook-next-button:pressed, .notebook-next-button:selected .notebook-previous-button:pressed, .notebook-previous-button:selected {
     -fx-background-color: btn-background-colour, rgba(0,0,0,0.1);
}
*/

/* following entries used for the DiaryTab */
.notebook-diary-oddcell {
    -fx-background-color: odd-line-colour;
    /*-fx-background: -fx-control-inner-background-alt;*/
    -fx-border-color : diary-border-colour;
    -fx-border-width: 1;
}
.notebook-diary-evencell {
    /*-fx-background-color: lightgreen;*/
    -fx-background-color: even-line-colour;
    /*-fx-background: -fx-control-inner-background;*/
    -fx-border-color : diary-border-colour;
    -fx-border-width: 1;
}
/* use colours to show selected rows - JavaFX makes this harder than you'd expect... */
.table-row-cell:selected {
    -fx-text-background-color: black;    /* default is white and it's invisible  */
}
.table-row-cell:selected .notebook-diary-evencell {
    -fx-background-color: even-line-colour-selected;
}
.table-row-cell:selected .notebook-diary-oddcell {
    -fx-background-color: odd-line-colour-selected;
}

.notebook-diary-topcell {
    -fx-border-width: 1 1 0 1;
}
.notebook-diary-midcell {
    -fx-border-width: 0 1 0 1;
}
.notebook-diary-bottomcell {
    -fx-border-width: 0 1 1 1;
}
/* following should right align the numbers, but it doesn't - this seems to be a well known bug */
.notebook-diary-moneycell {
    /* -fx-background-color: orange; */
    -fx-text-alignment: right;
    -fx-content-display: right;
}

/* following entries used for the PlantCatalogue */
/*
.notebook-catalogue-treecell:even{
    -fx-background-color: even-line-colour;    
}
.notebook-catalogue-treecell:odd{
    -fx-background-color: odd-line-colour;    
}
*/

/* use colours to show selected rows - JavaFX makes this harder than you'd expect... */
.tree-table-row-cell:selected {
    -fx-text-background-color: black;    /* default is white and it's invisible  */
}
/*
.tree-table-row-cell:selected .notebook-catalogue-treecell:even {
    -fx-background-color: even-line-colour-selected;
}
.tree-table-row-cell:selected .notebook-catalogue-treecell:odd {
    -fx-background-color: odd-line-colour-selected;
}
*/

.tree-table-row-cell:even {
    -fx-background-color: even-line-colour;    
}
.tree-table-row-cell:selected:even {
    -fx-background-color: even-line-colour-selected;    
}
.tree-table-row-cell:odd {
    -fx-background-color: odd-line-colour;    
}
.tree-table-row-cell:selected:odd {
    -fx-background-color: odd-line-colour-selected;    
}
.tree-table-row-cell:empty {
    -fx-background-color: transparent;    
}

.table-row-cell:even {
    -fx-background-color: even-line-colour;    
}
.table-row-cell:selected:even {
    -fx-background-color: even-line-colour-selected;    
}
.table-row-cell:odd {
    -fx-background-color: odd-line-colour;    
}
.table-row-cell:selected:odd {
    -fx-background-color: odd-line-colour-selected;    
}
.table-row-cell:empty {
    -fx-background-color: transparent;    
}

.tooltip {
    -fx-background-color: aliceblue;
    -fx-text-background-color: black;    /* default is white and it's invisible  */
    -fx-text-fill: black;    /* default is white and it's invisible  */
}

/* for the create/edit forms */
.notebook-mandatory-field {
    -fx-border-color : diary-mandatory-border-colour;
   /* -fx-border-width: 2;    /* 2.6.0 */
    -fx-border-width: 0 0 2 0;    /* 3.2.1 */
}
/* 3.1.0 */
.notebook-error-field {
    -fx-border-color : diary-error-border-colour;
    -fx-border-width: 2;
}

/* for text fields which are read-only */
.notebook-noedit-text {
    -fx-background-color: btn-background-colour;
    -fx-border-color : diary-border-colour;
    -fx-border-width: 1;
}

#paneTopSplit {
    -fx-border-width: 1px;
    -fx-border-color: transparent transparent lightgray transparent;
}
