/* ── Myanmar font ──────────────────────────────── */
:root {
    --font-myanmar: 'Padauk', 'Pyidaungsu', sans-serif;
}

html {
    height: 100%;
}

body, html {
    font-family: var(--font-myanmar);
    margin: 0;
    padding: 0;
}

/* Full-height flex column layout */
.fluent-layout {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.app-main {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-footer {
    flex: 0 0 auto;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.top-nav-link {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--neutral-foreground-rest, #222);
}

.top-nav-link.active {
    background: var(--neutral-fill-stealth-rest, #f2f2f2);
    color: var(--accent-foreground-rest, #8B5A2B);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
    white-space: nowrap;
    padding: 6px 4px;
}

.brand-logo {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
}

@media (max-width: 980px) {
    .top-nav {
        display: none;
    }
}

.myanmar-text {
    font-family: var(--font-myanmar);
}

/* ── Blazor loading progress ───────────────────── */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #8B5A2B;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

/* ── Blazor error UI ────────────────────────────── */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* ── Loading spinner component ──────────────────── */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
}

.loading-text {
    color: var(--neutral-foreground-hint, #888);
    font-size: 0.9rem;
    margin: 0;
}

/* ── Book content reader ────────────────────────── */
.book-content {
    font-family: var(--font-myanmar);
    line-height: 1.8;
    font-size: 1rem;
    max-width: 800px;
    margin-left: 12px;
}

@media (min-width: 768px) {
    .book-content {
        margin-left: 16px;
    }
}

    .book-content h1, .book-content h2, .book-content h3,
    .book-content h4, .book-content h5, .book-content h6 {
        font-family: var(--font-myanmar);
        margin-top: 1.5em;
        margin-bottom: 0.5em;
        line-height: 1.4;
    }

    .book-content p {
        margin: 0 0 1em 0;
        text-align: justify;
    }

/* ── Chat page ──────────────────────────────────── */
.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: var(--neutral-foreground-hint, #888);
    text-align: center;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 600px;
}

.chat-input-area {
    display: flex;
    flex-direction: column;
    padding: 12px 0 0 0;
    border-top: 1px solid var(--neutral-stroke-rest, #ccc);
    margin-top: 8px;
}

/* ── Chat bubbles ───────────────────────────────── */
.chat-bubble-container {
    display: flex;
}

.chat-bubble-container--user {
    justify-content: flex-end;
}

.chat-bubble-container--assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 75%;
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.chat-bubble--user {
    background: var(--accent-fill-rest, #8B5A2B);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-bubble--assistant {
    background: var(--neutral-fill-rest, #f0f0f0);
    border-bottom-left-radius: 4px;
}

.chat-role-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 4px;
}

.chat-content {
    font-family: var(--font-myanmar);
}

.chat-sources {
    margin-top: 4px;
}

/* ── Summary content ────────────────────────────── */
.summary-content {
    font-family: var(--font-myanmar);
    line-height: 1.8;
    font-size: 0.9375rem;
}

    .summary-content p {
        margin: 0 0 1em 0;
    }

/* ── Form validation (keep from template) ────────── */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

/* ── Browse page layout ────────────────────────── */
@media (min-width: 768px) {
    .browse-books-grid-item {
        padding-left: 8px;
    }
}
