/*
    TailwindCSS JIT-Mode Input file.
    Use TailwindCSS functions and directives here – https://tailwindcss.com/docs/functions-and-directives
    About JIT-Mode: https://tailwindcss.com/docs/just-in-time-mode#styles-rebuild-in-an-infinite-loop

    TailwindCSS CLI generates the css/index-tailwind-output.css file based on this file.
    It is not used directly in the app.
*/

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
    /*
      * The main colour scheme of mapcomplete is configured here.
      * For a custom styling, set 'customCss' in your layoutConfig and overwrite some of these.
      */

    /* No support for dark mode yet, we disable it to prevent some elements to suddenly toggle */
    color-scheme: only light;

    /* Main color of the application: the background and text colours */
    --background-color: white;
    /* Main text colour. Also styles some elements, such as the 'close popup'-button or 'back-arrow' (in mobile) */
    --foreground-color: black;

    /* A colour scheme to indicate an error or warning */
    --alert-color: #fee4d1;
    --alert-foreground-color: var(--foreground-color);

    --low-interaction-background: #eeeeee;
    --low-interaction-background-50: #eeeeee90;
    --low-interaction-foreground: black;
    --low-interaction-contrast: #ff00ff;
    --low-interaction-border: #dcdcdc;

    --interactive-background: #dddddd;
    --interactive-foreground: black;
    --interactive-contrast: #ff00ff;
    --interaction-border: #bfbfbf;


    --button-background: #282828;
    --button-background-hover: #484848;
    --button-primary-background-hover: #353535;

    --button-foreground: white;
    --button-border-color: #F7F7F7;
    --disabled: #B8B8B8;
    --disabled-font: #B8B8B8;

    --catch-detail-color: black; /*#3a3aeb;*/
    --catch-detail-foregroundcolor: white;
    --catch-detail-color-contrast: #fb3afb;

    --image-carousel-height: 350px;

    /** Technical value, used by icon.svelte
       */
    --svg-color: #000000;
}

@font-face {
    font-family: "Source Sans Pro";
    /*This path might seem incorrect. However, 'index.css' will be compiled and placed in 'public/css', from where this path _is_ correct*/
    src: url("../assets/fonts/source-sans-pro.regular.ttf") format("woff");
}

/***********************************************************************\
* Various tweaks and settings to make some behaviours more predictable *
\***********************************************************************/
html,
body {
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--foreground-color);

    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 400;
    font-size: 16px;
    line-height: 150%;
}

svg,
img {
    box-sizing: content-box;
    width: 100%;
    height: 100%;
}

li {
    margin-left: 0.5em;
    padding-left: 0.2em;
    margin-top: 0.1em;
}

li::marker {
    content: "•";
}

h1 {
    font-size: xx-large;
    margin-top: 0.6em;
    margin-bottom: 0.4em;
    font-weight: bold;
}

h2 {
    font-size: x-large;
    margin-top: 0.5em;
    margin-bottom: 0; /*Disable margin bottom to play nicely with accordeons from flowbite*/
    font-weight: bold;
}

h3 {
    font-size: larger;
    margin-top: 0.6em;
    margin-bottom: 0;
    font-weight: bold;
}

p {
    padding-top: 0.1em;
}

input {
    color: var(--foreground-color);
}

input[type="text"] {
    width: 100%;
}

/************************* BIG CATEGORIES ********************************/

/**
 * The main classes that dictate the structure of the entire app,
 * and some interactive elements
 */


.normal-background {
    background: var(--background-color);
    color: var(--foreground-color);
}

.low-interaction {
    background: var(--low-interaction-background);
    color: var(--low-interaction-foreground);
}

.interactive {
    background: var(--interactive-background);
    color: var(--interactive-foreground);
}

.border-interactive {
    border: 2px dashed var(--catch-detail-color-contrast);
    border-radius: 0.5rem;
}

.border-low-interaction {
    border-color: var(--interaction-border);
    border-style: dashed;
}

.border-region {
    border: 2px dashed var(--interactive-background);
    border-radius: 0.5rem;
}

.box-shadow {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/******************* Styling of input elements **********************/

/**
 * This very important section defines what the various input elements look like within the 'low-interaction' and 'interactive'-blocks
 */

/********* BUTTONS ***********/

button, .button {
    box-sizing: border-box;

    /* Auto layout */
    display: flex;
    column-gap: 0.25rem;
    justify-content: center;
    align-items: center;
    padding: 0.25rem 1rem;
    margin: 0.25rem;

    background: var(--background-color);
    border: 1px solid var(--button-background-hover);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border-radius: 15px;

    background: var(--background-color);
    transition: all 200ms;

}


.group > button {
    padding-right: 1rem !important; /*Flowbite workaround */
}

button.w-full {
    margin-left: 0;
}

button:hover:not(.disabled):not(.as-link), .button:hover:not(.disabled):not(.as-link) {
    background-color: var(--low-interaction-background);
}


button:focus, .button:focus {
    border-color: var(--interactive-contrast);
}

.focus {
    border: 2px solid var(--interactive-contrast);
}

button.primary, .button.primary {
    color: var(--button-foreground);
    background-color: var(--button-background);
    border-color: var(--button-border-color);
}

button.primary:hover:not(.disabled), .button.primary:hover:not(.disabled) {
    background-color: var(--button-primary-background-hover);
}

button.disabled {
    border-color: var(--disabled-font);
    color: var(--disabled-font);
    cursor: unset;
}

button.disabled svg path {
    transition: all 200ms;
}

button.disabled svg path {
    fill: var(--disabled-font);
    stroke: var(--disabled-font);
}


button.primary.disabled, .button.primary.disabled {
    color: var(--button-foreground);
    background-color: var(--disabled);
}


.low-interaction button:hover:not(.disabled):not(.as-link), .low-interaction .button:hover:not(.disabled):not(.as-link) {
    box-sizing: border-box;
    background-color: var(--interactive-background);
}

button.as-link {
    background-color: unset;
    display: inline-flex;
    justify-content: start;
    border: none;
    border-radius: 0;
    text-decoration: underline;
    -webkite-text-decoration: underline;
    box-shadow: none;
    margin: 0;
    padding: 0;
}

button.unstyled, .button-unstyled button {
    background-color: unset;
    display: inline-flex;
    justify-content: start;
    border: none;
    box-shadow: none !important;
    margin: 0;
    padding: 0;
}

/******* Other input elements ******/

.hover-alert:hover {
    color: var(--catch-detail-color-contrast)
}

.links-w-full a:not(.weblate-link), .links-w-full button.as-link {
    display: flex;
    column-gap: 0.25rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    width: 100%;
}

select {
    border: 2px solid var(--low-interaction-border);
    color: var(--foreground-color) !important;
    background-color: var(--low-interaction-background) !important;
}

.low-interaction select {
    border: 2px solid var(--interaction-border);
    color: var(--foreground-color) !important;
    background-color: var(--interactive-background) !important;
}

select:hover {
    border-color: var(--catch-detail-color-contrast);
}

.neutral-label {
    /** This label styles as normal text. It's power comes from the many :not(.neutral-label) entries.
       * Placed here for autocompletion
       */
}

label:not(.neutral-label):not(.button) {
    /**
       * Label should _contain_ the input element
       */
    padding: 0.25rem;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
    margin: 0.25rem;
    border-radius: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    transition: all 250ms;
}

label.button {
    width: 100%;
}

label:hover:not(.neutral-label) {
    background-color: var(--low-interaction-background);
}


label.checked:not(.neutral-label) {
    color: var(--foreground-color);
    background-color: var(--low-interaction-background);
}

textarea {
    color: black;
}

h2.group {
    /* For flowbite accordions */
    margin: 0;
    top: 0;
    position: sticky;
    z-index: 12;
}

.group button {
    /* For flowbite accordions */

    border-radius: 0;
}

/************************* OTHER CATEGORIES ********************************/

/**
 * Smaller categories which convey some semantic information but don't define bigger blocks.
 * As they are _semantic_ categories, they can be styled
 */

.thanks {
    /* The class to indicate 'operation successful' or 'thank you for contributing' */
    font-weight: bold;
    border-radius: 1em;
    margin: 0.25em;
    text-align: center;
    padding: 0.25rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border: 3px dotted #58cd27;
    background-color: #58cd2722;
}

.alert {
    /* The class to convey important information, e.g. 'invalid', 'something went wrong', 'warning: testmode', ... */
    background-color: var(--alert-color);
    color: var(--alert-foreground-color);
    font-weight: bold;
    border-radius: 1em;
    margin: 0.25em;
    text-align: center;
    padding: 0.15em 0.7em;
    border: 2px dotted #ff9143;
}

.warning {
    /* The class to convey important information, but not as grave as 'alert' */
    background-color: var(--low-interaction-background);
    color: var(--alert-foreground-color);
    font-weight: bold;
    border-radius: 1em;
    margin: 0.25em;
    text-align: center;
    padding: 0.15em 0.3em;
    border: 3px dotted #ff9143;
}

.low-interaction .warning {
    background-color: var(--interactive-background);
}

.information {
    /* The class to convey important information which does _not_ denote an error... */
    background-color: var(--low-interaction-background);
    color: var(--alert-foreground-color);
    border-radius: 1em;
    margin: 0.25em;
    text-align: center;
    padding: 0.15em 0.3em;
    border: 3px dotted var(--catch-detail-color-contrast);
}

.low-interaction .interactive {
    background-color: var(--interactive-background);
}

.subtle {
    /* For all information that is not important for 99% of the users */
    color: #666;
    font-weight: normal;
}

.low-interaction .subtle {
    color: #444;
}

.interactive .subtle {
    color: #333;
}

.link-underline .subtle a {
    text-decoration: underline 1px #7193bb88;
    -webkit-text-decoration: underline;
    color: #7193bb;
}

.literal-code,
code {
    /* A codeblock */
    display: inline-block;
    background-color: lightgray;
    padding: 0.1rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    word-break: break-word;
    color: black;
    box-sizing: border-box;
    font-family: monospace;
}

.interactive .literal-code {
    background-color: #b3b3b3;
}

.frozen-glass {
    backdrop-filter: blur(1px);
    background: rgba(100, 100, 100, 0.50);
}

/************************** UTILITY ************************/

/** 
 * Utility classes are there for a specific function to pin down browser behaviour (and cannot be changed)
 */

.text-white a {
    /* Used solely in 'imageAttribution'  and in many themes*/
    color: var(--background-color);
}

.h-full-child > div {
    height: 100%;
}

.bg-black-transparent {
    background-color: #00000088;
}

.bg-black-light-transparent {
    background-color: #00000044;
}

.block-ruby {
    display: block ruby;
}

.rounded-left-full {
    border-bottom-left-radius: 999rem;
    border-top-left-radius: 999rem;
}

.rounded-right-full {
    border-bottom-right-radius: 999rem;
    border-top-right-radius: 999rem;
}

.no-images img {
    /* Used solely in 'imageAttribution' and in many themes for the label*/
    display: none;
}

.weblate-link {
    display: inline-block;
    flex-shrink: 0;
    margin: 0;
    padding: 0.25rem;
    width: 1.2rem;
    height: 1.2rem;
    border: unset;
    border-radius: 5rem;
    backdrop-filter: var(--low-interaction-background);
}

.no-weblate .weblate-link {
    display: none !important;
}

.link-underline a {
    text-decoration: underline 1px var(--foreground-color);
    -webkit-text-decoration: underline;

}

a.link-underline {
    text-decoration: underline 1px var(--foreground-color);
    -webkit-text-decoration: underline;
}

.link-no-underline a, a.link-no-underline {
    text-decoration: none;
}

.disable-links a {
    pointer-events: none;
    text-decoration: none !important;
    color: var(--foreground-color) !important;
}

.enable-links a {
    pointer-events: unset;
    text-decoration: underline !important;
    -webkit-text-decoration: underline !important;
    color: unset !important;

}

a:hover {
    background-color: var(--low-interaction-background);
}


.disable-links a.must-link,
.disable-links .must-link a {
    /* Hide links if they are disabled */
    display: none;
}

.zebra-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.no-bold b {
    font-weight: normal;
}

/************************* MISC ELEMENTS *************************/

.selected svg:not(.noselect *) path.selectable {
    /* A marker on the map gets the 'selected' class when it's properties are displayed
      */
    stroke: white !important;
    stroke-width: 20px !important;
    overflow: visible !important;
    -webkit-animation: glowing-drop-shadow 1s ease-in-out infinite alternate;
    -moz-animation: glowing-drop-shadow 1s ease-in-out infinite alternate;
    animation: glowing-drop-shadow 1s ease-in-out infinite alternate;
}

.selected .light-icon svg:not(.noselect *) path.selectable {
    stroke: #4a4a4a !important;
    stroke-width: 10px !important;
}

.selected svg {
    /* A marker on the map gets the 'selected' class when it's properties are displayed
      */
    overflow: visible !important;
}

svg.apply-fill path {
    fill: var(--svg-color);
}

.compass_arrow {
    width: calc(2.5rem - 1px);
    height: calc(2.5rem - 1px);
}

@media (min-width: 640px) {
    .compass_arrow {
        width: calc(2.75rem - 1px);
        height: calc(2.75rem - 1px);
    }
}

@-webkit-keyframes glowing-drop-shadow {
    from {
        filter: drop-shadow(5px 5px 60px rgb(128 128 128 / 0.6));
    }
    to {
        filter: drop-shadow(5px 5px 80px rgb(0.5 0.5 0.5 / 0.8));
    }
}

@keyframes slide {
    /* This is the animation on the marker to add a new point - it slides through all the possible presets */
    from {
        transform: translateX(0%);
    }

    to {
        transform: translateX(calc(-100% + 42px));
    }
}


.badge {
    /* Used in the search results for layers */
    display: flex;
    align-items: center;
    white-space: nowrap;
    border-radius: 999rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    border: 1px solid var(--low-interaction-border);
    background-color: var(--low-interaction-background);
}

/************************* LEGACY MARKER - CLEANUP BELOW ********************************/


.animate-height {
    /* Legacy: should be replaced by headlessui disclosure in time */
    transition: max-height 0.5s ease-in-out;
    overflow-y: hidden;
}

.min-h-32 {
    min-height: 8rem;
}

.max-w-full {
    max-width: 100%;
}

.max-h-leave-room {
    /* Leaves room for a single button, with padding */
    max-height: calc(100% - 3.25rem);
}

.max-w-screen {
    max-width: 100vw;
}

.z-4 {
    z-index: 4;
}

.z-3 {
    z-index: 3;
}

.z-5 {
    z-index: 5;
}
/************************* Experimental support for foldable devices ********************************/
@media (horizontal-viewport-segments: 2) {
    .theme-list {
        display: grid;
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
