:root {
    --header-height: 64px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #222;
}

.header {
    height: var(--header-height);
    padding: 0 20px;
    
    background-color: teal;
    color: #fff;
    
    display: flex;
    align-items: center;

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;

    .menu-button {
        background: none;
        border: 0;
        color: #fff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 16px;
        padding: 8px;
        border-radius: 4px;
    }

    .menu-button:hover {
        background: #fff2;
    }

    .header-title {
        font-size: 20px;
        font-weight: 600;
        font-family: Georgia, 'Times New Roman', Times, serif;
    }
}

/* Side navigation */
.sidebar {
    width: 260px;
    height: 100vh;
    padding: 20px 0;

    background: #fff;
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.1);
    
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    
    /* Hidden by default */
    transform: translateX(-100%);
    transition: transform 0.15s ease;
    z-index: 900;

    &.open {
        transform: translateX(0);
    }
}

.nav-list {
    list-style: none;

    .nav-link {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 20px;
        color: #333;
        text-decoration: none;
    }

    .nav-link:hover {
        background: #f0f0f0;
    }

    .nav-link .material-symbols {
        font-size: 22px;
    }
}


/* Main content */
.main {
    padding: 100px 30px 30px;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.content {
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

    margin-bottom: 20px;

    h1 {
        margin-bottom: 16px;
    }

    p {
        line-height: 1.4;
        color: #444;
    }

    .home-actions {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 20px;
        margin-top: 30px;
    }

    .action-button {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 15px 10px;
        gap: 5px;

        cursor: pointer;

        background: #fff;
        color: #222;
        
        border: 1px solid #ddd;
        border-radius: 10px;

        transition:
            transform 0.15s ease,
            box-shadow 0.15s ease,
            border-color 0.15s ease;

        &:hover {
            transform: translateY(-2px);
            border-color: #bbb;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        &:active {
            transform: translateY(0);
        }

        .material-symbols {
            font-size: 38px;
        }

        strong {
            font-size: 18px;
        }

        small {
            font-size: 14px;
            color: #666;
        }
    }

    /* Mobile */
    @media (max-width: 600px) {
        .home-actions {
            grid-template-columns: 1fr 1fr;
        }
    }
}

.overlay {
    display: none;
    position: fixed;
    inset: var(--header-height) 0 0 0; /* Only overlay content, not header */
    background-color: #0003;
    z-index: 800;

    &.visible {
        display: block;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .sidebar {
        width: 80%;
        max-width: 280px;
    }

    .main {
        padding: 85px 15px 20px;
    }

    .content {
    padding: 15px;
    }
}



dialog {
    min-width: 300px;
    min-height: 500px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #fff;
    color: #222;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
    margin: auto;

    &::backdrop {
        background: rgba(0, 0, 0, 0.5);
    }

    header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        padding: 22px 24px;
        border-bottom: 1px solid #eee;

        h2 {
            margin: 0 0 5px;
            font-size: 21px;
        }

        p {
            margin: 0;
            color: #777;
            font-size: 14px;
        }
    }
}

.icon-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #555;
    cursor: pointer;

    &:hover {
        background: #f0f0f0;
    }
}

/** Event dialog stuff **/

.record-form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 30px);
    gap: 18px;
    padding: 24px;
    overflow-y: auto;

    .form-field {
        display: flex;
        flex-direction: column;
        gap: 7px;
    }

    .form-field > span {
        font-size: 14px;
        font-weight: 600;
    }

    .form-field input,
    .form-field select,
    .form-field textarea {
        width: 100%;
        padding: 11px 12px;

        border: 1px solid #ccc;
        border-radius: 5px;

        background: #fff;
        color: #222;
        font: inherit;

        outline: none;
    }

    .form-field input:focus,
    .form-field select:focus,
    .form-field textarea:focus {
        border-color: #555;
        box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
    }

    .form-field textarea {
        resize: vertical;
        /* min-height: 100px; */
    }


    .record-form-footer {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
        padding: 18px 24px;
        border-top: 1px solid #eee;
    }

    .food-selection-list {
        text-align: center;
        border: 1px solid #555;
        border-radius: 5px;
        max-height: 150px;
        overflow-y: scroll;
        color: #333;

        &:empty {
            border-color: transparent;
        }
        &:empty::before {
            content: "No matching foods";
        }
        
        div {
            padding: 7px 20px;
            font-size: 17px;
            border-bottom: 1px solid #555;
            border-radius: 2px;
            cursor: pointer;

            display: grid;
            grid-template-columns: 1fr 15px 1fr;
            

            &:hover {
                background: #0003;
            }
        }
        div:last-child {
            border-bottom: none;
        }
    }
}


.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 0 16px;
    border: 0;
    border-radius: 5px;

    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.button-destructive {
    background: #c13;
    color: #fff;
}

.button-primary {
    background: #222;
    color: #fff;
}

.button-primary:hover {
    background: #000;
}

.button-secondary {
    background: #eee;
    color: #333;
}

.button-secondary:hover {
    background: #ddd;
}

.button .material-symbols {
    font-size: 19px;
}

/* Small screens */

@media (max-width: 600px) {
    dialog {
        width: 90vw;
        max-height: 90vh;

        header {
            padding-top: 10px;
            padding-bottom: 10px;
        }
    }

    .record-form,
    .record-form-footer {
        padding: 10px;
        padding-left: 18px;
        padding-right: 18px;
    }

    .record-form-footer {
        flex-direction: column-reverse;
    }

    .button {
        width: 100%;
    }
}

#toastContainer {
    position: fixed;

    bottom: 2px;
    right: 2px;

    max-height: 60vh;
    overflow: auto;

    z-index: 1100;

    display: flex;
    flex-direction: column;
    gap: 5px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 12px 16px;
    border-radius: 6px;

    background: #fff;
    color: #222;

    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);

    font-size: 15px;

    width: 350px;

    user-select: none;

    &.info {
        border-left: 4px solid #1976d2;
        .material-symbols {
            color: #1976d2;
        }
    }

    &.general {
        border-left: 4px solid #666;
        .material-symbols {
            color: #666;
        }
    }

    &.warning {
        border-left: 4px solid #ed6c02;
        .material-symbols {
            color: #ed6c02;
        }
    }

    &.error {
        border-left: 4px solid #ea1144;
        .material-symbols {
            color: #ea1144;
        }
    }

    &.success {
        border-left: 4px solid #2e7d32;
        .material-symbols {
            color: #2e7d32;
        }
    }

    .material-symbols {
        flex: 0 0 auto;
        font-size: 20px;
    }

    .message {
        line-height: 1.4;
    }
}

@media (max-width: 600px) {
    #toastContainer {
        max-height: 20vh;
    }

    .toast {
        min-width: 180px;
        width: 220px;
        font-size: 16px;
    }
}

/** last recordings list stuff **/

.last-recordings-list {
    list-style: none;
    margin: 25px 0 0;
    padding: 0;

    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.recording-link:last-child {
    border-bottom: 0;
}

.recording-link {
    border-bottom: 1px solid #e5e5e5;

    min-height: 90px;
    padding: 16px 18px;

    display: flex;
    align-items: center;
    gap: 20px;

    color: inherit;
    text-decoration: none;

    background: #fff;
    transition: background 0.15s ease;
}

.recording-link:hover {
    background: #f7f7f7;
}

.recording-main {
    min-width: 0;
    flex: 1;

    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recording-kind {
    width: fit-content;

    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;

    color: #666;
}

.recording-name {
    font-size: 16px;
    line-height: 1.3;
}

.recording-notes {
    overflow: hidden;

    color: #777;
    font-size: 14px;
    line-height: 1.4;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.recording-time {
    flex: 0 0 auto;

    color: #777;
    font-size: 13px;
    white-space: nowrap;
}

.recording-arrow {
    flex: 0 0 auto;
    color: #999;
}

/* Mobile */

@media (max-width: 600px) {
    .recording-link {
        gap: 12px;
        padding: 15px;
    }

    .recording-time {
    }

    .recording-notes {
        max-width: 100%;
    }
}