body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto;
    background: #f1f5f9;
    color: #0f172a;
}

.authPage {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #1e293b)
}

.authCard {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25)
}

.authTitle {
    font-size: 22px;
    font-weight: 600;
    text-align: center
}

.authInput {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    outline: none
}

.authInput:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px #2563eb22
}

.authBtn {
    padding: 12px;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px
}

.authLogin {
    background: #2563eb
}

.authLogin:hover {
    background: #1d4ed8
}

.authSignup {
    background: #22c55e
}

.authSignup:hover {
    background: #16a34a
}

.authLogout {
    background: #ef4444;
}

.authLogout:hover {
    background: #ec2727;
}

.authLink {
    text-align: center;
    font-size: 14px;
    color: #2563eb;
    cursor: pointer
}

.twoBtnOneLine {
    display: flex;
    gap: 50px;
    justify-content: center;
    max-width: 100%;
}

hr {
    border: none;
    border-top: 1px solid #000000;
    margin: 5px 0;
}

.topbar {
    background: #0f172a;
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.logo {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logoTitle {
    font-weight: 600;
    font-size: 18px;
}

.version {
    font-size: 10px;
    padding: 2px 6px;
    margin: auto;
    margin-top: 5px;
    border-radius: 6px;
    background: #1e293b;
    color: #cbd5f5;
    font-weight: 600;
}

#toggleSidebarBtn {
    background: #1e293b;
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
}

#toggleSidebarBtn:hover {
    background: #334155;
}

.sidebar.hidden * {
    display: none;
}

.sidebar {
    width: 270px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column
}

.newBtn {
    margin: 14px;
    padding: 10px;
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600
}

.sidebar input {
    margin: 0 14px 14px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    outline: none;
    font-size: 14px
}

.sidebar input:focus {
    border-color: #2563eb
}

.noteItem {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: .15s
}

.noteItem:hover {
    background: #f8fafc
}

.noteTitle {
    font-weight: 600;
    font-size: 22px;
    display: -webkit-box;
    display: box;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.noteDesc {
    font-size: 16px;
    color: #64748b;
    margin-top: 10px;
    display: -webkit-box;
    display: box;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.noteTime {
    font-size: 16px;
    color: #94a3b8;
    margin-top: 16px
}

#importBtn {
    width: 100%;
    padding: 10px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

#importBtn:hover {
    background: #4f46e5;
}

.sidebarProfile {
    padding: 14px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer
}

.sidebarProfile img {
    width: 36px;
    height: 36px;
    border-radius: 50%
}

.sidebarProfile div {
    min-width: 0;
}

img.verifiedbadge {
    width: 16px;
    height: 16px;
    margin-left: 2px;
    margin-bottom: -2px;
}

#sidebarName {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    font-weight: 600;
}

#sidebarEmail {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    opacity: .60;
    font-size: 12px;
    margin-top: 5px;
}

.editor {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative
}

.toolIcon {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

#title {
    font-size: 26px;
    font-weight: 600;
    border: none;
    outline: none;
    background: transparent
}

.toolbar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04)
}

.toolbar button,
.toolbar select,
.toolbar input[type=color] {
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px
}

.toolbar button:hover,
.toolbar select:hover {
    background: #f1f5f9
}

.editorBox {
    flex: 1;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    overflow: auto;
    font-size: 24px;
    line-height: 1.6;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .05)
}

.editorBox:focus {
    outline: 2px solid #2563eb33
}

.editorActions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px
}

a {
    color: #2563eb !important;
    text-decoration: underline;
}

.addLinkBtn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.addLinkBtn:hover {
    background: #1d4ed8;
}

.formRow {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.formRow label {
    width: 25%;
    font-size: 15px;
    color: #334155;
}

.formRow input {
    width: 75%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    font-size: 15px;
}

.modalActions.equal {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modalActions.equal button {
    flex: 1;
    height: 42px;
}

.tooltipBox {
    position: absolute;
    background: #111;
    color: #fff;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: .18s;
}

.tooltipBox.show {
    opacity: 1;
    transform: translateY(0);
}

a.noteLink {
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
}

.delete {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500
}

.delete:hover {
    background: #dc2626
}

#saveBtn {
    background: #22c55e;
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500
}

#saveBtn:hover {
    background: #16a34a
}

#downloadBtn {
    background: #0ea5e9;
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

#downloadBtn:hover {
    background: #0284c7;
}

.sidebar {
    transition: width .25s ease, opacity .2s ease;
}

.sidebar.hidden {
    width: 0;
    opacity: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar>* {
    transition: opacity .15s ease;
}

.sidebar.hidden>* {
    opacity: 0;
    pointer-events: none;
}

.container {
    display: flex;
    height: calc(100vh - 60px);
}

.toolGroup {
    display: flex;
    gap: 6px;
    align-items: center;
}

.toolDivider {
    width: 3px;
    height: auto;
    background: #ababab;
    margin: 0 4px;
}

.toolbar button {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 0;
    font-weight: 600;
    letter-spacing: .3px;
}

.toolbar select {
    height: 34px;
}

#affBtn {
    background: #10b981;
    border: none;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    width: auto;
}

#affBtn:hover {
    background: #059669;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modalBox {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    width: 320px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.modalTitle {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.modalActions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.modalCancel {
    flex: 1;
    background: #e2e8f0;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.modalDelete {
    flex: 1;
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.modalDelete:hover {
    background: #dc2626;
}

.rightbar {
    width: 260px;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
}

.adBox {
    background: #f8fafc;
    border-radius: 10px;
    text-align: center;
}

.adImg {
    width: 100%;
    border-radius: 8px;
}

.contactBtn {
    margin-top: 14px;
    padding: 10px;
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.contactBtn:hover {
    background: #1d4ed8;
}

.rightFooter {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: #64748b;
}

#contactForm {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

#contactForm .authInput,
#contactForm textarea,
#contactForm button {
    width: 100%;
    box-sizing: border-box;
}

.authCard {
    align-items: stretch;
}

.authLink {
    margin-top: 12px;
    text-align: center;
}

.editor {
    position: relative;
}

#editorStickyAd {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 720px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    padding: 6px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .18);
    z-index: 9999;
}

#editorStickyAd img {
    width: 100%;
    height: auto;
    border-radius: 6px;
}

#closeEditorAd {
    position: absolute;
    top: -8px;
    left: -8px;
    border: none;
    background: #ef4444;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Change container to vertical stacking */
    .container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 60px);
        overflow-x: hidden;
    }

    /* Left sidebar - hidden by default on mobile */
    .sidebar {
        position: fixed;
        left: -270px;
        /* top: 60px; */
        width: 270px;
        height: calc(100vh - 60px);
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .sidebar.mobile-visible {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    /* Remove the hidden class behavior on mobile */
    .sidebar.hidden {
        width: 270px;
        opacity: 1;
        overflow-y: auto;
        border-right: 1px solid #e2e8f0;
        left: -270px;
    }

    .sidebar.hidden.mobile-visible {
        left: 0;
    }

    .sidebar.hidden * {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .editorBox {
        overflow: auto;
    }

    .editorBox {
        -webkit-overflow-scrolling: touch;
    }

    .authCard {
        max-width: 65%;
        margin: auto;
    }

    /* Overlay when sidebar is open */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .mobile-overlay.active {
        display: block;
    }

    /* Editor takes full width */
    .editor {
        flex: none;
        width: 100%;
        padding: 16px;
        /* min-height: 60vh; */
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Right sidebar below editor */
    .rightbar {
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        padding: 16px;
        box-sizing: border-box;
    }

    /* Adjust toolbar for mobile */
    .toolbar {
        overflow-x: visible;
        flex-wrap: wrap;
        padding: 6px;
    }

    .toolbar button {
        min-width: 34px;
        flex-shrink: 0;
    }

    /* Title input */
    #title {
        font-size: 22px;
    }

    /* Editor box */
    .editorBox {
        font-size: 18px;
        min-height: 300px;
    }

    /* Editor actions */
    .editorActions {
        position: static;
        margin-top: 10px;
        justify-content: flex-end;
    }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    .rightbar {
        width: 220px;
    }

    .sidebar {
        width: 240px;
    }
}