/* =========================================================
   banki.ru — chat.css
   Личный чат
   ========================================================= */


/* =========================================================
   CHAT PANEL
   ========================================================= */

#chat-panel {
    position: relative;

    display: flex;
    flex-direction: column;

    width: 100%;
    min-height: 0;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(27, 73, 126, 0.16),
            transparent 42%
        ),
        #020b18;

    color: #f3f7ff;

    border: 1px solid rgba(79, 125, 183, 0.16);

    /* небольшое аккуратное закругление */
    border-radius: 16px 16px 0 0;

    box-sizing: border-box;
}


/* =========================================================
   NORMAL / EXPANDED
   ========================================================= */

#chat-panel.chat-expanded {
    position: fixed;

    /*
     * Оставляем хедер сверху.
     * 70px — рабочая зона под шапку приложения.
     */
    top: 70px;
    right: 0;
    bottom: 0;
    left: 0;

    z-index: 1000;

    width: 100%;
    height: auto;
    min-height: 0;

    border-radius: 16px 16px 0 0;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(27, 73, 126, 0.18),
            transparent 42%
        ),
        #020b18;

    box-shadow:
        0 -8px 30px rgba(0, 0, 0, 0.28);

    overflow: hidden;
}


/* =========================================================
   MAP WHEN CHAT EXPANDED
   ========================================================= */

#map-panel.map-hidden-by-chat,
#map.map-hidden-by-chat {
    visibility: hidden;
    pointer-events: none;
}


/* =========================================================
   CHAT HEADER
   ========================================================= */

.chat-header {
    position: relative;

    flex: 0 0 auto;

    display: flex;

    align-items: center;
    justify-content: space-between;

    min-height: 82px;

    padding:
        12px
        14px
        10px;

    border-bottom: 1px solid rgba(77, 123, 181, 0.14);

    background:
        linear-gradient(
            180deg,
            rgba(5, 20, 38, 0.98),
            rgba(3, 14, 28, 0.94)
        );

    box-sizing: border-box;
}


/* =========================================================
   CHAT HEADING
   ========================================================= */

.chat-heading {
    display: flex;

    align-items: center;

    gap: 10px;

    min-width: 0;
}


/* =========================================================
   CHAT ICON
   ========================================================= */

.chat-icon {
    flex: 0 0 auto;

    width: 42px;
    height: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 1px solid rgba(87, 139, 204, 0.24);

    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            rgba(25, 58, 95, 0.9),
            rgba(10, 30, 53, 0.9)
        );

    color: #b9d7fa;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 5px 14px rgba(0,0,0,0.16);
}


/* =========================================================
   CHAT KICKER / TITLE
   ========================================================= */

.chat-kicker {
    color: #7893b7;

    font-size: 12px;
    line-height: 1.1;
}

.chat-title {
    margin-top: 3px;

    color: #f3f7ff;

    font-size: 20px;
    line-height: 1.1;
    font-weight: 700;
}


/* =========================================================
   EXPAND BUTTON
   ========================================================= */

#chat-expand-button {
    position: relative;

    flex: 0 0 auto;

    width: 48px;
    height: 48px;

    margin-top: -4px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 1px solid rgba(88, 139, 202, 0.28);

    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            rgba(30, 60, 95, 0.92),
            rgba(12, 31, 53, 0.96)
        );

    color: #d9eaff;

    cursor: pointer;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 5px 14px rgba(0,0,0,0.2);

    -webkit-tap-highlight-color: transparent;
}

#chat-expand-button:active {
    transform: scale(0.94);
}


/* =========================================================
   PUSH NOTIFICATIONS BUTTON
   ========================================================= */

#chat-notifications-button {
    position: relative;

    flex: 0 0 auto;

    width: 48px;
    height: 48px;

    margin-top: -4px;
    margin-left: auto;
    margin-right: 6px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 1px solid rgba(88, 139, 202, 0.28);

    border-radius: 13px;

    background:
        linear-gradient(
            145deg,
            rgba(30, 60, 95, 0.92),
            rgba(12, 31, 53, 0.96)
        );

    color: #d9eaff;

    cursor: pointer;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 5px 14px rgba(0,0,0,0.2);

    -webkit-tap-highlight-color: transparent;
}

#chat-notifications-button:active {
    transform: scale(0.94);
}

#chat-notifications-button svg {
    display: block;
}

#chat-expand-icon {
    display: inline-flex;

    transition:
        transform 0.25s ease;
}

#chat-expand-icon.chat-expand-icon-open {
    transform: rotate(180deg);
}


/* =========================================================
   CHAT CONTENT
   ========================================================= */

#chat-content {
    position: relative;

    display: flex;
    flex-direction: column;

    flex: 1 1 auto;

    min-height: 0;

    width: 100%;

    overflow: hidden;
}

#chat-content.chat-locked {
    position: relative;
}


/* =========================================================
   AUTH PLACEHOLDER
   ========================================================= */

#chat-auth-placeholder {
    flex: 1;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-direction: column;

    gap: 18px;

    padding: 30px;

    text-align: center;

    color: #91a6c4;
}

#chat-auth-placeholder.hidden {
    display: none;
}

#chat-auth-placeholder button,
#chat-auth-button {
    min-height: 52px;

    padding: 0 24px;

    border: 1px solid rgba(100, 159, 232, 0.35);

    border-radius: 16px;

    background:
        linear-gradient(
            145deg,
            #286cc0,
            #1d4f91
        );

    color: #ffffff;

    font-size: 16px;
    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.25);
}


/* =========================================================
   ADMIN DIALOGS
   ========================================================= */

.chat-dialogs {
    flex: 0 0 auto;

    display: flex;

    gap: 8px;

    padding: 10px 12px;

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: none;

    border-bottom: 1px solid rgba(77, 123, 181, 0.14);

    background:
        rgba(4, 17, 33, 0.72);
}

.chat-dialogs::-webkit-scrollbar {
    display: none;
}

.chat-dialog {
    flex: 0 0 auto;

    min-width: 150px;
    max-width: 220px;

    padding: 11px 13px;

    display: flex;
    align-items: center;

    gap: 10px;

    border: 1px solid rgba(77, 124, 186, 0.18);

    border-radius: 15px;

    background:
        rgba(13, 34, 59, 0.78);

    color: #dceaff;

    text-align: left;

    cursor: pointer;
}

.chat-dialog.active {
    border-color: rgba(77, 148, 235, 0.7);

    background:
        linear-gradient(
            145deg,
            rgba(29, 76, 130, 0.95),
            rgba(13, 43, 76, 0.95)
        );

    box-shadow:
        0 0 18px rgba(46, 122, 225, 0.14);
}

.chat-dialog-info {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 3px;
}

.chat-dialog-name {
    overflow: hidden;

    color: #f2f6ff;

    font-size: 15px;
    font-weight: 700;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.chat-dialog-preview {
    overflow: hidden;

    color: #7890b0;

    font-size: 12px;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.chat-dialog-time {
    margin-left: auto;

    align-self: flex-start;

    color: #6f87a8;

    font-size: 11px;

    white-space: nowrap;
}

.chat-dialogs-empty {
    width: 100%;

    padding: 14px;

    color: #7187a5;

    text-align: center;

    font-size: 14px;
}


/* =========================================================
   TASK CARD
   ========================================================= */

#chat-task-card {
    position: relative;

    flex: 0 0 auto;

    margin: 0;

    padding: 14px 16px;

    border-bottom: 1px solid rgba(78, 126, 187, 0.18);

    background:
        linear-gradient(
            145deg,
            rgba(8, 27, 50, 0.98),
            rgba(4, 17, 33, 0.98)
        );

    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.16);
}

#chat-task-card.hidden {
    display: none;
}

.chat-task-card__top {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 12px;
}

.chat-task-card__title {
    min-width: 0;

    color: #f1f6ff;

    font-size: 17px;
    font-weight: 750;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-task-card__status {
    flex: 0 0 auto;

    display: inline-flex;

    align-items: center;

    gap: 6px;

    padding: 6px 9px;

    border: 1px solid rgba(98, 143, 199, 0.2);

    border-radius: 999px;

    background: rgba(25, 51, 82, 0.7);

    color: #a9c2df;

    font-size: 11px;
    font-weight: 700;

    white-space: nowrap;
}

.chat-task-card__status-dot {
    width: 7px;
    height: 7px;

    flex: 0 0 7px;

    border-radius: 50%;

    background: #6e8baa;

    box-shadow:
        0 0 8px rgba(110, 139, 170, 0.45);
}

.chat-task-card__status.is-pending {
    color: #e6c984;
}

.chat-task-card__status.is-pending
.chat-task-card__status-dot {
    background: #e0b84f;

    box-shadow:
        0 0 9px rgba(224, 184, 79, 0.45);
}

.chat-task-card__status.is-confirmed {
    color: #87c5ff;
}

.chat-task-card__status.is-confirmed
.chat-task-card__status-dot {
    background: #4c9cff;

    box-shadow:
        0 0 9px rgba(76, 156, 255, 0.5);
}

.chat-task-card__status.is-working {
    color: #78e0bd;
}

.chat-task-card__status.is-working
.chat-task-card__status-dot {
    background: #42c997;

    box-shadow:
        0 0 9px rgba(66, 201, 151, 0.5);
}

.chat-task-card__status.is-report-submitted {
    color: #a99cff;
}

.chat-task-card__status.is-report-submitted
.chat-task-card__status-dot {
    background: #8b78ff;

    box-shadow:
        0 0 9px rgba(139, 120, 255, 0.5);
}

.chat-task-card__bottom {
    display: flex;

    align-items: center;

    gap: 8px;

    margin-top: 10px;

    flex-wrap: wrap;
}

.chat-task-card__coordinates {
    flex: 1 1 auto;

    min-width: 0;

    color: #91a9c7;

    font-size: 14px;

    font-variant-numeric: tabular-nums;
}

.chat-task-card__copy,
.chat-task-card__open {
    flex: 0 0 auto;

    min-height: 34px;

    padding: 0 11px;

    border-radius: 10px;

    font-size: 12px;
    font-weight: 700;

    cursor: pointer;
}

.chat-task-card__copy {
    border: 1px solid rgba(90, 137, 195, 0.25);

    background:
        rgba(25, 48, 77, 0.8);

    color: #aac7e8;
}

.chat-task-card__open {
    border: 1px solid rgba(77, 145, 229, 0.4);

    background:
        linear-gradient(
            145deg,
            #286fc6,
            #20579a
        );

    color: #ffffff;
}

.chat-task-card__copy:active,
.chat-task-card__open:active {
    transform: scale(0.97);
}


/* =========================================================
   MESSAGES AREA
   ========================================================= */

#chat-messages {
    position: relative;

    flex: 1 1 auto;

    min-height: 0;

    width: 100%;

    display: flex;
    flex-direction: column;

    gap: 9px;

    padding: 14px 10px 18px;

    overflow-x: hidden;
    overflow-y: auto;

    scroll-behavior: smooth;

    scrollbar-width: thin;

    scrollbar-color:
        rgba(67, 112, 168, 0.5)
        transparent;
}

#chat-messages.hidden {
    display: none;
}

#chat-messages::-webkit-scrollbar {
    width: 4px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background:
        rgba(67, 112, 168, 0.5);
}


/* =========================================================
   EMPTY / ERROR
   ========================================================= */

.chat-empty {
    flex: 1;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 40px 20px;

    color: #627997;

    font-size: 15px;

    text-align: center;
}

.chat-error {
    align-self: center;

    max-width: calc(100% - 30px);

    padding: 10px 14px;

    border: 1px solid rgba(220, 94, 94, 0.25);

    border-radius: 12px;

    background:
        rgba(104, 35, 35, 0.72);

    color: #ffb0b0;

    font-size: 13px;

    text-align: center;
}


/* =========================================================
   MESSAGE ROW
   ========================================================= */

.chat-message {
    position: relative;

    display: flex;

    width: 100%;

    flex: 0 0 auto;

    touch-action: pan-y;
}

.chat-message-own {
    justify-content: flex-end;
}

.chat-message-other {
    justify-content: flex-start;
}

.chat-message-content {
    position: relative;

    max-width: min(78%, 560px);

    min-width: 0;

    display: flex;
    flex-direction: column;
}

.chat-message-own .chat-message-content {
    align-items: flex-end;
}

.chat-message-other .chat-message-content {
    align-items: flex-start;
}


/* =========================================================
   MESSAGE BUBBLE
   ========================================================= */

.chat-message-bubble {
    position: relative;

    max-width: 100%;

    padding: 11px 14px 8px;

    border: 1px solid rgba(79, 126, 188, 0.18);

    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            rgba(13, 34, 58, 0.96),
            rgba(8, 25, 45, 0.96)
        );

    color: #e9f1ff;

    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.14);

    overflow-wrap: anywhere;
    word-break: break-word;
}

.chat-message-own .chat-message-bubble {
    border-color: rgba(82, 157, 239, 0.32);

    border-bottom-right-radius: 6px;

    background:
        linear-gradient(
            145deg,
            #286fc7,
            #205a9f
        );

    box-shadow:
        0 6px 18px rgba(8, 38, 77, 0.32);
}

.chat-message-other .chat-message-bubble {
    border-bottom-left-radius: 6px;
}


/* =========================================================
   AUTHOR
   ========================================================= */

.chat-message-author {
    margin-bottom: 5px;

    color: #72aef3;

    font-size: 12px;
    font-weight: 700;
}

.chat-message-own .chat-message-author {
    color: rgba(255,255,255,0.78);
}


/* =========================================================
   MESSAGE TEXT
   ========================================================= */

.chat-message-text {
    white-space: pre-wrap;

    color: inherit;

    font-size: 16px;

    line-height: 1.4;

    overflow-wrap: anywhere;
    word-break: break-word;
}


/* =========================================================
   MESSAGE FOOTER / TIME
   ========================================================= */

.chat-message-footer {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    margin-top: 4px;
}

.chat-message-time {
    color: rgba(164, 186, 215, 0.65);

    font-size: 10px;

    line-height: 1;
}

.chat-message-own .chat-message-time {
    color: rgba(235, 246, 255, 0.65);
}


/* =========================================================
   REACTIONS
   ========================================================= */

.chat-message-reactions {
    display: flex;

    align-items: center;

    gap: 4px;

    margin-top: -5px;

    padding: 0 5px;

    z-index: 2;
}

.chat-reaction {
    min-height: 25px;

    padding: 2px 7px;

    border: 1px solid rgba(84, 132, 192, 0.22);

    border-radius: 999px;

    background:
        rgba(13, 31, 52, 0.96);

    color: #eaf2ff;

    font-size: 12px;

    cursor: pointer;

    box-shadow:
        0 3px 8px rgba(0,0,0,0.2);
}


/* =========================================================
   MESSAGE MENU
   ========================================================= */

.chat-message-menu {
    position: absolute;

    z-index: 100;

    left: 50%;
    bottom: calc(100% + 7px);

    transform: translateX(-50%);

    min-width: 190px;

    padding: 8px;

    border: 1px solid rgba(88, 138, 201, 0.28);

    border-radius: 16px;

    background:
        rgba(7, 22, 40, 0.98);

    box-shadow:
        0 14px 35px rgba(0,0,0,0.42);

    backdrop-filter: blur(18px);
}

.chat-menu-reactions {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 3px;

    padding-bottom: 7px;

    border-bottom: 1px solid rgba(81, 124, 180, 0.14);
}

.chat-menu-reaction {
    width: 30px;
    height: 30px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 0;

    border-radius: 9px;

    background: transparent;

    font-size: 18px;

    cursor: pointer;
}

.chat-menu-reaction:active {
    background: rgba(65, 112, 174, 0.2);
}

.chat-menu-copy {
    width: 100%;

    margin-top: 6px;

    min-height: 38px;

    border: 0;

    border-radius: 10px;

    background:
        rgba(26, 53, 84, 0.75);

    color: #dceaff;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}


/* =========================================================
   INPUT FORM
   ========================================================= */

#chat-input-form {
    position: relative;

    z-index: 20;

    flex: 0 0 auto;

    display: flex;

    align-items: center;

    gap: 9px;

    width: 100%;

    min-height: 88px;

    padding:
        10px 12px
        calc(10px + env(safe-area-inset-bottom));

    border-top: 1px solid rgba(74, 120, 180, 0.18);

    background:
        linear-gradient(
            180deg,
            rgba(4, 17, 32, 0.94),
            rgba(3, 13, 27, 0.99)
        );

    box-shadow:
        0 -8px 25px rgba(0, 0, 0, 0.18);

    box-sizing: border-box;
}

#chat-input-form.hidden {
    display: none;
}


/* =========================================================
   ATTACH BUTTON
   ========================================================= */

#attach-button {
    width: 62px;
    height: 62px;

    flex: 0 0 62px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 1px solid rgba(85, 133, 193, 0.25);

    border-radius: 19px;

    background:
        linear-gradient(
            145deg,
            #162f4e,
            #0d2139
        );

    color: #bdd7f7;

    font-size: 30px;

    cursor: pointer;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 6px 16px rgba(0,0,0,0.22);
}

#attach-button:active {
    transform: scale(0.95);
}


/* =========================================================
   HIDDEN FILE INPUT
   ========================================================= */

#chat-file-input {
    display: none;
}


/* =========================================================
   MESSAGE INPUT
   ========================================================= */

#chat-message-input {
    min-width: 0;

    flex: 1 1 auto;

    width: 100%;

    height: 62px;

    padding: 0 20px;

    border: 2px solid #286dcc;

    border-radius: 22px;

    outline: none;

    background:
        linear-gradient(
            145deg,
            #122b48,
            #0e243d
        );

    color: #f1f6ff;

    font-family: inherit;

    font-size: 18px;

    box-shadow:
        0 0 0 3px rgba(41, 111, 211, 0.12),
        inset 0 1px 0 rgba(255,255,255,0.03);

    box-sizing: border-box;
}

#chat-message-input::placeholder {
    color: #637c9d;
}

#chat-message-input:focus {
    border-color: #4b91ea;

    box-shadow:
        0 0 0 4px rgba(49, 124, 224, 0.16),
        0 0 20px rgba(40, 112, 216, 0.1);
}

#chat-message-input:disabled {
    opacity: 0.55;
}


/* =========================================================
   SEND BUTTON
   ========================================================= */

#send-button {
    width: 62px;
    height: 62px;

    flex: 0 0 62px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: 1px solid rgba(125, 187, 255, 0.3);

    border-radius: 19px;

    background:
        linear-gradient(
            145deg,
            #3b8ce8,
            #286bc0
        );

    color: #ffffff;

    font-size: 28px;

    cursor: pointer;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.16),
        0 7px 18px rgba(0,0,0,0.25);
}

#send-button:active {
    transform: scale(0.95);
}

#send-button:disabled {
    opacity: 0.5;

    cursor: default;

    transform: none;
}


/* =========================================================
   DESKTOP
   ========================================================= */

@media (min-width: 701px) {

    #chat-panel.chat-expanded {
        top: 70px;
    }

    #chat-panel.chat-expanded #chat-content {
        max-width: 900px;

        margin: 0 auto;

        width: 100%;
    }

    #chat-panel.chat-expanded #chat-input-form {
        width: 100%;
    }

    .chat-message-content {
        max-width: 65%;
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    #chat-panel {
        border-radius: 16px 16px 0 0;
    }

    #chat-panel.chat-expanded {
        top: 70px;
        right: 0;
        bottom: 0;
        left: 0;

        height: auto;
        min-height: 0;

        border-radius: 16px 16px 0 0;
    }

    .chat-header {
        min-height: 78px;

        padding:
            9px 11px
            8px;
    }

    .chat-icon {
        width: 40px;
        height: 40px;

        border-radius: 12px;
    }

    .chat-title {
        font-size: 19px;
    }

    #chat-expand-button {
        width: 46px;
        height: 46px;

        margin-top: -5px;

        border-radius: 12px;
    }

    #chat-messages {
        padding-left: 9px;
        padding-right: 9px;

        padding-bottom: 14px;
    }

    .chat-message-content {
        max-width: 82%;
    }

    .chat-message-text {
        font-size: 16px;
    }

    .chat-task-card__title {
        font-size: 16px;
    }

    .chat-task-card__coordinates {
        font-size: 13px;
    }

    #chat-input-form {
        min-height: 82px;

        padding-left: 10px;
        padding-right: 10px;
    }

    #attach-button,
    #send-button {
        width: 58px;
        height: 58px;

        flex-basis: 58px;

        border-radius: 18px;
    }

    #chat-message-input {
        height: 58px;

        padding-left: 17px;
        padding-right: 17px;

        border-radius: 20px;

        font-size: 17px;
    }
}


/* =========================================================
   VERY SMALL SCREENS
   ========================================================= */

@media (max-width: 390px) {

    #chat-panel.chat-expanded {
        top: 68px;
    }

    .chat-header {
        min-height: 74px;
    }

    .chat-message-content {
        max-width: 87%;
    }

    .chat-task-card__top {
        align-items: flex-start;

        flex-direction: column;

        gap: 7px;
    }

    .chat-task-card__status {
        align-self: flex-start;
    }

    #attach-button,
    #send-button {
        width: 54px;
        height: 54px;

        flex-basis: 54px;
    }

    #chat-message-input {
        height: 54px;

        font-size: 16px;
    }
}


/* =========================================================
   SAFE AREA — ANDROID / IOS
   ========================================================= */

@supports (padding: env(safe-area-inset-bottom)) {

    #chat-input-form {
        padding-bottom:
            calc(
                10px +
                env(safe-area-inset-bottom)
            );
    }
}


/* =========================================================
   TOUCH
   ========================================================= */

button {
    -webkit-tap-highlight-color: transparent;
}

.chat-message,
.chat-message button {
    -webkit-tap-highlight-color: transparent;
}


#chat-panel.chat-expanded {
    top: 70px;
    right: 0;
    bottom: 0;
    left: 0;
}
