/* BaseNote — native stylesheet (replaces Tailwind) */

:root {
    --bn-bg: #f9fafb;
    --bn-surface: #ffffff;
    --bn-border: #e5e7eb;
    --bn-border-strong: #d1d5db;
    --bn-text: #111827;
    --bn-text-muted: #6b7280;
    --bn-text-faint: #9ca3af;
    --bn-accent: #111827;
    --bn-accent-text: #ffffff;
    --bn-danger: #dc2626;
    --bn-radius: 8px;
}

* {
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--bn-text);
    background: var(--bn-bg);
    -webkit-text-size-adjust: 100%;
}

html {
    font-size: 16px;
}

a {
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, textarea {
    font-family: inherit;
}

/* ---------- Auth pages (login/register) ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 360px;
    background: var(--bn-surface);
    border: 1px solid var(--bn-border);
    border-radius: 12px;
    padding: 24px;
}

.auth-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 16px;
}

.version-badge {
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--bn-text-faint);
}

.auth-error {
    font-size: 0.875rem;
    color: var(--bn-danger);
    margin: 0 0 12px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-input {
    width: 100%;
    border: 1px solid var(--bn-border-strong);
    border-radius: var(--bn-radius);
    padding: 10px 12px;
    font-size: 0.9375rem;
}

.auth-submit {
    width: 100%;
    background: var(--bn-accent);
    color: var(--bn-accent-text);
    border: none;
    border-radius: var(--bn-radius);
    padding: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
}

.auth-footer {
    font-size: 0.875rem;
    color: var(--bn-text-muted);
    margin: 16px 0 0;
}

.auth-footer a {
    text-decoration: underline;
    color: var(--bn-text);
}

@media (max-width: 420px) {
    .auth-page {
        padding: 12px;
    }
    .auth-card {
        padding: 18px;
        border-radius: 10px;
    }
    .auth-title {
        font-size: 1.0625rem;
    }
}

/* ---------- App shell ---------- */

.app-body {
    height: 100vh;
    overflow: hidden;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    height: 100%;
}

@media (min-width: 768px) {
    .app-grid {
        grid-template-columns: 160px var(--bn-list-width, 260px) 6px 1fr;
    }
}

.list-resizer {
    display: none;
    cursor: col-resize;
    background: transparent;
    position: relative;
}

.list-resizer::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2px;
    width: 2px;
    background: var(--bn-border);
}

.list-resizer:hover::after,
.list-resizer.dragging::after {
    background: var(--bn-text-faint);
}

@media (min-width: 768px) {
    .list-resizer {
        display: block;
    }
}

/* Left nav (desktop only) */
.side-nav {
    display: none;
    background: var(--bn-surface);
    border-right: 1px solid var(--bn-border);
    padding: 12px;
    flex-direction: column;
    gap: 4px;
}

@media (min-width: 768px) {
    .side-nav {
        display: flex;
    }
}

.side-nav .brand {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 8px 8px 12px;
}

.view-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--bn-radius);
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--bn-text);
}

.view-item:hover {
    background: var(--bn-bg);
}

.side-nav-bottom {
    margin-top: auto;
    margin-bottom: 34px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logout-link {
    font-size: 0.875rem;
    color: var(--bn-text-faint);
    padding: 8px;
    text-decoration: none;
}

/* List pane */
.list-pane {
    background: var(--bn-surface);
    border-right: 1px solid var(--bn-border);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    height: 100%;
}

.list-pane.hidden {
    display: none;
}

.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-header .brand {
    font-size: 0.875rem;
    font-weight: 600;
}

.mobile-header-links {
    display: flex;
    gap: 12px;
}

.mobile-header a {
    font-size: 0.75rem;
    color: var(--bn-text-faint);
    text-decoration: none;
}

@media (min-width: 768px) {
    .mobile-header {
        display: none;
    }
}

.mobile-tabs {
    display: flex;
    gap: 4px;
}

@media (min-width: 768px) {
    .mobile-tabs {
        display: none;
    }
}

.mobile-tabs .view-item {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    border: 1px solid var(--bn-border);
    padding: 6px 4px;
}

.list-toolbar {
    display: flex;
    gap: 8px;
}

.search-input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--bn-border-strong);
    border-radius: var(--bn-radius);
    padding: 7px 10px;
    font-size: 0.875rem;
}

.new-note-btn {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: var(--bn-radius);
    background: var(--bn-accent);
    color: var(--bn-accent-text);
    border: none;
    font-size: 1rem;
    line-height: 1;
}

.note-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.empty-trash-row {
    text-align: right;
}

.empty-trash-row.hidden {
    display: none;
}

.empty-trash-row button {
    background: none;
    border: none;
    color: var(--bn-danger);
    font-size: 0.75rem;
    padding: 2px 0;
}

.note-item {
    padding: 8px;
    border-radius: var(--bn-radius);
    cursor: pointer;
}

.note-item:hover {
    background: var(--bn-bg);
}

.note-item.active {
    background: var(--bn-bg);
    border: 1px solid var(--bn-border-strong);
}

.note-item-title {
    font-size: 0.875rem;
    font-weight: 500;
}

.note-item-preview {
    font-size: 0.75rem;
    color: var(--bn-text-faint);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-time {
    font-size: 0.6875rem;
    color: var(--bn-text-faint);
    margin-top: 4px;
}

/* Editor pane */
.editor-pane {
    display: none;
    padding: 16px;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.editor-pane.visible {
    display: flex;
}

@media (min-width: 768px) {
    .editor-pane {
        display: flex;
        padding: 24px;
    }
}

.editor-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.editor-topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.125rem;
    color: var(--bn-text-faint);
    padding: 0 4px;
}

@media (min-width: 768px) {
    .back-btn {
        display: none;
    }
}

.save-status {
    font-size: 0.75rem;
    color: var(--bn-text-faint);
}

.editor-actions {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
}

.editor-actions button {
    background: none;
    border: none;
    color: var(--bn-text-faint);
    font-size: 0.75rem;
    padding: 0;
}

.editor-actions button:hover {
    color: var(--bn-text);
}

.editor-actions button.danger:hover {
    color: var(--bn-danger);
}

.editor-title-input {
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    margin-bottom: 8px;
    padding: 0;
}

.editor-title-input::placeholder {
    color: var(--bn-text-faint);
    font-weight: 500;
}

.editor-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}

.share-link-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--bn-radius);
    padding: 6px 10px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: var(--bn-text-muted);
    flex-wrap: wrap;
}

.share-link-box.hidden {
    display: none;
}

.share-link-box a {
    color: #15803d;
    word-break: break-all;
    text-decoration: underline;
}

.share-link-box button {
    background: none;
    border: none;
    font-size: 0.75rem;
    padding: 0;
    white-space: nowrap;
}

.share-link-box #copy-share-link-btn {
    margin-left: auto;
    color: #15803d;
}

.share-link-box #unshare-btn {
    color: var(--bn-danger);
}

.toolbar-btn {
    background: none;
    border: none;
    color: var(--bn-text-muted);
    width: 1.625rem;
    height: 1.625rem;
    font-size: 0.875rem;
    border-radius: 4px;
}

.toolbar-btn:hover {
    background: var(--bn-bg);
    color: var(--bn-text);
}

.toolbar-btn.bold-icon {
    font-weight: 700;
}

.toolbar-btn.italic-icon {
    font-style: italic;
}

.toolbar-btn.strike-icon {
    text-decoration: line-through;
}

.toolbar-btn.underline-icon {
    text-decoration: underline;
}

.editor-body {
    flex: 1;
    overflow-y: auto;
    outline: none;
    font-size: 0.875rem;
    line-height: 1.7;
}

.editor-body:empty::before {
    content: attr(data-placeholder);
    color: var(--bn-text-faint);
}

.editor-body .checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 2px 0;
}

.editor-body .checklist-item input[type="checkbox"] {
    margin-top: 4px;
}

.editor-body .check-glyph {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
    font-size: 1.05em;
    line-height: 1.5;
}

.editor-body .list-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 2px 0;
}

.editor-body .bullet-glyph,
.editor-body .number-glyph {
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
    color: var(--bn-text-muted);
}

.editor-body .number-glyph {
    min-width: 1.4em;
}

/* Share page */
.share-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 20px;
}

.share-header {
    font-size: 0.8125rem;
    color: var(--bn-text-faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--bn-border);
    padding-bottom: 12px;
}

.share-title {
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0 0 16px;
}

.share-body {
    font-size: 0.9375rem;
    line-height: 1.8;
}

.share-body a {
    color: #15803d;
    word-break: break-word;
}

.share-body a:hover {
    text-decoration: none;
}

.share-body .checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0;
}

.share-body .check-glyph {
    flex-shrink: 0;
    font-size: 1.05em;
    line-height: 1.5;
}

.share-body .list-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0;
}

.share-body .bullet-glyph,
.share-body .number-glyph {
    flex-shrink: 0;
    color: var(--bn-text-muted);
}

.share-body .number-glyph {
    min-width: 1.4em;
}

.share-not-found {
    text-align: center;
    color: var(--bn-text-muted);
    padding: 60px 20px;
}

/* Settings modal */
.settings-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--bn-text-muted);
    margin-bottom: 6px;
}

.settings-font-preview {
    padding: 8px;
    border: 1px solid var(--bn-border);
    border-radius: var(--bn-radius);
    margin-bottom: 4px;
    text-align: center;
}

.settings-select {
    width: 100%;
    border: 1px solid var(--bn-border-strong);
    border-radius: var(--bn-radius);
    padding: 8px;
    font-size: 0.875rem;
    background: var(--bn-surface);
    color: var(--bn-text);
}

input[type="range"] {
    width: 100%;
}

/* Offline banner */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fef3c7;
    color: #92400e;
    text-align: center;
    font-size: 0.75rem;
    padding: 6px 10px;
    z-index: 60;
}

.offline-banner.hidden {
    display: none;
}

/* Auth page language toggle */
.auth-lang-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.75rem;
}

.auth-lang-toggle a {
    color: var(--bn-text-faint);
    text-decoration: none;
}

.auth-lang-toggle a.active {
    color: var(--bn-text);
    font-weight: 600;
}


/* Shared-note collaboration */

.shared-by-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bn-bg);
    color: var(--bn-text-muted);
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: var(--bn-radius);
    margin-bottom: 8px;
}

.shared-by-banner.hidden {
    display: none;
}

.note-item-shared-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.6875rem;
    color: var(--bn-text-muted);
    margin-top: 2px;
}

.conflict-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.8125rem;
    padding: 8px 10px;
    border-radius: var(--bn-radius);
    margin-bottom: 8px;
}

.conflict-banner.hidden {
    display: none;
}

.conflict-banner button {
    flex-shrink: 0;
    background: none;
    border: 1px solid #92400e;
    border-radius: var(--bn-radius);
    color: #92400e;
    font-size: 0.75rem;
    padding: 4px 10px;
}

.share-modal-box {
    max-width: 400px;
}

.share-modal-hint {
    font-size: 0.8125rem;
    color: var(--bn-text-muted);
    margin: 0 0 18px;
}

.collaborators-input-row {
    display: flex;
    gap: 8px;
}

.collaborators-input-row input {
    flex: 1;
    border: 1px solid var(--bn-border-strong);
    border-radius: var(--bn-radius);
    padding: 7px 10px;
    font-size: 0.8125rem;
}

.collaborators-input-row button {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--bn-radius);
    background: var(--bn-accent);
    color: var(--bn-accent-text);
    border: none;
    font-size: 1.125rem;
    line-height: 1;
    padding: 0;
}

.collaborators-hint {
    font-size: 0.6875rem;
    color: var(--bn-text-faint);
    margin-top: 4px;
}

.collaborators-feedback {
    font-size: 0.75rem;
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: var(--bn-radius);
    background: var(--bn-bg);
    color: var(--bn-text-muted);
}

.collaborators-feedback.hidden {
    display: none;
}

.collaborators-list {
    margin-top: 10px;
}

.collaborator-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--bn-border);
    font-size: 0.8125rem;
}

.collaborator-row button {
    background: none;
    border: none;
    color: var(--bn-danger);
    font-size: 0.75rem;
    padding: 0;
}

.collaborators-empty {
    font-size: 0.75rem;
    color: var(--bn-text-faint);
    padding: 8px 0;
}
