* {
    box-sizing: border-box;
}


body {
    margin: 0;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background: #f5f7fb;

    color: #17202a;

    transition:
        background .2s,
        color .2s;
}


a {
    color: inherit;
}


.navbar,
.public-navbar {
    height: 64px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding:
        0 max(
            14px,
            calc(
                (100% - 1100px) / 2
            )
        );

    background: white;

    border-bottom:
        1px solid #e5e7eb;

    position: sticky;

    top: 0;

    z-index: 10;
}


.brand,
.public-brand {
    font-size: 20px;

    font-weight: 700;
}


.nav-right {
    display: flex;

    align-items: center;

    gap: 8px;
}


.icon-button {
    width: 40px;

    height: 40px;

    border: none;

    border-radius: 9px;

    background: #f1f5f9;

    cursor: pointer;

    font-size: 17px;
}


.new-button,
.edit-button,
.view-button,
.back-button,
.logout,
.copy-button {
    display: inline-block;

    padding:
        9px 13px;

    border-radius: 9px;

    border: none;

    text-decoration: none;

    cursor: pointer;

    font-size: 14px;
}


.new-button {
    background: #2563eb;

    color: white;
}


.edit-button {
    background: #eef2ff;

    color: #3730a3;
}


.view-button {
    background: #ecfdf5;

    color: #047857;
}


.back-button {
    background: #f1f5f9;

    color: #334155;
}


.logout {
    color: #dc2626;
}


.container {
    max-width: 1100px;

    margin: auto;

    padding:
        25px 15px 50px;
}


.welcome h1 {
    margin:
        0 0 5px;

    font-size: 28px;
}


.welcome p {
    margin-top: 0;

    color: #64748b;
}


.search-box {
    display: flex;

    gap: 8px;

    margin:
        25px 0;
}


.search-box input {
    flex: 1;
}


input,
textarea {
    width: 100%;

    padding:
        13px 14px;

    border:
        1px solid #d1d5db;

    border-radius: 10px;

    background: white;

    color: inherit;

    font: inherit;

    outline: none;
}


textarea {
    min-height: 400px;

    resize: vertical;

    line-height: 1.65;
}


input:focus,
textarea:focus {
    border-color: #2563eb;
}


.search-box button,
.btn-primary {
    border: none;

    border-radius: 10px;

    background: #2563eb;

    color: white;

    cursor: pointer;

    padding:
        0 18px;

    font-size: 15px;
}


.notes-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(270px, 1fr)
        );

    gap: 15px;
}


.note-card {
    background: white;

    border:
        1px solid #e5e7eb;

    border-radius: 14px;

    padding: 18px;

    box-shadow:
        0 4px 20px
        rgba(0,0,0,.035);
}


.note-top h2 {
    margin: 0;

    font-size: 18px;

    word-break: break-word;
}


.category {
    display: inline-block;

    margin-top: 9px;

    padding:
        4px 8px;

    border-radius: 6px;

    background: #eef2ff;

    color: #4338ca;

    font-size: 12px;
}


.preview {
    margin-top: 13px;

    color: #64748b;

    line-height: 1.5;

    min-height: 45px;
}


.public-link {
    margin-top: 14px;

    padding: 10px;

    border-radius: 8px;

    background: #f8fafc;

    overflow: hidden;
}


.public-link a {
    color: #2563eb;

    font-size: 12px;

    word-break: break-all;
}


.card-actions {
    display: flex;

    align-items: center;

    gap: 7px;

    margin-top: 14px;
}


.card-actions form {
    margin: 0;
}


.delete-button {
    border: none;

    border-radius: 9px;

    padding:
        9px 11px;

    background: #fee2e2;

    color: #b91c1c;

    cursor: pointer;
}


.empty {
    text-align: center;

    padding:
        60px 20px;

    color: #64748b;
}


.empty-icon {
    font-size: 45px;
}


.editor-container {
    max-width: 900px;
}


.editor {
    background: white;

    border:
        1px solid #e5e7eb;

    border-radius: 15px;

    padding: 22px;
}


.editor label {
    display: block;

    margin:
        0 0 7px;

    font-weight: 600;
}


.editor input,
.editor textarea {
    margin-bottom: 18px;
}


.save-button {
    padding:
        13px 20px;
}


.error,
.success {
    padding:
        11px 13px;

    border-radius: 9px;

    margin-bottom: 15px;
}


.error {
    background: #fee2e2;

    color: #991b1b;
}


.success {
    background: #dcfce7;

    color: #166534;
}


.share-box {
    background: white;

    border:
        1px solid #e5e7eb;

    border-radius: 13px;

    padding: 15px;

    margin-bottom: 15px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;
}


.share-url {
    color: #2563eb;

    margin-top: 5px;

    word-break: break-all;

    font-size: 13px;
}


.copy-button {
    background: #2563eb;

    color: white;

    white-space: nowrap;
}


.public-container {
    max-width: 900px;
}


.public-note {
    background: white;

    border:
        1px solid #e5e7eb;

    border-radius: 16px;

    padding:
        25px;
}


.public-note h1 {
    margin: 0;

    font-size: 30px;

    word-break: break-word;
}


.public-date {
    color: #94a3b8;

    font-size: 12px;

    margin-top: 12px;
}


.public-content {
    margin-top: 30px;

    font-size: 16px;

    line-height: 1.8;

    white-space: pre-wrap;

    word-break: break-word;
}


.public-content a {
    color: #2563eb;

    text-decoration: underline;
}


.public-footer {
    margin-top: 30px;

    padding-top: 18px;

    border-top:
        1px solid #e5e7eb;
}


/* LOGIN */

.login-page {
    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;
}


.login-box {
    width: 100%;

    max-width: 390px;

    background: white;

    border:
        1px solid #e5e7eb;

    border-radius: 18px;

    padding: 30px;

    box-shadow:
        0 15px 40px
        rgba(0,0,0,.07);
}


.logo {
    text-align: center;

    font-size: 45px;
}


.login-box h1 {
    text-align: center;

    margin:
        5px 0;
}


.subtitle {
    text-align: center;

    color: #64748b;
}


.login-box label {
    display: block;

    margin-top: 15px;

    margin-bottom: 6px;

    font-weight: 600;
}


.login-box .btn-primary {
    width: 100%;

    padding: 13px;

    margin-top: 18px;
}


/* DARK MODE */

body.dark {
    background: #101318;

    color: #f1f5f9;
}


body.dark .navbar,
body.dark .public-navbar,
body.dark .note-card,
body.dark .editor,
body.dark .share-box,
body.dark .public-note,
body.dark .login-box {
    background: #181c23;

    border-color: #303640;
}


body.dark input,
body.dark textarea {
    background: #11151b;

    border-color: #394150;

    color: white;
}


body.dark .public-link,
body.dark .back-button,
body.dark .icon-button {
    background: #252b34;

    color: white;
}


body.dark .preview,
body.dark .welcome p {
    color: #94a3b8;
}


@media (max-width: 600px) {

    .navbar,
    .public-navbar {
        padding:
            0 12px;
    }


    .brand,
    .public-brand {
        font-size: 17px;
    }


    .logout {
        display: none;
    }


    .container {
        padding:
            20px 12px 40px;
    }


    .notes-grid {
        grid-template-columns: 1fr;
    }


    .search-box button {
        padding:
            0 14px;
    }


    .public-note {
        padding: 18px;
    }


    .public-note h1 {
        font-size: 24px;
    }


    .share-box {
        align-items: flex-start;

        flex-direction: column;
    }


    .copy-button {
        width: 100%;
    }

}