/* Global variables */
:root {
    --primary-color: #1981c7;
    --secondary-color: #251605;
    --hover-color: #145a8a;
    --crossed_out-color: #888888;
    --font-family: 'Arial, sans-serif';
    --transition-duration: 0.3s;
}

body {
    margin: 0;
    /* reset default browser margin */
    font-weight: 400;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    width: 100dvw;
    height: 100dvh;
    padding: 0;
    background-color: var(--secondary-color);
    text-align: center;

}

.burger {
    font-size: 24px;
    cursor: pointer;
    display: block;
}

.burger .line {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: all var(--transition-duration);
}

/* Side menu (popup) */
.side_menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: 280px;
    max-width: 80%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), #fff);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    /* hidden by default (off-screen to the right) */
    transition: transform var(--transition-duration) ease;
    z-index: 1200;
    padding: 28px 16px;
    box-sizing: border-box;
}

.side_menu.open {
    transform: translateX(0);
    /* slide into view */
}

.side_menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.side_menu li {
    margin: 12px 0;
}

.side_menu a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

/* backdrop when menu open */
.side_menu_backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-duration) ease;
    z-index: 1100;
}

.side_menu_backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

@media screen and (max-width: 768px) {
    .nav-links {
        display: none;
        /* Hide nav links by default on smaller screens */
        flex-direction: column;
        width: 100%;
    }

    .nav-links.active {
        display: flex;
        /* Show nav links when active */
    }

    /* Make the content window stack vertically on mobile, grow taller and scroll when needed. */
    .content_window {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        width: 100%;
        padding: 12px;
        box-sizing: border-box;
        min-height: 50dvh;
        max-height: 90dvh;
        overflow-y: auto;
    }

    /* thinner scrollbars on mobile where supported */
    .content_window::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    /* Ensure inner .window fills available width but remains centered and constrained */
    .window {
        width: 100%;
        max-width: 920px;
        margin: 0 auto;
        height: auto;
        box-sizing: border-box;
    }

    /* Make the results grid friendlier on small screens (narrower columns) */
    .results_window .results {
        grid-template-columns: minmax(36px, 48px) 1fr minmax(56px, 96px);
    }

    /* Increase tappable areas and readable text on mobile */
    nav {
        padding: 14px 16px;
        align-items: center;
        height: var(--nav-height, 64px);
    }

    .burger {
        font-size: 28px;
    }

    .burger .line {
        width: 30px;
        height: 4px;
        margin: 6px 0;
    }

    /* removed debug styles (background and oversized main font) */

    .results p {
        padding: 10px;
        font-size: 15px;
    }

    /* Slightly larger editor font on small screens */
    #rawData {
        font-size: 14px;
    }

}

/* remove default paragraph margin inside the nav */
nav p {
    margin: 0;
}

/* ensure nav spans full width and uses border-box sizing */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    background-color: var(--primary-color);
    color: white;
}

.content_window {
    /* Center child both horizontally and vertically relative to the screen */
    display: flex;
    justify-content: center;
    align-items: center;

    /* Make container span full width so centering is true to the screen */
    width: 100%;
    margin: 0 auto;

    /* Fill the viewport height (minus nav) so vertical centering works */
    min-height: calc(100dvh - var(--nav-height, 60px));

    padding: 0 20px;
    box-sizing: border-box;
}

/* .selection_window, */
.results_window,
.update_window,
.login_window {
    /* By default hidden */
    display: none;
}

.window {
    /* Child container inside content_window */
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 100%;
    max-width: 1200px;
    height: auto;
    box-sizing: border-box;
}

.date_buttons {
    /* Grid display of date buttons (7 buttons total) */
    /* Grid will be 2 columns and 4 rows. With first button spanning both rows */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.date_buttons .date_button:first-child {
    grid-column: span 2;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color var(--transition-duration);
}

.date_button:hover {
    background-color: #145a8a;
    /* Darker shade on hover */
}

.results_window .results {
    /* create a 3-column grid with left and right equal, center constrained (~3 digits) */
    display: grid;
    grid-template-columns: minmax(40px, 50px) 1fr minmax(60px, 120px);
    gap: 8px;
    /* reduced overall gap (was 10px) */
    row-gap: 6px;
    /* smaller vertical spacing (was 5px but combined with p margin made it larger) */
    align-items: start;
}

.results_window h2,
.results_window h3 {
    text-align: center;
    margin-top: 0;
}

.results p {
    margin: 0;
    /* remove default paragraph margin */
    background-color: var(--primary-color);
    color: white;
    padding: 8px;
    /* slightly reduced padding */
    border-radius: 4px;
    line-height: 1.2;
    /* tighter line height */
}

.results p:hover {
    background-color: #145a8a;
    /* Darker shade on hover */
}

/* Numbered editor inside update_window */
.editor_wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    height: 320px;
    margin-bottom: 12px;
    background: white;
}

.line_numbers {
    margin: 0;
    padding: 8px 10px;
    width: 48px;
    min-width: 38px;
    max-width: 80px;
    background: #f3f6fb;
    color: #666;
    text-align: right;
    line-height: 1.4;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace;
    font-size: 13px;
    overflow: auto;
    user-select: none;
}

#rawData {
    flex: 1 1 auto;
    border: none;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
    outline: none;
    overflow: auto;
}

/* Buttons below the editor */
.editor_buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 6px;
}

.editor_buttons .date_button {
    padding: 8px 12px;
    font-size: 14px;
}

/* ensure consistent thin scrollbars where supported */
.line_numbers,
#rawData {
    scrollbar-width: thin;
}