/* ===== ОБЩИЕ СТИЛИ ===== */
.feedback-floating-btn {
    position: fixed;
    bottom: 30px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    line-height: 1;
    min-width: 60px;
    min-height: 60px;
    background-color: #007bff; /* запасной цвет, переопределяется инлайн-стилем */
    right: 30px;
}
/* Псевдоэлемент для SVG-иконки чата (по умолчанию скрыт) */
.feedback-floating-btn::before {
    content: "";
    display: none;
    width: 28px;
    height: 28px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.feedback-floating-btn.position-left {
    right: auto;
    left: 30px;
}
.feedback-floating-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.feedback-floating-btn:active {
    transform: scale(0.95);
}
.feedback-floating-btn .feedback-btn-text {
    display: inline-block;
}
.feedback-badge {
    background: #ff3b30;
    color: #fff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
    line-height: 1.4;
    min-width: 20px;
    text-align: center;
    margin-left: 4px;
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.feedback-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeIn 0.25s ease;
}
.feedback-modal {
    background: #ffffff;
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}
.feedback-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid #e9edf2;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    background: #f8fafc;
}
.feedback-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
    padding: 0 4px;
}
.feedback-modal-close:hover {
    color: #ef4444;
}
.feedback-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ===== ФОРМА ===== */
.feedback-form .form-group {
    margin-bottom: 16px;
}
.feedback-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    color: #334155;
    font-size: 14px;
}
.feedback-form .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d9e6;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    background: #fff;
}
.feedback-form .form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.feedback-form textarea.form-control {
    resize: vertical;
    min-height: 100px;
}
.feedback-submit-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
}
.feedback-submit-btn:hover {
    background: #2563eb;
}
.feedback-submit-btn:active {
    transform: scale(0.97);
}
.math-captcha strong {
    color: #0f172a;
}

/* ===== ЧАТ ===== */
.feedback-chat {
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
}
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}
.chat-bubble {
    padding: 10px 16px;
    border-radius: 16px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}
.chat-bubble.user {
    background: #e0e7ff;
    color: #1e293b;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-bubble.admin {
    background: #f1f5f9;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.msg-admin-label {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #2563eb;
}
.msg-text {
    margin: 0;
}

/* ===== ОШИБКИ ===== */
.feedback-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
    display: none;
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== АДАПТИВНОСТЬ (планшеты) ===== */
@media (max-width: 768px) {
    .feedback-floating-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 18px;
        font-size: 14px;
        border-radius: 40px;
        min-width: 50px;
        min-height: 50px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    }
    .feedback-floating-btn.position-left {
        left: 20px;
        right: auto;
    }
    .feedback-btn-text {
        font-size: 13px;
    }
    .feedback-badge {
        font-size: 10px;
        padding: 1px 6px;
        min-width: 16px;
    }
    .feedback-modal {
        max-width: 100%;
        border-radius: 16px;
        max-height: 95vh;
    }
    .feedback-modal-header {
        padding: 14px 18px;
        font-size: 18px;
    }
    .feedback-modal-body {
        padding: 18px;
    }
    .feedback-form .form-control {
        font-size: 14px;
        padding: 8px 12px;
    }
    .feedback-submit-btn {
        font-size: 14px;
        padding: 10px 20px;
    }
}

/* ===== МОБИЛЬНЫЕ УСТРОЙСТВА (ширина ≤ 480px) ===== */
@media (max-width: 480px) {
    .feedback-floating-btn {
        padding: 10px;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        min-width: unset;
        min-height: unset;
        justify-content: center;
        right: 16px;
        bottom: 16px;
        gap: 0; /* убираем промежутки */
    }
    .feedback-floating-btn.position-left {
        left: 16px;
        right: auto;
    }
    /* Показываем иконку чата (SVG), скрываем текст */
    .feedback-floating-btn::before {
        display: block;
        width: 32px;
        height: 32px;
        /* SVG-иконка чата (белая) в виде data URI */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E");
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }
    /* Текст кнопки полностью скрыт */
    .feedback-floating-btn .feedback-btn-text {
        display: none !important; /* гарантированно скрываем */
    }
    .feedback-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        font-size: 10px;
        padding: 2px 6px;
        min-width: 18px;
        border-radius: 20px;
    }
    .feedback-modal {
        border-radius: 12px;
    }
    .feedback-modal-header {
        font-size: 16px;
        padding: 12px 14px;
    }
    .feedback-modal-body {
        padding: 14px;
    }
    .chat-bubble {
        font-size: 13px;
        padding: 8px 12px;
    }
}