/* -----------------------------------------------------------------------------
   Stage 7 — локальные шрифты Roboto + Material Icons (wwwroot/fonts).
   Источник файлов: пакеты @fontsource/roboto и @fontsource/material-icons (jsDelivr),
   лицензии OFL — без внешних запросов к fonts.googleapis.com (CSP font-src 'self', офлайн).
   ----------------------------------------------------------------------------- */
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 300;
    font-stretch: 100%;
    font-display: swap;
    src: url('../fonts/roboto-latin-300-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-stretch: 100%;
    font-display: swap;
    src: url('../fonts/roboto-latin-400-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    font-stretch: 100%;
    font-display: swap;
    src: url('../fonts/roboto-latin-500-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-stretch: 100%;
    font-display: swap;
    src: url('../fonts/roboto-latin-700-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('../fonts/material-icons-latin-400-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html, body {
    font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#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;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBh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ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.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: #1b6ec2;
            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");
    }

code {
    color: #c02d76;
}

/* --- WebRTC: постоянный #webrtc-media-sink в MainLayout (см. webRtcInterop.js, ActiveCallOverlay) --- */
.bt-webrtc-media-sink {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 2px;
    height: 2px;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

body.bt-webrtc-call-video-active .bt-webrtc-media-sink {
    left: 50%;
    top: max(72px, 8vh);
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 24px));
    max-height: min(56vh, 520px);
    aspect-ratio: 4 / 3;
    height: auto;
    z-index: 2200;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

body.bt-webrtc-call-video-active #webrtc-remote-video {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
}

body.bt-webrtc-call-video-active #webrtc-local-video {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 28%;
    max-height: 40%;
    height: auto;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    object-fit: cover;
    z-index: 2;
}

/* --- Свайп: зоны touch на всю высоту контента (пустое место под списком тоже ловит жест) --- */
.bt-tabs-swipe-host,
.bt-chat-page-swipe-host,
.bt-bottom-nav-swipe-zone {
    min-height: calc(100dvh - 8.5rem);
    touch-action: pan-y;
}

.bt-tabs-swipe-host .mud-tabs-panels {
    flex: 1;
    min-height: 12rem;
}

/* --- Чат PWA: edge-to-edge, палитра Mud (--mud-palette-*) --- */
.bt-chat-page-swipe-host {
    margin: 0 -16px;
    display: flex;
    flex-direction: column;
}

/* Контент во вкладках MudTabPanel — без пустого блока .mud-tabs-panels (раньше min-height давал зазор). */
.bt-chat-page-swipe-host .mud-tabs-panels {
    flex: 1;
    min-height: 0;
    padding: 0;
}

.bt-chat-page-swipe-host .mud-tabs-tabbar {
    margin-bottom: 0;
}

.bt-chat-page-swipe-host .bt-chat-tab-panel,
.bt-chat-page-swipe-host .mud-tab-panel {
    padding: 0 !important;
}

.bt-chat-list.mud-list {
    padding-top: 0;
    margin-top: 0;
}

.bt-chat-thread-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    /* Родитель .bt-chat-page-swipe-host уже с margin -16px — повторный отриц. margin вылезал за экран. */
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}

.bt-chat-log {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px 8px;
    box-sizing: border-box;
    background: var(--mud-palette-background);
    border: none;
    border-radius: 0;
}

.bt-chat-reply-preview {
    flex-shrink: 0;
    border-top: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background-grey);
}

.bt-chat-bubble-row--reply-target .bt-chat-bubble {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* overflow: visible — popup @mention с bottom:100% не обрезается (иначе видна «полоска»). */
.bt-chat-composer {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 4px 6px;
    gap: 0 !important;
    overflow: visible;
    box-sizing: border-box;
    background: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
    position: relative;
    z-index: 5;
}

/* Обёртка поля ввода: поверх — popup автодополнения @ */
.bt-chat-composer-input-wrap {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}

.bt-chat-mention-popup {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    margin-bottom: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 30;
    padding: 4px 0;
}

.bt-chat-mention-item {
    padding: 6px 12px;
    cursor: pointer;
}

.bt-chat-mention-item:hover,
.bt-chat-mention-item--selected {
    background: var(--mud-palette-action-default-hover);
}

.bt-chat-mention-item-name {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.2;
}

.bt-chat-mention-item-sub {
    font-size: 0.75rem;
    opacity: 0.75;
    line-height: 1.2;
}

.bt-chat-composer .mud-input-control,
.bt-chat-composer .mud-input,
.bt-chat-composer .bt-chat-composer-field {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    margin: 0;
}

.bt-chat-composer.mud-stack {
    width: 100%;
}

.bt-chat-composer .mud-icon-button {
    flex-shrink: 0;
    margin: 0;
    padding: 8px;
}

.bt-chat-bubble .mud-stack {
    min-width: 0;
    max-width: 100%;
}

.bt-chat-bubble-row {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin-bottom: 6px;
    padding: 0;
    box-sizing: border-box;
}

.bt-chat-bubble-row--mine {
    justify-content: flex-end;
}

.bt-chat-bubble-row--theirs {
    justify-content: flex-start;
}

.bt-chat-bubble {
    max-width: 88%;
    min-width: 0;
    padding: 8px 12px;
    border-radius: 18px;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

.bt-chat-bubble--mine {
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

.bt-chat-bubble--theirs {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    box-shadow: 0 1px 1px var(--mud-palette-lines-default);
}

.bt-chat-bubble-meta {
    opacity: 0.85;
    font-size: 0.75rem;
    margin-bottom: 2px;
    flex-wrap: wrap;
    max-width: 100%;
}

.bt-chat-bubble--mine .bt-chat-bubble-meta {
    color: var(--mud-palette-primary-text);
}

/* Блок цитаты внутри пузыря (как MAX): вертикальная полоска + автор + текст */
.bt-chat-quote {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 6px;
    min-width: 0;
}

.bt-chat-quote-bar {
    flex-shrink: 0;
    width: 3px;
    border-radius: 2px;
    background: var(--mud-palette-primary);
}

.bt-chat-quote--mine .bt-chat-quote-bar {
    background: var(--mud-palette-primary-text);
    opacity: 0.85;
}

.bt-chat-quote-inner {
    flex: 1;
    min-width: 0;
}

.bt-chat-quote-author {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--mud-palette-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bt-chat-quote--mine .bt-chat-quote-author {
    color: var(--mud-palette-primary-text);
    opacity: 0.95;
}

.bt-chat-quote-text {
    font-size: 0.8125rem;
    line-height: 1.3;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.bt-chat-quote--theirs .bt-chat-quote-text {
    color: var(--mud-palette-text-secondary);
}

.bt-chat-quote--mine .bt-chat-quote-text {
    color: var(--mud-palette-primary-text);
    opacity: 0.8;
}

.bt-chat-bubble-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 4px;
    gap: 4px;
}

.bt-chat-bubble--mine .bt-chat-bubble-footer .bt-chat-bubble-time {
    color: var(--mud-palette-primary-text);
    opacity: 0.85;
    font-size: 0.75rem;
}

.bt-chat-bubble--theirs .bt-chat-bubble-footer .bt-chat-bubble-time {
    color: var(--mud-palette-text-secondary);
    font-size: 0.75rem;
}

.bt-chat-bubble-text {
    font-size: 0.95rem;
    line-height: 1.35;
}

.bt-chat-mention {
    font-weight: 600;
}

/* Deep link задачи в пузыре чата — кликабельный, in-app навигация */
.bt-chat-task-link {
    color: var(--mud-palette-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
    cursor: pointer;
}

.bt-chat-bubble--mine .bt-chat-task-link {
    color: inherit;
    opacity: 0.95;
}

.bt-chat-pending-chip {
    height: 20px !important;
}

.bt-chat-attachments {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.bt-chat-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.06);
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.bt-chat-bubble--mine .bt-chat-attachment {
    background: rgba(255, 255, 255, 0.15);
    color: inherit;
}

.bt-chat-attachment-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bt-chat-attachment-name {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bt-chat-attachment-size {
    font-size: 0.75rem;
    opacity: 0.75;
}

.bt-chat-thread-toolbar {
    margin-bottom: 0;
    min-height: unset;
}

.bt-chat-thread-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.bt-chat-mobile-thread {
    max-height: calc(100dvh - 200px);
    min-height: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.bt-chat-desktop-grid {
    min-height: calc(100dvh - 220px);
    align-items: stretch;
}

.bt-chat-list-col {
    max-height: calc(100dvh - 220px);
    overflow: auto;
}

.bt-chat-thread-col {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Список уведомлений в колокольчике: скролл внутри меню, не страницы */
.bt-notifications-menu-scroll {
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
