/**
First draft of the style.css file.
@todo: Remove this and port the styles to Tailwind CSS.
 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sidebar-w: 260px;
    --light: #ffffff;
    --border:    #e0e0e0;
    --bg-aside:  #f7f7f7;
    --text:      #111;
    --muted:     #666;
    --accent:    #2563eb;
    --danger:    #dc2626;
    --font:      system-ui, -apple-system, sans-serif;
    --mono:      ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
}

html, body { height: 100%; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: #fff;
}

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    background: var(--bg-aside);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent);
    padding: 2px 6px;
}

.new-doc-form {
    display: flex;
    gap: 5px;
}

.new-doc-form input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    font-family: var(--mono);
}

.new-doc-form input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.ui-button {
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    margin: 0 auto;
}
.ui-button:hover { background: #1d4ed8; }

.doc-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
}

.doc-item {
    border-bottom: 1px solid var(--border);
}

.doc-item a {
    display: block;
    padding: .65rem 1rem;
    text-decoration: none;
    color: var(--text);
    border-left: 2px solid transparent;
}

.doc-item a:hover       { background: rgba(37,99,235,.05); }
.doc-item.active a      { border-color: var(--accent); background: rgba(37,99,235,.07); }

.doc-slug  { font-weight: 500; font-size: 13px; }

.doc-stats {
    display: flex;
    gap: .6rem;
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.sidebar-footer {
    padding: .6rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

.user-name {
    flex: 1;
    font-size: 12px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-sidebar-action {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
}

.btn-sidebar-action:hover {
    color: var(--accent); /* @todo: has to be adjusted */
}

.btn-sidebar-action.active {
    /* - some defintions for active state - */
    color: var(--accent);
    text-decoration: underline;
}

main.editor-area {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    /*background-color: #E8F0F3;*/
}

.content-toolbar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
    flex-shrink: 0;
}

.doc-name {
    flex: 1;
    font-weight: 500;
    font-size: 13px;
    font-family: var(--mono);
}

.btn {
    padding: 4px 11px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover        { background: #f0f0f0; }
.btn-primary      { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger       { color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover  { background: #fef2f2; }

.title-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 1.1rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--border);
    font-family: inherit;
    outline: none;
    background: var(--bg);
    color: var(--text);
}

.title-input:focus {
    border-bottom-color: var(--accent);
}

.editor-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

#editor {
    resize: none;
    border: none;
    border-right: 1px solid var(--border);
    padding: 1.25rem;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.75;
    overflow-y: auto;
    width: 100%;
    height: 100%;
    outline: none;
    color: var(--text);
}

#preview {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.7;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    font-size: 14px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin-top: 1.4em;
    margin-bottom: .4em;
    line-height: 1.3;
}

.markdown-body h1 { font-size: 1.7em; }
.markdown-body h2 { font-size: 1.35em; }
.markdown-body h3 { font-size: 1.1em; }

.markdown-body p          { margin-bottom: .9em; }
.markdown-body ul,
.markdown-body ol         { padding-left: 1.4em; margin-bottom: .9em; }
.markdown-body li         { margin-bottom: .2em; }

.markdown-body code {
    font-family: var(--mono);
    font-size: .875em;
    background: #f3f4f6;
    padding: .15em .4em;
    border-radius: 3px;
}

.markdown-body pre {
    background: #f3f4f6;
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: .9em;
}

.markdown-body pre code { background: none; padding: 0; }

.markdown-body blockquote {
    border-left: 3px solid var(--border);
    padding-left: 1em;
    color: var(--muted);
    margin-bottom: .9em;
}

.markdown-body a   { color: var(--accent); }
.markdown-body hr  { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: .9em;
    font-size: 14px;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border);
    padding: .4em .75em;
    text-align: left;
}

.markdown-body th { background: var(--bg-aside); }

body.public {
    max-width: 740px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

.view-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.view-slug { font-weight: 600; font-size: 13px; font-family: var(--mono); }
.view-date { font-size: 12px; color: var(--muted); }

/* ── Sharing ──────────────────────────────────────────────────────────────── */

.doc-label {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
}

.label-shared   { background: #dbeafe; color: #1d4ed8; }
.label-received { background: #f0fdf4; color: #15803d; }

.btn-sm {
    padding: 2px 7px;
    font-size: 11px;
}

.lock-warning {
    padding: .5rem .75rem;
    background: #fefce8;
    border-bottom: 1px solid #fde047;
    font-size: 12px;
    color: #854d0e;
    flex-shrink: 0;
}

.share-panel {
    border-bottom: 1px solid var(--border);
    background: #fafafa;
    padding: .75rem 1rem;
    flex-shrink: 0;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.share-panel.hidden { display: none; }

.share-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-bottom: .4rem;
}

.share-members {
    min-width: 180px;
}

.share-member {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: 12px;
    padding: 2px 0;
}

.share-member-name  { font-weight: 500; }
.share-member-role  { color: var(--muted); font-size: 11px; }

.share-member-status {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-accepted { background: #f0fdf4; color: #15803d; }
.status-pending  { background: #fef9c3; color: #92400e; }
.status-declined { background: #fef2f2; color: #b91c1c; }

.share-invite-link {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: .3rem;
}

.share-invite-link input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--mono);
    background: #fff;
    min-width: 0;
    cursor: pointer;
}

body.guest {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-aside);
}

.login-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    width: 360px;
    text-align: center;
}

.login-card h1  { font-size: 18px; margin-bottom: 1.5rem; }

.btn-discord {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: 9px 18px;
    background: #5865F2;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.btn-discord:hover { background: #4752c4; }

/* ── Login form additions ─────────────────────────────────────────────────── */

.login-divider {
    position: relative;
    text-align: center;
    margin: 1.25rem 0;
    color: var(--muted);
    font-size: 11px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: var(--border);
}

.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }

.login-form {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    text-align: left;
}

.login-form input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: var(--font);
}

.login-form input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 8px;
    display: block;
}

/* ── Notifications ────────────────────────────────────────────────────────── */

.notifications {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Inside login-card: flow normally, not fixed */
.login-card .notifications {
    position: relative;
    margin-bottom: 1rem;
}

.notification {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .6rem 1rem;
    font-size: 13px;
}

.notification-error {
    background: #fee2e2;
    color: #991b1b;
    border-bottom: 1px solid #fca5a5;
}

.notification-success {
    background: #dcfce7;
    color: #166534;
    border-bottom: 1px solid #86efac;
}

.notification-close {
    display: flex;
    align-items: center;      /* vertikal zentriert */
    justify-content: center;  /* horizontal zentriert */
    width: 24px;
    height: 24px;
    background: #86efac;
    border: 2px solid transparent;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    color: inherit;
    opacity: .6;
    flex-shrink: 0;

    font-size: 18px;
    line-height: 1;
}

.notification-close:hover { opacity: 1; }

/* ── Settings ─────────────────────────────────────────────────────────────── */

.settings-area {
    /*padding: 2rem;*/
    overflow-y: auto;
}

.settings-section {
    padding: 2rem;
    max-width: 480px;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-version {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 13px;
    color: var(--muted);
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.settings-version-tag {
    font-family: var(--mono);
    font-size: 12px;
}

.changelog-body {
    padding: 2rem;
    max-width: 680px;
    overflow-y: auto;
}

.settings-heading {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: .5rem;
}

.settings-hint {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 1rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: 1rem;
}

.settings-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.settings-form input {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: var(--font);
}

.settings-form input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.settings-form-inline {
    flex-direction: row;
    align-items: center;
    margin-top: 1rem;
}

.settings-form-inline input {
    flex: 1;
    margin-right: .5rem;
}

.token-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: .75rem;
    margin-bottom: 1rem;
}

.token-table th,
.token-table td {
    text-align: left;
    padding: .4rem .6rem;
    border-bottom: 1px solid var(--border);
}

.token-table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    background: var(--bg-aside);
}

.token-value {
    font-family: var(--mono);
    font-size: 11px;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    word-break: break-all;
}

.btn kbd {
    font-family: inherit;
    font-size: 0.85em;
    opacity: 0.7;
    margin-left: 0.25rem;
}

.initial-password-banner {
    background: #dc2626;
    color: #fff;
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.initial-password-banner a {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}

/* ── Folders ──────────────────────────────────────────────────────────────── */

.folder-item {
    display: flex;
    align-items: stretch;
}

.folder-item > a {
    flex: 1;
    min-width: 0;
}

.folder-item-btns {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 .4rem;
    opacity: 0;
    transition: opacity .15s;
}

.folder-item-btns button {
    min-width: 36px;
    min-height: 100%;
    background-color: var(--border);
}

.folder-item-btns button:hover {
    background-color: var(--muted);
    color: var(--border);
}

.folder-item:hover .folder-item-btns { opacity: 1; }

.folder-rename-btn,
.folder-delete-btn,
.sidebar-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 11px;
    padding: 3px 5px;
    border-radius: 3px;
    line-height: 1;
}

.folder-rename-btn:hover { color: var(--accent); }
.folder-delete-btn:hover { color: var(--danger); }

.folder-item-btns form { display: contents; }

.folder-rename-form {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: .35rem .6rem;
    width: 100%;
}

.folder-rename-form input {
    flex: 1;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    min-width: 0;
}

.folder-rename-form button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 5px;
    color: var(--muted);
    border-radius: 3px;
}

.folder-rename-form button:first-of-type { color: var(--accent); }
.folder-rename-form button:hover { opacity: .7; }

.shared-doc-list { overflow-y: unset; }

/* ── Delete confirmation overlay ─────────────────────────────────────────── */

.folder-delete-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.folder-delete-dialog {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
}

.folder-delete-dialog p {
    margin-bottom: 1.25rem;
    font-size: 14px;
}

.folder-delete-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.folder-delete-actions form { display: contents; }
.folder-delete-actions .btn { width: 100%; justify-content: center; }

.icon-size-2 {
    width: 18px;
    height: 18px;
}

.doc-title {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.doc-title svg {
    flex-shrink: 0;
    display: block;
}
