/*
 * The World Arcana editor.
 *
 * Registered through FilamentAsset (see AppServiceProvider) rather than Vite, so
 * it loads on the same pages as the editor bundle and nowhere else. Plain CSS on
 * purpose: it is served outside the Tailwind build.
 */

.ae-shell {
    border: 1px solid rgb(212 212 216);
    border-radius: 0.5rem;
    background: #fff;
    overflow: hidden;
}

.ae-shell:focus-within {
    border-color: rgb(129 140 248);
    box-shadow: 0 0 0 1px rgb(129 140 248);
}

/* ---------------------------------------------------------------- toolbar -- */

.ae-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.125rem;
    padding: 0.375rem;
    border-bottom: 1px solid rgb(228 228 231);
    background: rgb(250 250 250);
}

.ae-tb-item {
    display: inline-flex;
    align-items: center;
}

.ae-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: rgb(82 82 91);
    cursor: pointer;
}

.ae-tb-btn:hover:not(:disabled) {
    background: rgb(228 228 231);
    color: rgb(24 24 27);
}

.ae-tb-btn.is-active {
    background: rgb(224 231 255);
    color: rgb(67 56 202);
}

.ae-tb-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.ae-tb-btn svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.ae-tb-sep {
    width: 1px;
    height: 1.25rem;
    margin: 0 0.25rem;
    background: rgb(228 228 231);
}

/* ---------------------------------------------------------------- content -- */

.ae-shell .ae-content {
    min-height: 10rem;
    max-height: 40rem;
    overflow-y: auto;
    padding: 0.75rem 0.875rem;
    outline: none;
    font-size: 0.925rem;
    line-height: 1.6;
    color: rgb(24 24 27);
}

.ae-shell.ae-reduced .ae-content {
    min-height: 5rem;
}

.ae-content > * + * {
    margin-top: 0.6em;
}

.ae-content p.is-editor-empty:first-child::before,
.ae-content > p:only-child:empty::before {
    content: attr(data-placeholder);
    color: rgb(161 161 170);
    float: left;
    height: 0;
    pointer-events: none;
}

.ae-content h1 { font-size: 1.5em; font-weight: 700; line-height: 1.25; }
.ae-content h2 { font-size: 1.3em; font-weight: 700; line-height: 1.3; }
.ae-content h3 { font-size: 1.12em; font-weight: 600; }
.ae-content h4, .ae-content h5, .ae-content h6 { font-weight: 600; }

.ae-content ul { list-style: disc; padding-left: 1.4em; }
.ae-content ol { list-style: decimal; padding-left: 1.4em; }
.ae-content li > p { margin: 0; }

.ae-content ul[data-type='taskList'] {
    list-style: none;
    padding-left: 0.25em;
}

.ae-content ul[data-type='taskList'] li {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
}

.ae-content ul[data-type='taskList'] li > label {
    margin-top: 0.25em;
}

.ae-content blockquote {
    border-left: 3px solid rgb(212 212 216);
    padding-left: 0.85em;
    color: rgb(82 82 91);
}

.ae-content pre {
    background: rgb(24 24 27);
    color: rgb(228 228 231);
    padding: 0.7em 0.9em;
    border-radius: 0.375rem;
    overflow-x: auto;
    font-size: 0.85em;
}

.ae-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.ae-content code {
    background: rgb(244 244 245);
    border-radius: 0.25rem;
    padding: 0.1em 0.3em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9em;
}

.ae-content a {
    color: rgb(67 56 202);
    text-decoration: underline;
}

.ae-content hr {
    border: 0;
    border-top: 1px solid rgb(212 212 216);
}

.ae-content img {
    max-width: 100%;
    border-radius: 0.375rem;
}

/* Tables are most of what a worldbuilding app holds — make them legible. */
.ae-content table {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    overflow: hidden;
}

.ae-content th,
.ae-content td {
    border: 1px solid rgb(212 212 216);
    padding: 0.35em 0.55em;
    vertical-align: top;
    text-align: left;
}

.ae-content th {
    background: rgb(244 244 245);
    font-weight: 600;
}

.ae-content .selectedCell::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgb(224 231 255 / 0.5);
    pointer-events: none;
}

/* ------------------------------------------------------- nodes and popups -- */

.ae-lorelink {
    background: rgb(237 233 254);
    color: rgb(91 33 182);
    border-radius: 0.25rem;
    padding: 0 0.25em;
    box-decoration-break: clone;
}

.ae-mention {
    background: rgb(219 234 254);
    color: rgb(29 78 216);
    border-radius: 0.25rem;
    padding: 0 0.25em;
}

.ae-suggestion {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9999;
    min-width: 12rem;
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.25rem;
    border: 1px solid rgb(212 212 216);
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.14);
}

.ae-sug-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    font-size: 0.825rem;
    text-align: left;
    cursor: pointer;
}

.ae-sug-item.is-selected {
    background: rgb(224 231 255);
}

.ae-sug-hint {
    color: rgb(113 113 122);
    font-size: 0.75rem;
}

.ae-sug-empty {
    padding: 0.3rem 0.5rem;
    font-size: 0.825rem;
    color: rgb(113 113 122);
}

/* ------------------------------------------------------------- dark mode -- */

.dark .ae-shell {
    border-color: rgb(63 63 70);
    background: rgb(24 24 27);
}

.dark .ae-toolbar {
    border-bottom-color: rgb(63 63 70);
    background: rgb(39 39 42);
}

.dark .ae-tb-btn { color: rgb(161 161 170); }
.dark .ae-tb-btn:hover:not(:disabled) { background: rgb(63 63 70); color: #fff; }
.dark .ae-tb-btn.is-active { background: rgb(49 46 129); color: rgb(199 210 254); }
.dark .ae-tb-sep { background: rgb(63 63 70); }
.dark .ae-shell .ae-content { color: rgb(228 228 231); }
.dark .ae-content code { background: rgb(39 39 42); }
.dark .ae-content th { background: rgb(39 39 42); }
.dark .ae-content th, .dark .ae-content td { border-color: rgb(63 63 70); }
.dark .ae-content blockquote { border-left-color: rgb(63 63 70); color: rgb(161 161 170); }
.dark .ae-suggestion { background: rgb(24 24 27); border-color: rgb(63 63 70); }
.dark .ae-sug-item { color: rgb(228 228 231); }
.dark .ae-sug-item.is-selected { background: rgb(49 46 129); }
