/* ===========================
   Geist Variable – normal
   =========================== */

   @font-face {
    font-family: "Geist";
    src: url("../fonts/Geist[wght].ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
}

@font-face {
    font-family: "Geist";
    src: url("../fonts/Geist-Italic[wght].ttf") format("truetype");
    font-weight: 100 900;
    font-style: italic;
}

/* ===========================
   Farb-Variablen
   =========================== */

:root {
    --color-bg: #e8e8e8;
    --color-bg-lighter: #ededed;
    --color-surface: #e0e0e0;
    --color-surface-hover: #e8e8e8;
    --color-text: #000000;
    --color-muted: #585858;
    --color-border: #cccccc;
    --color-active-bg: #d2d2d2;
    --color-active-text: #000000;
    --color-accent: blueviolet;
    --color-alert: rgb(255, 0, 68);
    --color-alert-shade: rgba(255, 0, 68, .1);
    --color-accent-shade: rgba(138, 43, 226, .05);
    --color-shadow: rgba(179, 179, 179, 0.5);
}

/* Darkmode über System-Einstellung */

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #101114;
        --color-bg-lighter: #0f0f12;
        --color-surface: #24262b;
        --color-surface-hover: #272833;
        --color-text: #f1f1f1;
        --color-muted: #b2b2c3;
        --color-border: #323232;
        --color-active-bg: #323342;
        --color-active-text: #ffffff;
        --color-shadow: rgba(7, 7, 7, 0.8);
    }
}

/* Allgemein */

*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

html, body{
    background-color: var(--color-bg);
    font-family: "Geist", sans-serif;
    font-size: 0.9rem;
    color: var(--color-text) !important;
}

body{
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    grid-auto-flow: column;
    padding: 1rem;
    font-family: "Geist", system-ui, sans-serif;
    font-weight: 400;
    overflow: hidden;
    height: 100svh;
}

main{
    width: 100%;
}

/* Schriften */

a{
    text-decoration: none;
    color: inherit;
    cursor: default;
}

h1{
    font-size: 1.5rem;
}

nav h1{
    font-size: 1.5rem;
}

/* Allgemeine Elemente */

nav{
    background-color: var(--color-surface);
    height: calc(100svh - 2rem);
    border-radius: 12px;
    width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: .5rem;
    overflow: hidden;
}

.applogo{
    display: flex;
    justify-content: left;
    padding: 1rem;
}

.main-menu{
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* UI Komponenten */


button{
    background: none;
    font-family: inherit;
    font-size: inherit;
    border: none;
}

.nav-button{
    padding: .5rem 1rem;
    border-radius: 6px;
    transition: all ease-in-out 120ms;
    color: var(--color-muted);
}

.nav-button:hover{
    color: var(--color-text);
    background-color: var(--color-surface-hover);
}

.ui-button{
    padding: .5rem 1rem;
    border-radius: 6px;
    transition: all ease-in-out 120ms;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
}

.ui-button:hover{
    color: var(--color-text);
    background-color: var(--color-surface);
}

.button-switch{
    border: 1px solid var(--color-border);
}

.button-action{
    color: var(--color-text);
}

.button-action:hover{
    color: var(--color-accent);
}

.nav-button.is-active, .button-switch.is-active {
    background: var(--color-active-bg);
    color: var(--color-active-text);
    font-weight: 600;
}


.form-create{
    width: 100%;
    max-width: 640px;

}

.form-create input{
    width: 100%;
}

.user-menu{
    display: flex;
    height: 100%;
    justify-content: end;
    flex-direction: column;
}

.card-container{
    gap: .5rem;
}

.address-card-container{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.project-card-container{
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.card{
    padding: 1rem;
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: all ease-in-out 120ms;
    color: var(--color-text);
    background-color: var(--color-bg-lighter);
}

.address-card{
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.address-card-title-wrapper{
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.address-card .title{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.address-code{
    white-space: nowrap;
    display: block;
    margin-left: 1rem;
}

.project-card{
    display: grid;
    grid-template-columns: 80px 160px 1fr 60px 120px;
    grid-auto-flow: column;
    gap: 2rem;
    width: 100%;
    border: none;
    border: 1px solid var(--color-border);
}

.project-card .project-number{
    font-weight: 600;
}

.project-card .title{
    font-weight: 600;
}

.project-card .delivery-date{
    align-self: center;
}

.project-card .status{
    font-size: .8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 4px;
    background-color: var(--color-surface);
    height: max-content;
    padding: .5rem 1rem;
    align-self: center;
}

.project-card-header{
    width: 100%;
    font-size: .75rem;
    padding: 1rem;
    color: var(--color-muted);
}


.card:hover{
    background-color: var(--color-surface);
}

/* Seiteneinstellungen */

.page{
    position: relative;
    background-color: var(--color-bg);
    overflow-y: scroll;
    height: calc(100svh - 2rem);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0 1.5rem;
    padding-bottom: 1.5rem;
    scrollbar-width: none;/* Firefox */
}

.page::-webkit-scrollbar {
    display: none;/* Chrome, Safari */
}

.page-header{
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1.5rem 0;
    background-color: var(--color-bg);
    width: 100%;
}

.page-header .button-wrapper{
    display: flex;
    gap: .5rem;
}

.page-headline{
    display: flex;
    justify-content: space-between;
}

.page-headline-title{
    display: flex;
    flex-direction: row;
    gap: 2rem;
}

.page-header-details{

}

#project-details{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border: 1px solid var(--color-border);
    padding: 1rem;
    border-radius: 6px;
    background-color: var(--color-surface);
    gap: .5rem;
    max-width: 30svw;
}

.page-toolbar{
    display: flex;
    gap: .5rem;
    top: 0;
}

/* Form Utilities */



input{
    padding: .5rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-family: 'Geist';
    font-size: .9rem;
    color: var(--color-text);
    border-radius: 6px;

}

/* ===========================
   Date Input & Select Fix
   =========================== */

/* Date Input: Gleiche Höhe wie Text Input */
input[type="date"] {
    padding: .5rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-family: 'Geist', system-ui, sans-serif;
    font-size: .9rem;
    color: var(--color-text);
    border-radius: 6px;
    line-height: normal;
    height: auto;
}

/* Shadow DOM Elemente des Date Inputs */
input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    padding: 0;
    line-height: normal;
}

/* Select: Gleiche Höhe */
select {
    all: unset;
    padding: .5rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-family: 'Geist', system-ui, sans-serif;
    font-size: .9rem;
    color: var(--color-text);
    border-radius: 6px;
    box-sizing: border-box;
    width: 100%;
}

/* Erfassungsdatum ausblenden */
#created-date {
    display: none;
}

/* Label für ausgeblendetes Feld auch ausblenden */
label[for="created-date"] {
    display: none;
}

/* Optional: Auch das Input-Group ausblenden */
.input-group:has(#created-date) {
    display: none;
}



input:focus,
select:focus,
textarea:focus {
    outline: none;
    border: 1px solid var(--color-text);
}

.form-create{
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group{
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.role-buttons, .form-buttons{
    display: flex;
    flex-direction: row;
    gap: .5rem;
}

.form-buttons{
    width: 100%;
    justify-content: space-between;
}

label{
    color: var(--color-muted);
    font-size: .8rem;
}

[class^="formgrid-"] {
    display: grid;
    gap: .5rem;
}

.formgrid-2{
    grid-template-columns: repeat(2, 1fr);
}
.formgrid-3{
    grid-template-columns: repeat(3, 1fr);
}
.formgrid-3_1{
    grid-template-columns: 3fr 1fr;
}

#button-save{
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
    transition: all ease-in-out 120ms;
}

#button-save:hover{
    color: var(--color-bg);
    background-color: var(--color-accent);
}

#button-cancel{
    color: var(--color-muted);
    border: 1px solid var(--color-border);
}

#button-cancel:hover{
    background-color: var(--color-muted);
    color: var(--color-bg);
}

.page-emails .page-content{
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 1rem;
    overflow-y: scroll;
    scrollbar-width: none;/* Firefox */
}

.page-emails .page-content::-webkit-scrollbar {
    display: none;/* Chrome, Safari */
}

.email-preview{
    background-color: var(--color-bg-lighter);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.email-preview-header{
    background-color: var(--color-surface);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.email-preview-meta{
    display: flex;
    justify-content: space-between;
}

.email-preview-mailinfo{
    display: flex;
    flex-direction: column;
    gap: 0;
}

.email-preview-date{
    margin-bottom: .5rem;
}

.email-preview-from{
    margin-bottom: 1rem;
}

.email-preview-to{
    display: grid;
    gap: 1rem;
}

.email-preview-maildetails{
    display: flex;
    text-align: end;
    align-items: end;
}

.email-preview-project-number,
.email-preview-project-designation{
    font-weight: 600;
}

.email-preview-body{
    padding: 4rem;
    overflow-y: scroll;
    font-family: 'Geist';
}

.email-preview-body *{
    font-family: "Geist" !important;
    color: var(--color-text) !important;
}

.email-card-container{
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    scrollbar-width: none;/* Firefox */
}

.email-card{
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1rem;
    transition: all ease-in-out 80ms;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background-color: var(--color-bg-lighter);
}

.email-card,
.email-card * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.email-card:hover{
    background-color: var(--color-surface);
}

.email-card.active{
    border: 1px solid var(--color-accent);
}

.email-card p{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.email-card-meta-wrapper{
    display: flex;
    justify-content: space-between;
}

.email-card-meta{
    display: grid;
    grid-template-columns: 40px auto;
    gap: 0;
}

.email-card-from{
    font-weight: 600;
}

.email-card-icon{
    display: flex;
    align-items: center;
    justify-content: center;
}

.email-card-icon svg{
    stroke: var(--color-muted);
    max-height: 18px;
}

.email-card-icon .icon-inbox{
    stroke: #10b981;
}
.email-card-icon .icon-send{
    stroke: #b91053;
}

.email-card-subject{
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    font-size: 1.1rem;
}
.email-card-content{
    white-space: wrap;
    display: block;
    color: var(--color-muted);
}

.email-card-details{
    display: flex;
    width: 100%;
    justify-content: space-between;
    color: var(--color-muted);
}

.email-card-project{
    justify-self: center;
    background-color: var(--color-accent);
    padding: .25rem .5rem;
    color: var(--color-bg);
    font-size: .75rem;
    border-radius: 3px;
}

.email-card-date{
    justify-self: end;
}

.email-unread{
    background-color: var(--color-accent-shade);
}

.email-responded .email-card-subject{
    font-weight: inherit;
}

.email-unread .email-card-subject{
    color: var(--color-accent);
}

/* email loading animation */

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    background: white;
    padding: 3rem 4rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-message {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    z-index: 10001;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    background: #10b981;
    color: white;
}

.toast-error .toast-icon {
    background: #ef4444;
    color: white;
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
    color: #333;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

/* Responsive */
@media (max-width: 768px) {
    .toast {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
    
    .loading-spinner {
        padding: 2rem 2.5rem;
    }
}