/* =============================================================================
   EDIT MODE: login page, badge, "Edit info" button and editor dialog
============================================================================= */

:root {
    --ed-gold: #FFC600;
    --ed-gold-soft: rgba(255, 198, 0, .12);
    --ed-blue: #3EA6FF;
    --ed-line: rgba(62, 166, 255, .25);
    --ed-panel: rgba(7, 20, 31, .96);
    --ed-text: #d5e6f5;
    --ed-muted: #8fa6c2;
}

/* ---------- Buttons ---------- */

.editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid var(--ed-line);
    border-radius: 8px;
    background: rgba(7, 20, 31, .7);
    color: var(--ed-text);
    font: 600 .72rem 'IBM Plex Sans', sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .2s, background .2s, color .2s, box-shadow .2s;
}

.editor-btn:hover {
    border-color: rgba(62, 166, 255, .6);
    color: #fff;
}

.editor-btn--gold {
    border-color: rgba(255, 198, 0, .55);
    background: var(--ed-gold-soft);
    color: var(--ed-gold);
}

.editor-btn--gold:hover {
    border-color: var(--ed-gold);
    background: rgba(255, 198, 0, .2);
    color: #ffe169;
    box-shadow: 0 0 14px rgba(255, 198, 0, .25);
}

.editor-btn:disabled {
    opacity: .5;
    cursor: default;
}

.editor-btn--wide {
    width: 100%;
}

.editor-btn:focus-visible,
.editor-info-btn:focus-visible,
.editor-tab:focus-visible {
    outline: 2px solid var(--ed-gold);
    outline-offset: 2px;
}

/* ---------- Login page ---------- */

.editor-login {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    box-sizing: border-box;
}

.editor-login-card {
    width: min(400px, 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 32px 28px 24px;
    border: 1px solid var(--ed-line);
    border-radius: 14px;
    background: rgba(7, 20, 31, .82);
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 40px rgba(62, 166, 255, .08);
    font-family: 'IBM Plex Sans', sans-serif;
    color: var(--ed-text);
    animation: editor-rise .6s ease both;
}

@keyframes editor-rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

.editor-login-logo {
    width: 190px;
    margin: 0 auto 4px;
}

.editor-login-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--ed-gold);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .3em;
}

.editor-login-text {
    margin: 0;
    font-size: .85rem;
    line-height: 1.6;
    color: var(--ed-muted);
    text-align: center;
}

.editor-login-text strong {
    color: #fff;
}

.editor-login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.editor-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.editor-field span {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ed-muted);
}

.editor-field input {
    padding: 11px 12px;
    border: 1px solid var(--ed-line);
    border-radius: 8px;
    background: rgba(2, 10, 18, .8);
    color: #fff;
    font: 400 .95rem 'IBM Plex Sans', sans-serif;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.editor-field input:focus {
    border-color: var(--ed-gold);
    box-shadow: 0 0 0 3px rgba(255, 198, 0, .15);
}

.editor-login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 107, 107, .4);
    border-radius: 8px;
    background: rgba(255, 107, 107, .08);
    color: #ff8a8a;
    font-size: .82rem;
}

.editor-login-back {
    align-self: center;
    margin-top: 4px;
    font-size: .75rem;
    color: var(--ed-muted);
    text-decoration: none;
}

.editor-login-back:hover {
    color: var(--ed-blue);
}

/* ---------- EDIT MODE badge (bottom-right) ---------- */

.editor-badge {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 6px 6px 14px;
    border: 1px solid rgba(255, 198, 0, .45);
    border-radius: 999px;
    background: rgba(7, 20, 31, .92);
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
    color: var(--ed-gold);
    font: 700 .62rem 'IBM Plex Sans', sans-serif;
    letter-spacing: .16em;
}

.editor-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ed-gold);
    box-shadow: 0 0 8px rgba(255, 198, 0, .9);
    animation: editor-blink 2s ease-in-out infinite;
}

@keyframes editor-blink {
    50% { opacity: .35; }
}

.editor-badge-user {
    color: var(--ed-muted);
    font-weight: 500;
    letter-spacing: .04em;
}

.editor-badge-out {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 198, 0, .1);
    color: var(--ed-gold);
    cursor: pointer;
    transition: background .2s;
}

.editor-badge-out:hover {
    background: rgba(255, 198, 0, .25);
}

/* ---------- "Edit info" on the Mission card ---------- */

.editor-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    align-self: flex-end;
    margin-top: 14px;
    margin-left: auto;
    padding: 6px 12px;
    border: 1px dashed rgba(255, 198, 0, .5);
    border-radius: 7px;
    background: transparent;
    color: var(--ed-gold);
    font: 600 .66rem 'IBM Plex Sans', sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.editor-info-btn:hover {
    border-style: solid;
    border-color: var(--ed-gold);
    background: var(--ed-gold-soft);
}

.mission-card-content:has(> .editor-info-btn) {
    display: flex;
    flex-direction: column;
}

/* ---------- Editor dialog ---------- */

.editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(1, 6, 12, .7);
    backdrop-filter: blur(4px);
}

.editor-overlay[hidden] {
    display: none;
}

.editor-dialog {
    width: min(760px, 100%);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 22px 24px 18px;
    border: 1px solid rgba(255, 198, 0, .35);
    border-radius: 14px;
    background: var(--ed-panel);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .6), 0 0 30px rgba(255, 198, 0, .08);
    font-family: 'IBM Plex Sans', sans-serif;
    color: var(--ed-text);
    box-sizing: border-box;
    animation: editor-rise .25s ease both;
}

.editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.editor-kicker {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .22em;
    color: var(--ed-gold);
}

.editor-title {
    margin-top: 4px;
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
}

.editor-close {
    border: 0;
    background: none;
    color: var(--ed-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.editor-close:hover {
    color: #fff;
}

.editor-tabs {
    display: flex;
    gap: 8px;
}

.editor-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--ed-line);
    border-radius: 7px;
    background: transparent;
    color: var(--ed-muted);
    font: 600 .68rem 'IBM Plex Sans', sans-serif;
    letter-spacing: .08em;
    cursor: pointer;
}

.editor-tab.is-active {
    border-color: var(--ed-blue);
    background: rgba(33, 150, 243, .18);
    color: #fff;
}

/* small gold dot = unsaved changes in that tab */
.editor-tab-dot {
    display: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ed-gold);
}

.editor-tab.is-dirty .editor-tab-dot {
    display: inline-block;
}

.editor-text {
    flex: 1;
    min-height: 260px;
    padding: 14px;
    border: 1px solid var(--ed-line);
    border-radius: 8px;
    background: rgba(2, 10, 18, .85);
    color: #e9f3fc;
    font: 400 .92rem/1.6 'IBM Plex Sans', sans-serif;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.editor-text:focus {
    border-color: rgba(255, 198, 0, .6);
    box-shadow: 0 0 0 3px rgba(255, 198, 0, .1);
}

.editor-foot {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-msg {
    flex: 1;
    font-size: .78rem;
    color: var(--ed-muted);
}

.editor-msg--ok    { color: #50ffa0; }
.editor-msg--error { color: #ff8a8a; }

.editor-hint {
    font-size: .68rem;
    color: #5f7590;
}

@media (max-width: 600px) {
    .editor-hint { display: none; }
    .editor-badge-user { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .editor-login-card,
    .editor-dialog,
    .editor-badge-dot { animation: none; }
}
