/* CSS Variables */
:root {
    --text-color: #333333;
    --text-color-grey: #666666;
    --body-background: white;
    --button-background: #B11C36;
    --button-background-2: #EEE;
    --button-background-light: #D93A4B;
    --button-background-disabled: rgb(180, 180, 180);
    --button-text-color: white;
    --button-background-dark: linear-gradient(180deg,#373737 0%, #000000 50%);
    --dayCell-background: rgb(219, 219, 219);
    --input-background: #e6e6e6;
    --input-background-readonly: #b9b9b9;
    --input-suggest: #cacaca;
    --input-suggest-dark: #a7a6a6;
    --main-background: #ffffff;
    --main-background-dark: #ddd;
    --main-menu-background: #eaeaea;
    --notify-background: white;
    --form-background: #33333399;
    --light-text: white;
    --loader-background: linear-gradient(#eee, #ddd);
    --submit-button: #6dc280 ;
    --submit-button-darker: #4ccf69;
    --status-orange: #ffbf7f;
    --status-red: #ff99bf;
    --status-green: #b2fb8c;
    --status-purple: #ccbfff;
    --table-background: var(--body-background);
    --table-background-dark: #e6e6e6;
    --part-card-background: #0000001a;
    --header-background: #464646;
    --header-text-color: #f4f4f4;
    --menu-background: linear-gradient(145deg,#ffffff 0%, #ffffff 100%);
    --main-height: calc(100dvh - 9rem);
    --warning-color: #D93A4B;
    --footer-height: 3rem;
    --prefers-dark-mode: 0;
}

/* Dark mode */
:root.dark-mode {
    --text-color: #c8c3bc;
    --text-color-grey: #c8c3bc;
    --body-background: #181a1b;
    --button-background-dark: linear-gradient(180deg, #4d4c4c 0%, #333333 50%);
    --dayCell-background: rgb(86, 86, 86);
    --input-background: #2b2a33;
    --input-background-readonly: #404547;
    --input-suggest: #3f4447;
    --main-background: #181a1b;
    --main-background-dark: #333638;
    --main-menu-background: #242728;
    --notify-background: #26292b;
    --loader-background: linear-gradient(var(--body-background), var(--body-background));
    --status-orange: #924900;
    --status-red: #921100;
    --status-green: #004949;
    --status-purple: #491a92;
    --header-background: #35393b;
    --table-background-dark: #26292b;
    --part-card-background: #ffffff1a;
    --header-text-color: #e1dedb;
    --menu-background: linear-gradient(145deg,#181a1b 0%, #181a1b 100%);
    --prefers-dark-mode: 1;
}

/* DARKMODE TOGGLE */
#theme-toggle {
    width: 4rem;
    height: 2rem;
    border-radius: 20px;
    background-color: #ddd;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
    align-self: center;
}


/* Toggle Circle */
#theme-toggle-circle {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background-color: #333;
    position: absolute;
    top: .25rem;
    left: 0.25rem;
    transition: left 0.3s, background-color 0.3s;
}


/* Dark Mode Styles */
:root.dark-mode #theme-toggle {
    background-color: var(--body-background);
}


:root.dark-mode #theme-toggle #theme-toggle-circle {
    left: 2.25rem;
    background-color: #fff;
}

/* FONT FACES */
@font-face {
    font-family: NT_Black;
    src: url(/fonts/NeoTech-Black.woff2);
}
@font-face {
    font-family: NT_BlackItalic;
    src: url(/fonts/NeoTech-BlackItalic.woff2);
}

@font-face {
    font-family: NT_Light;
    src: url(/fonts/NeoTech-Light.woff2);
}
@font-face {
    font-family: NT_LightItalic;
    src: url(/fonts/NeoTech-LightItalic.woff2);
}

@font-face {
    font-family: NT_LightMedium;
    src: url(/fonts/NeoTech-LightMedium.woff2);
}
@font-face {
    font-family: NT_LightMediumItalic;
    src: url(/fonts/NeoTech-LightMediumItalic.woff2);
}

@font-face {
    font-family: NT_Medium;
    src: url(/fonts/NeoTech-Medium.woff2);
}
@font-face {
    font-family: NT_MediumItalic;
    src: url(/fonts/NeoTech-MediumItalic.woff2);
}

@font-face {
    font-family: NT_Std;
    src: url(/fonts/NeoTech-Std.woff2);
}
@font-face {
    font-family: NT_StdItalic;
    src: url(/fonts/NeoTech-StdItalic.woff2);
}

input[type = "button"], button {
    color: var(--text-color);
}

/* GLOBAL STYLES */
* {
    padding: 0;
    margin: 0;
    font-family: NT_Std, sans-serif;
    transition: background-color .2s ease-in-out, color .2s ease-in-out, background .2s ease-in-out;
}

html {
  overscroll-behavior: none;
}

html, body {
    padding-top: env(safe-area-inset-top);
}

body {
    background: white;
    color: var(--text-color);
    min-height: 100dvh;
}

main {
    height: var(--main-height);
    overflow-y: auto;
    background: var(--main-background);
}

a, a:visited {
    text-decoration: none;
    color: var(--text-color);
}

div.infobox {
    color: var(--input-suggest-dark);
    padding: .5rem;
    border: .15rem dashed var(--input-suggest-dark);
    width: fit-content;
    margin: 1rem 0;
}

div.infobox::before {
    content: "Info:";
    text-decoration: .1rem underline dotted;
}

div.infobox h3 {
    margin-top: .2rem;
    font-size: 1rem;
    font-weight: normal;
    text-decoration: underline dashed;
}

div.infobox p {
    margin-top: .1rem;
}

input, textarea, select {
    background-color: var(--input-background);
    color: var(--text-color);
    border: none;
}

/* HEADER */
header{
    width: 100%;
    text-align: center;
    margin-top: 0;
    height: 6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-background);
    z-index: 10;
    position: relative;
}

header h1 {
    font-family: NT_Black, sans-serif;
    color: var(--header-text-color);
}

header .logo {
    max-height: 5rem;
    width: 16rem;
    object-fit: scale-down;
    padding: 0 .5rem;
    text-align: right;
}

header .logo img {
    max-height: 5rem;
    object-fit: scale-down;
}

/* FOOTER */
#mobileBackBtn {
    display: none;
}

footer {
    background-color: var(--header-background);
    width: 100%;
    text-align: right;
    height: var(--footer-height);
    display: flex;
    justify-content: end;
    align-items: center;
    z-index: 9;
    position: fixed;
    bottom: 0;
}

#menu {
    margin-right: .5rem;
    display: flex;
    gap: .5rem;
}

.menuButton, .menuButton:visited {
    cursor: pointer;
    background: var(--button-background);
    padding: .5rem;
    border: none;
    border-radius: .25rem;
    font-size: 1rem;
    color: var(--button-text-color);
    -webkit-user-select: none;
    user-select: none;
    transition: all 0.1s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
}

.menuButton:hover, .menuButton:visited:hover {
    background: var(--button-background-light);
}

#chooseMenu {
    position: fixed;
    bottom: .3rem;
    left: .5rem;
    z-index: 10;
    display: flex;
    flex-direction: row;
    gap: .5rem;
}

.required::after {
    content: "*";
    color: rgb(255, 139, 139);
    display: inline-block;
}
.requiredDisclaimer {
    color: rgb(255, 139, 139);
    font-size: 0.8rem;
    margin: 0.5rem 0;
    transform: skewX(-15deg);
}

/* skewing */
.skewContainer {
    background-color: var(--main-background);
    width: fit-content;
    overflow: hidden;
    transform: skewX(20deg);
}

.skewContent {
    transform: skewX(-20deg);
}

.skewContainer:hover #requestNotification {
  filter: invert(0);
  background-color: var(--button-background-light);
}

/* hidden Elements */
.hidden {
    display: none !important;
}

/* clickable -> hover pointer */
.clickable:hover {
    cursor: pointer;
}

/* Image & 3D-Model UPLOAD */
#imageLabel, #modelLabel {
  display: inline-flex; /* verhindert Baseline-Schrägheiten */
  flex-direction: column; /* Textzeile + Dateiname untereinander */
  gap: .25rem;
  background: var(--input-background);
  padding: .5rem;
  border: 1px solid var(--input-suggest);
  border-radius: .5rem;
  position: relative;
  max-width: 200px;
}

#imageUploadContainer, #modelUploadContainer {
  display: flex;
  align-items: center;
  gap: .5rem;
  line-height: 1; /* iOS: verhindert Baseline-Versatz */
  width: 100%;
}

#imageUploadContainer img, #modelUploadContainer img {
  width: 1.25rem;
  height: 1.25rem; /* statt fit-content (iOS mag das hier nicht) */
  filter: invert(calc(var(--prefers-dark-mode) * 1));
}

.uploadText, .modelUploadText {
  color: var(--input-suggest-dark);
  white-space: nowrap;
}

/* Dateiname */
#imageName, #modelName {
  color: var(--input-suggest-dark);
  overflow-wrap: anywhere;
  margin: 0;
}

/* Das unsichtbare Input exakt auf das Label legen – nur dort klickbar */
.imageInput, .modelInput {
  position: absolute;
  inset: 0; /* top/right/bottom/left: 0 */
  opacity: 0;
  cursor: pointer;
  appearance: none; /* iOS: verhindert seltsames Hit-Box-Verhalten */
  -webkit-appearance: none; /* iOS: verhindert seltsames Hit-Box-Verhalten */
}


/* Loader */
.loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--body-background);
    z-index: 9;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    min-height: var(--main-height);
}

.loader.light {
    background: rgba(255, 255, 255, 0.8);
    background: var(--body-background);
    background: var(--loader-background);
}

.loadingSnake {
    width: 5rem;
    height: 5rem;
    background-image: url('/images/icons/loadingSnake.svg');
    background-size: contain;
    animation: rotate 1s linear infinite;
    filter: invert(1);
    overflow: visible;
}

.loadingSnake.light {
    filter: invert(0.45);
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* TABELLEN FILTER */
.filter {
    position: sticky;
    top: 0;
    background: var(--main-background);
    z-index: 7;
    min-width: calc(100svw - 15px);
    width: 100%;
}

#filtersCollapsible, #logFiltersCollapsible {
    max-height: 0px;
    opacity: 0;
    overflow: hidden;
    transition: all .2s ease-out;
}

#filtersCollapsible input, #filtersCollapsible select, #logFiltersCollapsible input, #logFiltersCollapsible select {
    width: fit-content;
    /* margin: 0 .5rem; */
    padding: .3rem .6rem;
    border: 1px solid grey;
    border-radius: .25rem;
    min-width: 8rem;
    margin-top: .25rem;
}

#filtersCollapsible input[type="checkbox"] {
  min-width: 0; /* Checkboxen sollen nicht breitgezogen werden */
}

#filters {
    padding: .5rem;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

#filtersHeader, #logFiltersHeader {
    cursor: pointer;
    color: var(--input-suggest-dark);
    font-size: 1.2rem;
    padding: .5rem;
    transition: all .2s ease-in-out;
}

#filtersHeader::before, #logFiltersHeader::before {
    display: inline-block;
    content: "";
    margin-right: 0.5rem;
    transition: all .2s ease-in-out;
    height: 1rem;
    width: 2rem;
    background: url(/images/icons/point-right.svg);
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

#filtersHeader:hover::before, #logFiltersHeader:hover::before {
    transform: rotate(30deg);
    filter: brightness(calc(var(--prefers-dark-mode) * 1));
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

#filtersHeader:hover, #logFiltersHeader:hover {
    color: var(--text-color);
}

#filtersHeader.active, #logFiltersHeader.active {
    color: var(--text-color);
}

#filtersHeader.active::before, #logFiltersHeader.active::before {
    transform: rotate(90deg);
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    filter: brightness(calc(var(--prefers-dark-mode) * 1));
}

.filterElement {
  display: flex;
  flex-direction: column;
  margin: 0 .5rem;
}


/* Sticky Elements */
.stickyTop {
    position: sticky;
    top: 0;
}

/* Notification  (Notify.js) */
#notifications {
    z-index: 11;
    position: fixed;
    right: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 30rem;
}

.notification {
    transition: all ease .5s;
    border-radius: 1.25rem;
    margin: .5rem;
    width: fit-content;
    max-width: 100%;
    -webkit-box-shadow: 0 0 1rem 0 rgba(0,0,0,0.6); 
    box-shadow: 0 0 1rem 0 rgba(0,0,0,0.6); 
    word-wrap: break-word;
}

.notification .message {
    margin: .25rem;
    padding: 1rem;
    background-color: var(--notify-background);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.notification.error {
    background: radial-gradient(circle,#e25151 0%, rgba(184, 53, 53, 1) 100%);
    color: black;
}

.notification.warning {
    background: radial-gradient(circle,#ffc14d 0%, rgb(255, 166, 0) 100%);
    color: black;
}

.notification.success {
    background: radial-gradient(circle,#44e361 0%, rgb(48, 209, 94) 100%);
    color: black;
}

.notification.info {
    background: radial-gradient(circle,#ffffff87 0%, #c2c2c2a6 100%);
    backdrop-filter: blur(.25rem);
    color: black;
}

.notifImage {
    margin-right: .5rem;
    height: 2.25rem;
}

/* Date Picker -> datePicker.js */
.datePicker {
    position: absolute;
    top:0;
    background-color: var(--main-background);
    border: 1px solid var(--input-suggest);
    box-shadow: 0 0 1rem 0 rgba(0,0,0,0.2);
    border-radius: .5rem;
    padding: .5rem;
    z-index: 10;
}

.calendarGrid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: .25rem;
}

.calendarGrid * {
    -webkit-user-select: none;
    user-select: none;
    width: 2rem;
    height: 2rem;
    border-radius: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dayCell {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    width: 2rem;
    height: 2rem;
    background: var(--dayCell-background);
    border-radius: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    justify-self: center;
    margin: .15rem 0;
}

.dayCell:hover {
    background: var(--button-background-light);
    color: var(--button-text-color);
}

.dayCell.activeDay {
    background: var(--button-background);
    color: var(--button-text-color);
}

.datePickerResetButton {
  padding: .25rem;
  background: var(--input-background);
  border: none;
  border-radius: .25rem;
  margin-top: .5rem;
}

.datePickerResetButton:hover {
  background: var(--input-background-readonly);
  cursor: pointer;
}

/* Shopping Cart */
#shoppingCartButton {
    position: absolute;
    top: 0;
    left: 0;
    height: 3rem;
    width: 3rem;
    border-radius: 1rem;
    margin: .5rem;
    padding: .5rem;
    background: var(--button-background);
    border: none;
    z-index: 9;
    display: flex;
    justify-content: center;
    align-items: center;
}

#shoppingCartButton img {
    filter: invert(1);
    height: 80%;
}

/* Animations */
.slideIn {
    animation: slideIn 0.2s ease-out forwards;
}
.slideOut {
    animation: slideOut 0.2s ease-out forwards;
}
.slideInRight {
    animation: slideInRight 0.2s ease-out forwards;
}
.slideOutRight {
    animation: slideOutRight 0.2s ease-out forwards;
}
.fadeIn {
    animation: fadeIn 0.2s ease-out forwards;
}
.fadeOut {
    animation: fadeOut 0.2s ease-out forwards;
}
.inputWarning {
    animation: inputWarning 1s 5 ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateY(2rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(2rem);
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(2rem);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(2rem);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes inputWarning {
    0% {
        border: 1px solid var(--input-suggest);
    }
    50% {
        border: 1px solid var(--warning-color);
    }
    100% {
        border: 1px solid var(--input-suggest);
    }
}

/* Mobile */
@media screen and (max-width: 768px) {
    header .logo, header .logo img {
        width: 5rem;
    }
    
    header .logo:nth-child(1) {
        display: none;
    }

    header h1 {
        padding: .4rem;
        font-size: 1.5rem;
    }
    
    .menuButton {
        font-size: 1.5rem;
        margin: 0;
    }

    #backButton {
        display: none;
    }
    #footer {
        justify-content: space-between;
    }
    #menu {
        display: none;
    }

    #menu.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        gap: .25rem;
        bottom: var(--footer-height);
        box-shadow: #00000069 0px 0px 10px;
        margin: 0;
        padding: .5rem;
        background: var(--header-background);
        right: 0;
    }
    #mobileBackBtn {
        display: block;
    }
    #chooseMenu {
        display: none;
    }

    #mobileMenuButton {
        background-color: var(--button-background);
        width: var(--footer-height);
        height: var(--footer-height);
        display: flex;
        justify-content: center;
        align-items: center;
        color: var(--button-text-color);
        font-size: calc(var(--footer-height) - 1rem);
    }
    .filter {
        max-height: var(--main-height);
    }
    #filters {
        flex-direction: column;
        width: fit-content;
    }
    .filterElement {
        width: fit-content;
    }
    #filtersCollapsible input, #filtersCollapsible select, #logFiltersCollapsible input, #logFiltersCollapsible select {
        margin: .75rem 0;
    }
    #notifications {
        max-width: 75dvw;
    }

    .skewContainer {
        overflow: visible;
    }

    #theme-toggle {
        align-self: center;
    }
}
