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

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

:root {
    --color-accent: #7f00b2;
    --color-highlight: #ffffff;

    --color-bg-primary: #fafafa;
    --color-bg-secondary: #f0f0f0;
    --color-bg-tertiary: #e0e0e0;

    --color-text-primary: #0c0c0c;
    --color-text-secondary: #4a4a4a;
    --color-text-tertiary: #6a6a6a;

    --color-button-hover: #e8e8e8;
    --color-button-active: #d4d4d4;

    --color-status-ok: #11ba98;
    --color-status-warning: #edaf05;
    --color-status-alert: rgb(255, 0, 81);

    --color-entry-project: #7f00b2;
    --color-entry-cost: #2f97ff;

    --shadow-button-active: 0px 1px 6px rgba(0,0,0,0.1);
    --shadow-card-hover: 0px 2px 8px rgba(0,0,0,0.1);

    --transition-button: all ease-in-out 80ms;
    --transition-card: all ease-in-out 150ms;

    --time-unit-height: 2.5rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-highlight: #040506;
        --color-bg-secondary: #1e2026;
        --color-bg-primary: #16171b;
        --color-bg-tertiary: #343740;

        --color-text-primary: #f4f4f4;
        --color-text-secondary: #cecece;
        --color-text-tertiary: #a7a7a7;

        --color-button-hover: #15171b;
        --color-button-active: #15161a;

        --shadow-button-active: 0px 1px 6px rgba(0,0,0,0.3);
        --shadow-card-hover: 0px 2px 8px rgba(0,0,0,0.3);
    }
}

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

html, body{
    font-family: 'Geist';
    font-size: .9rem;
    font-weight: 400;
    background-color: var(--color-bg-primary);
    color: var(--color-text-secondary);
    box-sizing: border-box;
}

body{
    display: flex;
    width: 100%;
    height: 100svh;
    overflow: hidden;
}

svg{
    stroke: var(--color-text-secondary);
    width: max-content;
    stroke-width: 1.5px;
    height: 18px;
}

main{
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sticky-top{
    flex-shrink: 0;
}

header{
    width: 100%;
    position: relative;
}

.subheader{
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-bg-tertiary);
    display: flex;
    gap: 2rem;
    align-items: center;
}

.weekstats{
    display: flex;
    gap: .5rem;
    color: var(--color-text-tertiary);
}

header input{
    all: unset;
    box-sizing: border-box;
    background-color: var(--color-bg-primary);
    padding: 1.5rem;
    width: 100%;
    font-family: 'Geist';
    font-size: .9rem;
    border-bottom: 1px solid var(--color-bg-tertiary);
}

.calendar-header{
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    border-bottom: 1px solid var(--color-bg-tertiary);
    min-height: 4rem;
}

.calendar-body{
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
}

.calendar-grid{
    width: 100%;
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
}

.day{
    display: flex;
    gap: .5rem;
    padding: .5rem 1rem;
}

.dayframe, .timeframe{
    border-right: 1px solid var(--color-bg-tertiary);
    position: relative;
}

.day-date{
    all: unset;
    height: 100%;
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.day-date--day{
    color: var(--color-text-primary);
    font-weight: 600;
    text-transform: uppercase;
}

.day-date--stat-wrapper{
    display: flex;
    flex-direction: column;
    font-size: .8rem;
    justify-content: center;
}

.day-date--stat{
    color: var(--color-text-tertiary);
}

.timeunit{
    height: var(--time-unit-height);
}

.timeunit:hover{
    background: var(--color-bg-tertiary);
    transition: var(--transition-button);
}

.timeunit:nth-child(odd){
    border-bottom: 1px solid var(--color-bg-tertiary);
}


.time{
    height: calc(var(--time-unit-height)*2);
    width: 100%;
    border-bottom: 1px solid var(--color-bg-tertiary);
    display: flex;
    justify-content: center;
    font-size: .8rem;
    color: var(--color-text-tertiary);
}

.switch button{
    all: unset;
    padding: .5rem;
    transition: var(--transition-button);
}

button{
    all: unset;
    padding: .5rem;
    transition: var(--transition-button);
    border-radius: 4px;
}

button:hover{
    background-color: var(--color-bg-tertiary);
}

.switch button svg{
    stroke: var(--color-text-secondary);
    stroke-width: 1.5px;
    height: 18px;
}

.switch{
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-text-tertiary);
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    max-width: 320px;
}

.switch *{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

button.user{
    all: unset;
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background-color: var(--color-bg-secondary);
    padding: 1rem;
    border-radius: 100%;
    z-index: 999;
    transition: var(--transition-card);
}

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

button.user svg{
    stroke: var(--color-text-secondary);
    stroke-width: 1.5px;
    height: 18px;
}

.entries {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.entry {
    position: absolute;
    left: 0px;
    right: 0px;
    background: var(--color-accent);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    color: white;
    font-size: 0.8rem;
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    gap: .25rem;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--color-bg-tertiary);
}

.entry.is-project {
    background-color: var(--color-entry-project);
}

.entry.is-cost {
    background-color: var(--color-entry-cost);
}

.entry-title{
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

}

.entry-acticity{
    font-weight: 400;
}

.entry-note {
    opacity: 0.7;
    font-size: .75rem;
    font-style: italic;

}

.entry-regie{
    position: absolute;
    bottom: .5rem;
    align-self: end;
}

.entry-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
}

.entry-resize-handle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.entry.dragging {
    opacity: 0.8;
    cursor: grabbing;
    z-index: 10;
}

.entry {
    cursor: grab;
}

.entry-type-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--color-bg-tertiary);
}

.entry-type-toggle .toggle-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.entry-type-toggle .toggle-btn.is-active {
    background: var(--color-accent);
    color: white;
}

.entry-type-toggle .toggle-btn:hover:not(.is-active) {
    background: var(--color-bg-tertiary);
}

/**/

.timeunit.selecting {
    background-color: color-mix(in srgb, var(--color-accent) 25%, transparent);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-bg-tertiary);
    border-radius: 4px;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
    z-index: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--color-bg-tertiary);
}

.modal-header p {
    font-weight: 500;
    color: var(--color-text-primary);
}

.modal-close {
    padding: 0.25rem;
    border: none;
}

.modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--color-bg-tertiary);
}

.modal-footer button.primary {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

.modal-footer button.primary:hover {
    background: color-mix(in srgb, var(--color-accent) 85%, white);
    border-color: color-mix(in srgb, var(--color-accent) 85%, white);
}

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

input, textarea{
    box-sizing: border-box;
    padding: 0.5rem 1rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-bg-tertiary);
    font-family: 'Geist';
    font-size: .9rem;
    color: var(--color-text-primary);
    border-radius: 4px;
}

textarea {
    width: 100%;
    resize: vertical;
}

.entry-time {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-accent);
    padding: 0.5rem 0;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

/**/

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-tertiary);
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.autocomplete-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.autocomplete-item:hover,
.autocomplete-item.is-active {
    background: var(--color-accent);
    color: white;
}

.autocomplete-no-results {
    padding: 0.5rem 1rem;
    color: var(--color-text-tertiary);
}

.input-group {
    position: relative;
}

/* Quick Entry Autocomplete */

.quick-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-bg-tertiary);
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.quick-autocomplete-item {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
}

.quick-autocomplete-item:hover,
.quick-autocomplete-item.is-active {
    background: var(--color-accent);
    color: white;
}

.quick-autocomplete-item.no-results {
    color: var(--color-text-tertiary);
    cursor: default;
}

.quick-autocomplete-item.no-results:hover {
    background: transparent;
    color: var(--color-text-tertiary);
}

/**/

.calendar-header--mobile {
    display: none;
    justify-content: space-around;
    padding: 0.5rem;
    border-bottom: 1px solid var(--color-bg-tertiary);
}

.day--mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

.day--mobile.active {
    background-color: var(--color-bg-secondary);
}

.day--mobile.active .day-date--mobile,
.day--mobile.active .day-date--day--mobile {
    color: var(--color-accent);
}

.day-date--mobile {
    all: unset;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.day-date--day--mobile {
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
}


@media (max-width: 900px) {
    main {
        padding: 0;
    }

    .calendar-header,
    .calendar-grid {
        grid-template-columns: 40px 1fr;
    }
    
    /* Desktop-Header ausblenden */
    .calendar-header {
        display: none;
    }
    
    /* Mobile-Header anzeigen */
    .calendar-header--mobile {
        display: flex;
    }

    /* Alle Dayframes ausblenden */
    .calendar-body .dayframe {
        display: none;
    }
    
    /* Nur aktiven Dayframe anzeigen */
    .calendar-body .dayframe.active {
        display: block;
    }

    .subheader .switch {
        display: none;
    }
}