/* ================================== */
/* ПАНЕЛИ ВЫБОРА ФАЙЛОВ (СКРЕПКА)    */
/* Десктопная и мобильная реализации  */
/* ================================== */

/* -------------------------------- */
/* 1. ОБЩИЕ СТИЛИ ДЛЯ ВКЛАДОК И КНОПКИ */
/* -------------------------------- */
.attach-desktop-tabs {
    display: flex;
    gap: 24px;
}

.attach-desktop-tab {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.attach-desktop-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

.attach-desktop-tab.active {
    color: var(--primary);
    background: rgba(76, 154, 255, 0.15);
}

.attach-desktop-action {
    display: flex;
    justify-content: center;
    margin-top: 16px;
    margin-bottom: 4px;
}

.attach-desktop-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: none;
    color: var(--primary);
    font-size: 24px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.attach-desktop-action-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

/* Светлая тема для общих элементов */
body.light-theme .attach-desktop-tab:hover {
    background: rgba(0, 0, 0, 0.05);
}
body.light-theme .attach-desktop-action-btn {
    background: rgba(0, 0, 0, 0.06);
}
body.light-theme .attach-desktop-action-btn:hover {
    background: var(--primary);
    color: white;
}

/* -------------------------------- */
/* 2. МОБИЛЬНАЯ ПАНЕЛЬ (нижний дровер) */
/* -------------------------------- */
.attach-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.attach-mobile-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 2001;
    animation: slideUp 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    padding: 16px 20px 30px;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.attach-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 16px;
}

.attach-mobile-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.attach-mobile-close:hover {
    color: var(--primary);
}

.attach-mobile-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    max-height: 60vh;
}

/* Сетка для медиа (3 колонки) */
.attach-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

/* Стили для элементов медиа и файлов (общие) */
.attach-media-item,
.attach-file-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.attach-media-item {
    aspect-ratio: 1 / 1;
    background: var(--bg-elevated);
    border-radius: 16px;
}
.attach-media-item img,
.attach-media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attach-video-thumb {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.attach-video-thumb i {
    position: absolute;
    font-size: 32px;
    color: white;
    text-shadow: 0 0 4px black;
}

/* Список файлов */
.attach-files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.attach-file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 12px;
}
.attach-file-info {
    flex: 1;
}
.attach-file-name {
    font-weight: 500;
}
.attach-file-size,
.attach-file-caption {
    font-size: 12px;
    color: var(--text-secondary);
}

.attach-mobile-loading,
.attach-mobile-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

/* Светлая тема для мобильной панели */
body.light-theme .attach-mobile-drawer {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.1);
}

/* -------------------------------- */
/* 3. ДЕСКТОПНАЯ ПАНЕЛЬ (выпадающий блок) */
/* -------------------------------- */
.attach-desktop-drawer {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    width: 440px;
    max-width: calc(100vw - 32px);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    z-index: 1100;
    overflow: hidden;
    animation: fadeSlideUp 0.2s ease;
    display: flex;
    flex-direction: column;
}

.attach-desktop-drawer .attach-mobile-header {
    padding: 12px 16px;
    margin-bottom: 0;
}
.attach-desktop-drawer .attach-mobile-content {
    padding: 12px 16px 16px;
    max-height: 460px;
}

/* Сетка на десктопе – 4 колонки */
.attach-desktop-drawer .attach-media-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
.attach-desktop-drawer .attach-files-list {
    gap: 10px;
    margin-bottom: 18px;
}
.attach-desktop-drawer .attach-file-item {
    padding: 10px 12px;
}

/* Светлая тема для десктопной панели */
body.light-theme .attach-desktop-drawer {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
}

/* -------------------------------- */
/* 4. УВЕЛИЧЕНИЕ ИКОНОК НА МОБИЛЬНЫХ */
/* -------------------------------- */
@media (max-width: 768px) {
    .attach-mobile-drawer .attach-desktop-tab {
        font-size: 28px;
        width: 48px;
        height: 48px;
        padding: 8px;
    }
    .attach-mobile-drawer .attach-desktop-action-btn {
        width: 56px;
        height: 56px;
        font-size: 32px;
    }
    .attach-mobile-drawer .attach-desktop-action {
        margin-top: 24px;
        margin-bottom: 8px;
    }
}

/* -------------------------------- */
/* 5. ВЫДЕЛЕНИЕ И ПАНЕЛЬ ДЕЙСТВИЙ, ЧЕКБОКСЫ */
/* -------------------------------- */
.attach-selection-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.attach-selection-count {
    font-size: 14px;
    font-weight: 500;
}
.attach-selection-buttons {
    display: flex;
    gap: 12px;
}

.attach-action-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}
.attach-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.attach-delete-btn:hover {
    color: #ff5e6b;
}

/* Чекбокс (круглый) – общие стили */
.attach-selection-checkbox {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    cursor: pointer;
    z-index: 15;
}
.attach-selection-checkbox i {
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 12px;
}
.attach-selection-checkbox i.fa-check-circle {
    opacity: 1;
    color: #4c9aff;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.attach-selection-checkbox:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Подсветка выделенного элемента */
.attach-media-item.selected,
.attach-file-item.selected {
    box-shadow: 0 0 0 2px var(--primary);
    filter: brightness(0.9);
}

/* Светлая тема для чекбоксов и панели действий */
body.light-theme .attach-selection-checkbox {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.4);
}
body.light-theme .attach-selection-checkbox i.fa-check-circle {
    color: var(--primary);
}
body.light-theme .attach-selection-actions {
    background: rgba(0, 0, 0, 0.05);
}
body.light-theme .attach-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}