/* Small screens (phones, down to 320px). Loaded last, so it overrides the other files. */

@media (max-width: 800px) {
    /* Sidebar on top, content below */
    body {
        flex-direction: column;
        gap: 0;
    }

    /* Sidebar turns into a bar: logo and "new note" in one row, menu below */
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 16px;

        border-right: none;
        border-bottom: var(--border-thick);
        border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    }

    /* The decorative circles need space, hide them here */
    .sidebar::before,
    .sidebar::after {
        display: none;
    }

    .sidebar h1 {
        order: 1;
        font-size: var(--fs-lg);
    }

    .new-note-button {
        order: 2;
        margin-top: 0;
        padding: 10px 14px;
    }

    .sidebar ul {
        order: 3;
        flex-basis: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 0;
    }

    .sidebar li {
        flex: 1 1 auto;
        margin-bottom: 0;
    }

    .sidebar li a {
        gap: 8px;
        padding: 8px 12px;
    }

    /* Content uses the full width with smaller padding */
    .main-content {
        width: 100%;
        padding: 24px 16px 32px;
    }

    .top-bar h2 {
        font-size: var(--fs-xl);
    }

    .search-field {
        width: 100%;
    }

    .input-section {
        padding: 20px 16px;
    }

    .note-dialog {
        padding: 20px;
    }

    .dialog-header h2 {
        font-size: var(--fs-lg);
    }

    /* Buttons share the row, or take the full width each when they do not fit */
    .dialog-edit-buttons button {
        flex: 1 1 auto;
        padding: 10px 14px;
    }

    .empty-state {
        padding: 24px 0;
    }
}
