/* ---------------------------------- */
/* УТИЛИТЫ: запись, резервные стили  */
/* ---------------------------------- */

.recording-indicator-compact,
.recording-preview-compact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border-radius: 40px;
    padding: 4px 12px;
    margin-left: 8px;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}
.recording-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ff4444;
    animation: pulse 1s infinite;
}

/* Панель записи голоса */
.voice-recorder-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px 24px 0 0;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    z-index: 1050;
    animation: fadeSlideUp 0.25s ease;
}
.voice-recorder-panel-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.5;
}
.voice-recorder-panel-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 2;
    padding: 16px 0;
}
.voice-recorder-panel-visual {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.voice-recorder-panel-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.voice-recorder-panel-microphone {
    width: 70px;
    height: 70px;
    background: rgba(76, 154, 255, 0.65);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 0 20px rgba(76, 154, 255, 0.4);
    animation: micPulse 1.2s ease-in-out infinite;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.voice-recorder-panel-microphone i {
    font-size: 32px;
    color: white;
    text-shadow: 0 0 4px rgba(0,0,0,0.3);
}
.voice-recorder-panel-cancel {
    display: none;
}
.voice-recorder-panel-cancel-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    background: transparent;
    border-radius: 50%;
    overflow: hidden;
}
.voice-recorder-panel-red-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background: transparent;
    border-radius: 50%;
}
.voice-recorder-panel-cancel-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 0 12px rgba(220, 53, 69, 0.6);
    z-index: 2;
    position: relative;
    background-clip: padding-box;
}
.voice-recorder-panel-cancel-btn:hover {
    transform: scale(1.05);
    background: rgba(220, 53, 69, 1);
    box-shadow: 0 0 18px rgba(220, 53, 69, 0.8);
}
.voice-recorder-panel-cancel-btn:active {
    transform: scale(0.95);
}
.voice-recorder-panel-cancel:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}
@keyframes micPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76, 154, 255, 0.5); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 18px rgba(76, 154, 255, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(76, 154, 255, 0); }
}
.voice-recorder-cancel-icon {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    margin-top: 12px;
    background: transparent;
    padding: 6px;
    border-radius: 50%;
    display: inline-block;
}
.voice-recorder-cancel-icon:hover {
    color: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}
.voice-recorder-cancel-icon:active {
    transform: scale(0.95);
}

/* Резервный фон для браузеров без backdrop-filter */
@supports not (backdrop-filter: blur(5px)) {
    .voice-recorder-panel,
    .chat-header,
    .input-area,
    .message-bubble,
    .chats-panel {
        background: rgba(10, 15, 28, 0.95) !important;
    }
    body.light-theme .voice-recorder-panel,
    body.light-theme .chat-header,
    body.light-theme .input-area,
    body.light-theme .message-bubble,
    body.light-theme .chats-panel {
        background: rgba(242, 244, 248, 0.95) !important;
    }
}

/* Адаптация для сообщений – убираем фон для основных медиа-сообщений (но не для ответов!) */
.message:has(.image-message-container) .message-bubble,
.message:has(.custom-audio-player):not(:has(.reply-indicator-compact)) .message-bubble,
.message:has(.document-preview) .message-bubble,
.message:has(.file-preview-card) .message-bubble,
.message:has(.text-preview) .message-bubble,
.message:has(.file-upload-indicator) .message-bubble {
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}