/* Чат поддержки: плавающая кнопка и окно переписки. */

.support-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #5B7FF0, #7C9BFF);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(91, 127, 240, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.support-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(91, 127, 240, 0.45); }
.support-fab:active { transform: translateY(0); }

.support-fab-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #FF7373;
    display: none;
}

.support-fab.has-unread .support-fab-dot { display: inline-block; }

.support-panel {
    position: fixed;
    right: 24px;
    bottom: 88px;
    z-index: 901;
    width: min(360px, calc(100vw - 32px));
    max-height: min(520px, calc(100vh - 140px));
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(91, 127, 240, 0.25);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(9, 18, 46, 0.22);
    overflow: hidden;
}

.support-panel.open { display: flex; }

.support-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #5B7FF0, #7C9BFF);
    color: #fff;
}

.support-head strong { font-size: 15px; }
.support-head small { display: block; font-size: 12px; opacity: 0.85; font-weight: 500; }

.support-close {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.support-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #F6F8FF;
}

.support-msg {
    max-width: 84%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.support-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #5B7FF0, #7C9BFF);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.support-msg.admin {
    align-self: flex-start;
    background: #fff;
    color: #1B2440;
    border: 1px solid rgba(91, 127, 240, 0.18);
    border-bottom-left-radius: 4px;
}

.support-msg-time { display: block; margin-top: 4px; font-size: 11px; opacity: 0.7; }

.support-empty { color: #7B86A6; font-size: 13px; text-align: center; margin: auto 8px; }

.support-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(91, 127, 240, 0.2);
    background: #fff;
}

.support-form textarea {
    flex: 1;
    resize: none;
    height: 42px;
    max-height: 110px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(91, 127, 240, 0.3);
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    color: #1B2440;
}

.support-form textarea:focus { outline: none; border-color: #5B7FF0; }

.support-send {
    border: none;
    border-radius: 12px;
    padding: 0 16px;
    background: #5B7FF0;
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.support-send:disabled { opacity: 0.5; cursor: default; }

.support-note { padding: 0 12px 10px; font-size: 11px; color: #7B86A6; text-align: center; }

/* Тёмная тема */
html[data-theme="dark"] .support-panel {
    background: #0F1729;
    border-color: rgba(126, 152, 219, 0.35);
}

html[data-theme="dark"] .support-body { background: #0B1120; }
html[data-theme="dark"] .support-msg.admin {
    background: #16203A;
    color: #E8EDFB;
    border-color: rgba(126, 152, 219, 0.3);
}
html[data-theme="dark"] .support-form { background: #0F1729; border-top-color: rgba(126, 152, 219, 0.3); }
html[data-theme="dark"] .support-form textarea {
    background: #16203A;
    color: #E8EDFB;
    border-color: rgba(126, 152, 219, 0.35);
}
html[data-theme="dark"] .support-empty,
html[data-theme="dark"] .support-note { color: #93A2C4; }

@media (max-width: 480px) {
    .support-fab { right: 14px; bottom: 14px; padding: 12px 16px; }
    .support-panel { right: 12px; bottom: 76px; width: calc(100vw - 24px); }
}

.support-status {
    margin: 0;
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    color: #7B86A6;
    background: #EEF2FF;
    border-bottom: 1px solid rgba(91, 127, 240, 0.15);
}

html[data-theme="dark"] .support-status {
    color: #93A2C4;
    background: #16203A;
    border-bottom-color: rgba(126, 152, 219, 0.25);
}
