:root {
    --bg-color: unset;
    --text--color: unset;
    --text--color--hover: unset;
    --text--bg-color--hover: unset;
    --spacer-width: unset;
    --spacer-height: unset;
    --spacer-color: unset;
    --spacer-margin: unset;
    --menu_height: 100%;
    --fill--color: transparent;
    --kotchi_font_family: 'Inter', sans-serif;
    --bs-btn-hover-color: #FFF;
    --menu-padding-bottom: 0;
    --menu-scale: min(calc(100vw / var(--menu-width)), 1);
    /* Header scroll variables (set by JS) */
    --header-height: 7.25rem;
    --header-true-height: var(--header-height);
    --header-ratio: 1;
    --header-normalized-ratio: 1;
    /* Header config */
    --header-initial-margin: 1.5rem;
    --header-min-scale: 0.8;
}

/*TODO : Order class*/

* {
    font-family: var(--kotchi_font_family), serif;
}

h3 {
    font-weight: 600;
    font-size: 22px;
    line-height: 100%;
    color: #3A416B;
}

.breadcrumb {
    font-size: 1.5rem;
}

.kotchi-primary, .breadcrumb-item.active {
    color: var(--kotchi_primary);
}

.kotchi-secondary{
    color: var(--kotchi_secondary);
}

.kotchi-tertiary {
    color: var(--kotchi_tertiary);
}

.kotchi-light-grey {
    color: var(--kotchi_light_grey);
}

.kotchi-bg-secondary {
    background-color: var(--kotchi_primary);
}

.kotchi-bg-tertiary {
    background-color: var(--kotchi_tertiary);
}

.nav-link:hover, .nav-link:focus, .kotchi-secondary-hover:hover{
    color: var(--kotchi_secondary);
}

.spacer {
    width: var(--spacer-width, 100%);
    height: var(--spacer-height, .0125rem);
    background-color: var(--spacer-color);
    margin: var(--spacer-margin);
}

.h-800{
    height: 800px;
}

.btn {
    --bs-btn-border-width: none
}

.modal {
    --bs-modal-border-width: none;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 992px) {
    .desktop-only {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;;
    }
}


/*************************
 Page display
**************************/

html {
    font-size: 16px;
    height: 100%;
}

body {
    overflow-y: unset;
    overflow-x: hidden;
    height: 100%;
    background-color: var(--kotchi_white) !important;
}

body > .container-fluid {
    display: grid;
    grid-template-areas: "menu main";
    grid-template-columns: 14rem 1fr;
    padding: 0;
    height: 100%;
}

body > .container-fluid > main {
    background-color: var(--kotchi_lightergrey);
    min-width: 0;
}

main > .content {
    padding-right: 3rem;
    padding-left: 3rem;
    margin-top: calc(var(--header-height) + 2rem);
    transition: margin-top 0.1s ease-out;
}

@media (max-width: 48rem) {
    main > .content {
        padding-right: 1rem;
        padding-left: 1rem;
    }
}

/***************
    MENU
****************/

#main-nav {
    grid-area: menu;
    height: var(--menu_height);
    z-index: 1000
}

body > .container-fluid > main {
    grid-area: main;
}

#main-nav > div {
    overflow-y: auto;
}

#main-nav,
#main-nav > div,
#main-nav > div > div {
    height: var(--menu_height);
}

#main-nav > div > div {
    height: 100%;
    padding-top: 3rem;
}

#main-nav ul.nav {
    display: grid;
    grid-template-areas: "search" "search-spacer" "dashboard" "paths" "calendar" "exchanges" "exchanges-spacer"
                         "resources" "notes" "notes-spacer" "space" "profile" "settings" "logo-spacer" "logo";
    grid-template-columns: auto;
    grid-template-rows: repeat(10, auto) 1fr repeat(4, auto);
    height: 100%;
}

#main-nav li.search { grid-area: search; }
#main-nav li.dashboard { grid-area: dashboard; }
#main-nav li.paths { grid-area: paths; }
#main-nav li.calendar { grid-area: calendar; }
#main-nav li.exchanges { grid-area: exchanges; }
#main-nav li.resources { grid-area: resources; }
#main-nav li.notes { grid-area: notes; }
#main-nav li.profile { grid-area: profile; }
#main-nav li.settings { grid-area: settings; }
#main-nav .spacer.search-spacer { grid-area: search-spacer; }
#main-nav .spacer.exchanges-spacer { grid-area: exchanges-spacer; }
#main-nav .spacer.notes-spacer { grid-area: notes-spacer; }
#main-nav .spacer.logo-spacer { grid-area: logo-spacer; }
#main-nav .container-fluid.logo { grid-area: logo; }

#main-nav {
    --bg-color: var(--kotchi_darkpurple);
    --text--color: var(--kotchi_light_grey);
    --text--bg-color: unset;
    --text--font-size: 0.813rem;
    --text--font-weight: 600;
    --transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
    --spacer-color: var(--kotchi_tertiary);
    --spacer-margin: .75rem 0;
    background-color: var(--bg-color);
}

#main-nav li.nav-item.active,
#main-nav li.nav-item:hover {
    --text--color: var(--kotchi_white);
    --text--bg-color: var(--kotchi_purple);
    fill: var(--text--color);
}

#main-nav li.nav-item::before ,
#main-nav li.nav-item::before {
    content: '';
    width: .5rem;
    display: block;
    background-color: var(--text--bg-color);
    height: 100%;
    position: absolute;
    left: -1rem;
    border-radius: 0 .5rem .5rem 0;
    transition: var(--transition);
}

#main-nav li.nav-item > a.nav-link {
    color: var(--text--color);
    background-color: var(--text--bg-color);
    font-size: var(--text--font-size);
    font-weight: var(--text--font-weight);
    padding: 1rem;
    border-radius: 0.375rem;
    transition: var(--transition);
}

#main-nav li.nav-item {
    width: calc(100% - .75rem - 1rem);
    margin: .125rem .75rem .125rem 1rem;
    position: relative;
}

#main-nav li.nav-item > a.nav-link svg,
#main-nav li.nav-item > a.nav-link svg * {
    transition: var(--transition);
}

#main-nav li.nav-item > a.nav-link > .menu-icon {
    display: inline-block;
    width: 1.25rem;
    text-align: center;
    margin-right: 0.5rem;
}

@media (min-width: 48.01rem) {
    #main-nav {
        max-height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
        width: 14rem;
    }
}
@media (max-width: 48rem) {
    :root {
        --menu_height: 6.5rem;
        --menu-width: calc(96px * 5);
    }

    body > .container-fluid > main {
        padding-bottom: calc(6.5rem * var(--menu-scale));
    }

    #main-nav {
        --bg-color: var(--kotchi_white);
        --border-color: var(--kotchi_lightgrey);
        --text--color: var(--kotchi_tertiary);
        width: 100vw;
        overflow: visible;
        transform: scale(var(--menu-scale));
        transform-origin: left bottom;
    }

    #main-nav::before {
        height: var(--menu_height);
        width: 200vw;
        content: "";
        background-color: var(--bg-color);
        position: absolute;
        bottom: 0;
    }

    #main-nav > div {
        --notch-height: 10px;
        --notch-width: 60px;
        position: relative;
        overflow: visible;
    }

    /* Bordure sur chaque li sauf paths */
    #main-nav ul li.nav-item:not(.paths) {
        border-top: 1px solid #EAECF0;
    }

    /* Encoche centrale */
    #main-nav ul li.paths {
        position: relative;
        overflow: visible;
    }

    #main-nav ul.nav {
        overflow: visible;
    }

    #main-nav ul li.paths::after {
        content: '';
        position: absolute;
        top: calc(-1 * var(--notch-height) + 1px);
        left: 0;
        width: 100%;
        height: var(--notch-height);
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 9' preserveAspectRatio='none' fill='none'%3E%3Cpath d='M0,9 H7 C11.268,9 13.314,7.336 17.006,5.196 C22.687,1.903 26.401,0 30,0 C33.599,0 37.313,1.903 42.994,5.196 C46.686,7.336 48.732,9 53,9 H60 V9 H0 Z' fill='%23ffffff'/%3E%3Cpath d='M0,9 H7 C11.268,9 13.314,7.336 17.006,5.196 C22.687,1.903 26.401,0 30,0 C33.599,0 37.313,1.903 42.994,5.196 C46.686,7.336 48.732,9 53,9 H60' fill='none' stroke='%23EAECF0' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") no-repeat;
        background-size: 100% 100%;
        z-index: 1000;
    }

    #main-nav li.nav-item {
        margin: 0;
        display: flex;
        align-items: center;
        width: 100%;
        flex-direction: column;
        justify-content: center;
    }

    #main-nav li.nav-item.active,
    #main-nav li.nav-item:hover {
        --text--color: var(--kotchi_purple);
        --text--bg-color: unset;
    }

    #main-nav li.nav-item.paths:hover a > div,
    #main-nav li.nav-item.paths.active a > div {
        background-color: var(--kotchi_purple);
    }

    #main-nav li.paths a > div {
        --bg-color: var(--kotchi_tertiary);
        --text--color: var(--kotchi_tertiary);
        --fill--color: var(--kotchi_white);
        background-color: var(--bg-color);
        border-radius: 50%;
        stroke-width: 1;
        background: var(--bg-color);
        height: 3.25rem;
        width: 3.25rem;
        padding: 0;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-content: center;
        flex-wrap: wrap;
        align-items: center;
    }

    #main-nav li.paths a > div svg {
        --text--color: var(--fill--color);
    }

    #main-nav li.paths.active {
        --text--color: var(--kotchi_pink);
        --bg-color: var(--kotchi_pink);
    }

    #main-nav li.paths.active a > div {
        --bg-color: var(--kotchi_pink);
        --text--color: var(--kotchi_pink);
    }

    #main-nav li.nav-item > a.nav-link {
        height: 100%;
        justify-content: center;
        padding: 1rem;
    }

    #main-nav li.nav-item a,
    #main-nav li.nav-item a {
        flex-direction: column;
        margin-top: -6px;
        z-index: 1001;
    }

    #main-nav li.nav-item.paths > a {
        padding-top: 0;
    }

    body > .container-fluid {
        grid-template-areas: "main" "menu";
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 6.25rem;
    }

    #main-nav li.nav-item::before ,
    #main-nav li.nav-item::before {
        content: unset;
    }

    #main-nav {
        position: fixed;
        bottom: 0;
    }


    #main-nav > div {
        overflow-y: visible;
    }

    #main-nav > div > div {
        padding-top: 0;
        overflow: visible;
    }

    #main-nav ul.nav {
        grid-template-areas: "dashboard calendar paths exchanges search";
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: auto;
    }

    #main-nav li:not(.show-mobile),
    #main-nav .spacer,
    #main-nav .logo {
        display: none;
    }

    #main-nav .nav-link svg {
        height: 1.5rem;
        width: 1.5rem;
    }

    #main-nav .nav-link svg {
        height: 1.5rem;
        width: 1.5rem;
    }
}

/**************
    HEADER
***************/

#kotchi-header {
    /* Margin: initial-margin * ratio (proportional to scroll) */
    padding: calc(var(--header-initial-margin) * var(--header-ratio)) 3.125rem;
    gap: 1rem;
    background: linear-gradient(89.6deg, rgb(255 231 232) 9.67%, rgb(252 251 255) 92.17%);;
    align-items: flex-end;
    min-height: var(--header-height);
    position: fixed;
    top: 0;
    left: 14rem;
    right: 0;
    z-index: 100;
    align-items: center;
    transition: min-height 0.1s ease-out, padding 0.1s ease-out;
}

#kotchi-header > .header_title {
    --text--font-size: 1.375rem;
    --text--font-weight: 600;
    font-size: var(--text--font-size);
    font-weight: var(--text--font-weight);
    flex-grow: 2;
    color: #3A416B;
    z-index: 1;
}

#kotchi-header > .header_actions {
    --text--font-size: 1rem;
    --text--font-weight: 600;
    font-size: var(--text--font-size);
    font-weight: var(--text--font-weight);
    flex-grow: 1;
    display: flex;
    flex-direction: row-reverse;
    z-index: 1;
}

#kotchi-header::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xmlns%3Asvgjs%3D%22http%3A%2F%2Fsvgjs.dev%2Fsvgjs%22%20viewBox%3D%220%200%20700%20700%22%20width%3D%22700%22%20height%3D%22700%22%20opacity%3D%220.77%22%3E%3Cdefs%3E%3Cfilter%20id%3D%22nnnoise-filter%22%20x%3D%22-20%25%22%20y%3D%22-20%25%22%20width%3D%22140%25%22%20height%3D%22140%25%22%20filterUnits%3D%22objectBoundingBox%22%20primitiveUnits%3D%22userSpaceOnUse%22%20color-interpolation-filters%3D%22linearRGB%22%3E%3CfeTurbulence%20type%3D%22fractalNoise%22%20baseFrequency%3D%220.05%22%20numOctaves%3D%224%22%20seed%3D%2215%22%20stitchTiles%3D%22stitch%22%20x%3D%220%25%22%20y%3D%220%25%22%20width%3D%22100%25%22%20height%3D%22100%25%22%20result%3D%22turbulence%22%3E%3C%2FfeTurbulence%3E%3CfeSpecularLighting%20surfaceScale%3D%2217%22%20specularConstant%3D%221.3%22%20specularExponent%3D%2220%22%20lighting-color%3D%22%23FF878C%22%20x%3D%220%25%22%20y%3D%220%25%22%20width%3D%22100%25%22%20height%3D%22100%25%22%20in%3D%22turbulence%22%20result%3D%22specularLighting%22%3E%3CfeDistantLight%20azimuth%3D%223%22%20elevation%3D%2291%22%3E%3C%2FfeDistantLight%3E%3C%2FfeSpecularLighting%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Crect%20width%3D%22700%22%20height%3D%22700%22%20fill%3D%22transparent%22%3E%3C%2Frect%3E%3Crect%20width%3D%22700%22%20height%3D%22700%22%20fill%3D%22%23ff878c%22%20filter%3D%22url(%23nnnoise-filter)%22%3E%3C%2Frect%3E%3C%2Fsvg%3E");
    background-size: 200px 200px;
    z-index: 0;
    opacity: .66;
}

@media (max-width: 48rem) {
    #kotchi-header {
        background: linear-gradient(180deg, rgb(255 207 209) -37.91%, rgb(249 247 254) 115.93%);
        padding: calc(calc(var(--header-initial-margin) * var(--header-ratio)) * 2)
                 1.125rem
                 calc(calc(var(--header-initial-margin) * var(--header-ratio)) * 1.17)
                 1.125rem;
        left: 0;
        width: 100vw;
    }

}

/*************************
    Path
***************************/

.add-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px dashed var(--kotchi_light_grey);
    background-color: transparent;
}

.add-card-text{
    color: var(--kotchi_light_grey);
}

.add-card:hover {
    border-color: var(--kotchi_secondary);
    color: var(--kotchi_secondary);
    transform: translateY(-2px);
    box-shadow: 0 1px 3px var(--kotchi_secondary);
}

.kotchi-hover:hover {
    border-color: var(--kotchi_secondary);
    color: var(--kotchi_secondary);
    transform: translateY(-2px);
}

.add-card-text:hover{
    color: var(--kotchi_secondary);
}

.capsule-container {
    max-width: 150px;
    justify-items: center;
    cursor: pointer;
}

.exercise-container {
    justify-items: center;
    cursor: pointer;
}

.capsule {
    font-size: 15px;
    width: 60px;
    height: 60px;
}

.exercise {
    font-size: 12px;
    width: 35px;
    height: 35px;
    justify-content: center;
}

/*************************
    Bootstrap overriding
***************************/

.dropdown-item.active, .dropdown-item:active {
    color: var(--sk_active);
    background-color: var(--sk_nav_hover);
}

.btn-primary, .btn-primary:hover, .btn:hover, .btn-primary:active, .btn:active {
    background-color: var(--kotchi_secondary);
    border-color: var(--kotchi_secondary);
    /*border-radius: var(--kotchi_btn_border_radius);*/
}

.btn-outline-primary, .btn-outline-primary:hover, .btn-outline-primary:active {
    border-color: var(--kotchi_secondary);
}

.btn-secondary {
    background-color: var(--kotchi_white);
}

.btn-secondary:hover, .btn-secondary:active {
    border-color: var(--kotchi_white);
    color: var(--kotchi_white);
    background-color: var(--kotchi_red);
}

.actionContainer {
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

#kotchi-header h3,
#kotchi-header .header_actions .actionContainer {
    /* Scale: 0.8 (min) to 1 (max) based on scroll */
    transform: scale(calc(var(--header-min-scale) + var(--header-normalized-ratio) * (1 - var(--header-min-scale))));
    transition: transform 0.1s ease-out;
}

#kotchi-header h3 {
    transform-origin: left;
}
#kotchi-header .header_actions .actionContainer {
    transform-origin: right;
}

.kotchi-purple-button {
    color: white;
    background-color: var(--kotchi_purple);
}
.kotchi-purple-button:hover,
.kotchi-purple-button:active {
    color: white;
    background-color: var(--kotchi_darkpurple);
}

.kotchi-red-button {
    color: white;
    background-color: var(--kotchi_red);
}
.kotchi-red-button:hover,
.kotchi-red-button:active {
    color: white;
    background-color: #c93858;
}

.kotchi-grey-button {
    color: var(--kotchi_primary);
    background-color: var(--kotchi_lightergrey);
    border: 1px solid var(--kotchi_lightgrey);
}
.kotchi-grey-button:hover,
.kotchi-grey-button:active {
    color: var(--kotchi_primary);
    background-color: var(--kotchi_lightgrey);
}

.reversed {
    transform: rotate(180deg);
}

/** Quick fix for demo **/
input#sk_username, input#sk_password {
    margin-top: 1rem;
}

/*TODO confirm if we can do that*/
.ck.ck-balloon-panel.ck-balloon-panel_position_border-side_right.ck-balloon-panel_visible.ck-powered-by-balloon {
    display: none; !important;
}

.notebook-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--kotchi_notebook_alert);
    border: solid 1px var(--kotchi_notebook_yellow_border);
    cursor: pointer;
    color: var(--kotchi_primary);
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    margin-left: 1rem;
}

.pop-in-right {
    float: inline-end;
    width: 440px;
    margin-right: 28px;
}

.pop-in-header-margin {
    border-bottom: solid 1px rgba(0, 0, 0, 0.1);
    padding-bottom: 1rem;
}
