﻿:root {
    --pad: 14px;
    --gap: 10px;
    --btnh: 44px;
}

/* ===== Folder Browser ===== */
/* IMPORTANT: folder dialog must be height-capped and flex-column,
   so the list becomes the scroll area instead of growing forever */
.folder-dialog {
    width: min(720px, 92vw);
    max-height: 85vh;
    overflow: hidden; /* keeps the list inside */
    display: flex;
    flex-direction: column;
}

/* Breadcrumb should not force width */
.folder-breadcrumb {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fafafa;
    margin-bottom: 10px;
    overflow-x: auto;
    white-space: nowrap;
}

    .folder-breadcrumb a {
        color: #1f6feb;
        text-decoration: none;
        cursor: pointer;
    }

        .folder-breadcrumb a:hover {
            text-decoration: underline;
        }

/* The list must be a flex child with min-height:0 to allow scrolling */
.folder-list {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    flex: 1 1 auto;
    min-height: 0; /* CRITICAL: allows overflow scrolling inside flex container */

    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.folder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    cursor: pointer;
}

    .folder-item:hover {
        border-color: #1f6feb;
        box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.10);
    }

    /* Left side: ellipsis for long names */
    .folder-item .name {
        font-weight: 650;
        flex: 1 1 auto;
        min-width: 0; /* CRITICAL for ellipsis */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Right side: never wrap */
    .folder-item .chev {
        opacity: 0.7;
        font-family: ui-monospace, Consolas, monospace;
        flex: 0 0 auto;
        white-space: nowrap;
    }

.folder-empty {
    color: #6b7280;
    font-size: 13px;
    padding: 10px 6px;
}

/* Make word links look clickable */

/* default clickable */
.viewer a.word-link {
    text-decoration: none;
    color: #1f6feb;
    cursor: pointer;
    border-bottom: 1px dotted currentColor;
    padding: 1px 2px;
    border-radius: 2px;
    transition: all 0.15s ease;
}

    .viewer a.word-link:hover {
        background: rgba(31, 111, 235, 0.15);
        border-bottom-style: solid;
    }

    /* selected (RED) */
    .viewer a.word-link.hl-selected {
        color: #ff0404 !important;
        border-bottom-color: currentColor !important;
    }

    /* confirm-mode highlight (BLUE, not red) */
    .viewer a.word-link.hl-confirm {
        color: #1f6feb !important;
        border-bottom-color: currentColor !important;
    }

        /* optional soft background for confirm-mode only */
        .viewer a.word-link.hl-confirm .hl1 {
            background-color: rgba(80, 160, 255, 0.45);
            border-radius: 4px;
            padding: 0 2px;
        }

/* Disable old "hl" span behavior if it appears from older renders */
.viewer .hl {
    background: none !important;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, Segoe UI, Roboto, Arial;
    background: #f6f7fb;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--pad);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 5;
}

.toolbar {
    display: flex;
    gap: var(--gap);
}

.btn {
    height: var(--btnh);
    padding: 0 18px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    display: inline-flex;
}

    .btn.primary {
        background: #1f6feb;
        color: #fff;
        border-color: #1f6feb;
    }

main {
    padding: var(--pad);
}

.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: var(--pad);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--gap);
}

.viewer-wrap {
    position: relative;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fafafa;
    overflow: hidden;
    min-height: 520px;
}

.viewer-header {
    font-weight: 700;
    text-align: center;
    padding: 10px;
    border-bottom: 1px dashed #d1d5db;
    font-family: ui-monospace, Consolas, monospace;
}

.viewer {
    font-family: ui-monospace, Consolas, monospace;
    white-space: pre;
    line-height: 1.3;
    padding: var(--pad);
    overflow: auto;
    height: 440px;
}

.page-info {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 12px;
    color: #374151;
}

.question {
    margin-top: var(--gap);
    padding: 12px;
    border-radius: 10px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0c4a6e;
}

.status {
    font-size: 12px;
    color: #6b7280;
    margin-left: 8px;
}

.vline {
    white-space: pre;
}

/* === MODAL MESSAGE BOX / OVERLAYS === */
.msg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: none; /* hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.msg-dialog {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    max-width: 420px;
    width: 90%;
    padding: 16px 18px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
}

/* The normal appearance of the word */
.highlight-word {
    color: black; /* Initial text color */
    cursor: pointer; /* Changes the cursor to a hand icon */
    transition: color 0.3s ease; /* Smooth transition for the color change */
    text-decoration: none; /* Ensure no underline if you want only a color change */
}

    /* The appearance when the user hovers over it */
    .highlight-word:hover {
        color: red; /* The color it changes to on hover */
        background-color: yellow; /* You can also change the background */
        text-decoration: underline; /* Add an underline on hover */
    }

.msg-text {
    white-space: pre-wrap;
    margin-bottom: 14px;
    color: #111827;
    font-size: 14px;
}

.msg-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.hidden {
    display: none !important;
}

/* =========================== Glassmorphism Login Theme (scoped to body.login-page) =========================== */
body.login-page {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    font-family: system-ui, Segoe UI, Roboto, Arial;
    color: #fff;
    background: radial-gradient(1200px 800px at 20% 20%, rgba(120, 100, 255, 0.45), transparent 60%), radial-gradient(1000px 700px at 80% 30%, rgba(0, 200, 255, 0.35), transparent 55%), radial-gradient(900px 700px at 60% 90%, rgba(255, 0, 140, 0.25), transparent 55%), #0b1020;
    overflow: hidden;
    position: relative;
}

    body.login-page::before,
    body.login-page::after {
        content: "";
        position: absolute;
        width: 460px;
        height: 460px;
        border-radius: 50%;
        filter: blur(50px);
        opacity: 0.55;
        z-index: 0;
    }

    body.login-page::before {
        top: -140px;
        left: -160px;
        background: rgba(120, 100, 255, 0.55);
    }

    body.login-page::after {
        bottom: -160px;
        right: -180px;
        background: rgba(0, 200, 255, 0.45);
    }

.login-wrap {
    width: min(420px, 92vw);
    padding: 24px;
    z-index: 1;
}

.glass-card {
    padding: 28px 26px 22px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.login-title {
    margin: 0 0 16px;
    font-size: 22px;
    font-weight: 750;
    letter-spacing: 0.2px;
}

.login-label {
    display: block;
    margin: 14px 0 6px;
    color: rgba(255,255,255,0.85);
    font-size: 0.92rem;
}

.login-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
    outline: none;
}

    .login-input:focus {
        border-color: rgba(255, 255, 255, 0.35);
        box-shadow: 0 0 0 3px rgba(120, 100, 255, 0.22);
    }

.login-btn {
    width: 100%;
    margin-top: 18px;
    padding: 12px 12px;
    border-radius: 12px;
    border: 0;
    cursor: pointer;
    color: #081018;
    font-weight: 750;
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.75));
}

    .login-btn:hover {
        filter: brightness(1.03);
    }

.login-error {
    margin-top: 12px;
    color: #ff6b6b;
    font-size: 0.95rem;
}

.login-note {
    margin-top: 12px;
    color: rgba(255,255,255,0.72);
    font-size: 13px;
}

/* Account page layout tweaks (keeps same look as index) */
.panel.account {
    grid-template-columns: 1fr; /* override 1fr auto */
}

.form-card {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fafafa;
    padding: var(--pad);
    max-width: 720px;
}

.form-row {
    margin-top: var(--gap);
}

    .form-row label {
        display: block;
        font-size: 12px;
        color: #374151;
        margin-bottom: 6px;
    }

    .form-row input {
        width: 100%;
        padding: 10px 12px;
        border-radius: 10px;
        border: 1px solid #d1d5db;
        background: #fff;
        outline: none;
    }

        .form-row input:focus {
            border-color: #1f6feb;
            box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
        }

.anna-eula h1, h2 {
    text-align: center;
}

#eula h1, h2 {
    text-align: center;
}

#eula ol ol {
    list-style-type: lower-alpha;
}

#eula {
    padding: var(--pad);
}

    #eula .center {
        text-align: center;
    }

.eula-form {
    text-align: center;
    padding: var(--pad);
}

label.fileBtn {
    background-color: #1f6feb;
}

.visuallyhidden {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}
