/**
 * FCNC Chat Extended - Стили
 * Version: 1.0.0
 */

/* ============================================
   ГЛАВНЫЙ ГРАДИЕНТ (как у производителей)
   ============================================ */
:root {
    --fcnc-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --fcnc-primary: #667eea;
    --fcnc-secondary: #764ba2;
    --fcnc-success: #4caf50;
    --fcnc-danger: #f44336;
    --fcnc-warning: #ffc107;
}

/* ============================================
   ПАПКИ - ЛЕВАЯ ПАНЕЛЬ
   ============================================ */
.fcnc-chat-folders {
    padding: 15px;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
}

.fcnc-chat-folders-title {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding: 0 10px;
}

.fcnc-folder-item {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.fcnc-folder-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.fcnc-folder-item.active {
    background: var(--fcnc-gradient);
    color: #fff;
}

.fcnc-folder-item.active .fcnc-folder-icon,
.fcnc-folder-item.active .fcnc-folder-name,
.fcnc-folder-item.active .fcnc-folder-badge {
    color: #fff;
}

.fcnc-folder-icon {
    font-size: 20px;
    margin-right: 10px;
    min-width: 20px;
}

.fcnc-folder-name {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.fcnc-folder-badge {
    background: var(--fcnc-danger);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.fcnc-folder-item.active .fcnc-folder-badge {
    background: rgba(255, 255, 255, 0.3);
}

.fcnc-folder-actions {
    display: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.fcnc-folder-item:hover .fcnc-folder-actions {
    display: flex;
    gap: 5px;
}

.fcnc-folder-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.fcnc-folder-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* ============================================
   КАРТОЧНЫЙ ДИЗАЙН ПАПОК (3 в ряд)
   ============================================ */
.fcnc-folders-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

.fcnc-folder-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.fcnc-folder-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    border-color: var(--fcnc-primary);
}

.fcnc-folder-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.fcnc-folder-card-icon {
    font-size: 48px;
    line-height: 1;
}

.fcnc-folder-card-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.fcnc-folder-card:hover .fcnc-folder-card-actions {
    opacity: 1;
}

.fcnc-folder-card-actions .fcnc-folder-action-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    transition: all 0.2s ease;
}

.fcnc-folder-card-actions .fcnc-folder-edit-btn:hover {
    background: #e3f2fd;
    color: #1976d2;
}

.fcnc-folder-card-actions .fcnc-folder-delete-btn:hover {
    background: #ffebee;
    color: #d32f2f;
}

.fcnc-folder-card-body {
    margin-bottom: 12px;
}

.fcnc-folder-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
}

.fcnc-folder-card-count {
    font-size: 14px;
    color: #666;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fcnc-folder-card-count i {
    color: var(--fcnc-primary);
}

.fcnc-folder-card-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--fcnc-danger);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
}

/* Адаптивность для карточек */
@media (max-width: 1200px) {
    .fcnc-folders-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .fcnc-folders-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px;
        padding: 12px;
    }

    .fcnc-folder-card {
        padding: 16px;
    }

    .fcnc-folder-card-icon {
        font-size: 40px;
    }

    .fcnc-folder-card-title {
        font-size: 16px;
    }

    /* На мобильных кнопки всегда видны */
    .fcnc-folder-card-actions {
        opacity: 1;
    }
}

/* ============================================
   СОЗДАНИЕ ПАПКИ
   ============================================ */
.fcnc-create-folder-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    margin-top: 10px;
    background: transparent;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #666;
}

.fcnc-create-folder-btn:hover {
    border-color: var(--fcnc-primary);
    color: var(--fcnc-primary);
    background: rgba(102, 126, 234, 0.05);
}

/* ============================================
   ✅ УДАЛЕНО: МОДАЛЬНОЕ ОКНО ПАПКИ (заменено на форму в зоне чата)
   ============================================ */

/* ============================================
   ИКОНКИ ЭМОДЗИ
   ============================================ */
.fcnc-emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.fcnc-emoji-item {
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.fcnc-emoji-item:hover {
    background: #f5f5f5;
    transform: scale(1.2);
}

.fcnc-emoji-item.selected {
    background: var(--fcnc-gradient);
    transform: scale(1.2);
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */
@media (max-width: 768px) {
    .fcnc-chat-folders {
        padding: 10px;
    }
    
    .fcnc-folder-item {
        padding: 10px 8px;
    }
    
    .fcnc-folder-name {
        font-size: 14px;
    }
}

/* ============================================
   УВЕДОМЛЕНИЯ
   ============================================ */
.fcnc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    align-items: center;
    gap: 10px;
}

.fcnc-notification.show {
    display: flex;
    animation: slideInRight 0.3s ease;
}

.fcnc-notification.success {
    border-left: 4px solid var(--fcnc-success);
}

.fcnc-notification.error {
    border-left: 4px solid var(--fcnc-danger);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   МОДАЛЬНОЕ ОКНО "ПРИКРЕПИТЬ ФАЙЛ"
   ============================================
   
   ⚠️ ВНИМАНИЕ: CSS для модального окна находится в файле:
   wp-content/wp-recall/add-on/fcnc-chat-extended/templates/file-attach-modal.php
   (inline стили, строки 167-315)
   
   Не дублируем здесь, чтобы избежать конфликтов!
   ============================================ */

/* ============================================
   ИНФОРМАЦИОННЫЙ БЛОК О ХРАНЕНИИ ЧАТОВ
   ============================================ */
.fcnc-retention-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe9a3 100%);
    border-left: 5px solid #ffc107;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 16px 20px 16px;
    color: #856404;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fcncSlideIn 0.3s ease;
    position: relative; /* ✅ Для абсолютного позиционирования кнопки */
}

/* ✅ КНОПКА ЗАКРЫТИЯ */
.fcnc-notice-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(133, 100, 4, 0.1);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #856404;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 10;
}

.fcnc-notice-close:hover {
    background: rgba(133, 100, 4, 0.2);
    color: #735310;
    transform: scale(1.1);
}

.fcnc-notice-close:active {
    transform: scale(0.95);
}

.fcnc-retention-notice .notice-icon {
    flex-shrink: 0;
    color: #ffc107;
    font-size: 20px;
    margin-top: 2px;
}

.fcnc-retention-notice .notice-icon i {
    display: block;
}

.fcnc-retention-notice .notice-content {
    flex: 1;
    padding-right: 30px; /* ✅ Отступ для кнопки закрытия */
}

.fcnc-retention-notice strong {
    font-weight: 600;
    color: #735310;
}

/* Анимация появления */
@keyframes fcncSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .fcnc-retention-notice {
        font-size: 13px;
        padding: 14px 16px;
        margin: 12px;
    }
    
    .fcnc-retention-notice .notice-icon {
        font-size: 18px;
    }
}

/* ============================================
   КНОПКА УДАЛЕНИЯ ГРУППЫ
   ============================================ */
.fcnc-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    gap: 12px; /* ✅ Отступ между левой и правой частью */
}

.fcnc-group-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0; /* ✅ Позволяет text-overflow работать корректно */
    overflow: hidden; /* ✅ Скрываем выходящий за границы текст */
}

.fcnc-group-title {
    white-space: nowrap; /* ✅ Не переносим на новую строку */
    overflow: hidden; /* ✅ Обрезаем длинный текст */
    text-overflow: ellipsis; /* ✅ Добавляем троеточие */
    flex: 1; /* ✅ Занимаем всё доступное пространство */
    min-width: 0; /* ✅ Критично для text-overflow */
}

/* ============================================
   БЕЙДЖИ ГРУПП (Одиночный / Массовый)
   ============================================ */
.fcnc-group-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    flex-shrink: 0; /* ✅ Не сжимаем бейдж */
    white-space: nowrap;
}

.fcnc-badge-single {
    background: #e3f2fd;
    color: #1976d2;
}

.fcnc-badge-mass {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Старый бейдж счётчика (deprecated, оставлен для совместимости) */
.fcnc-contacts-badge {
    flex-shrink: 0;
    margin-left: 8px;
    display: none; /* ✅ Скрыт, т.к. используется .fcnc-group-badge */
}

.fcnc-group-actions {
    display: flex;
    flex-shrink: 0; /* ✅ КРИТИЧНО: Правая часть НЕ сжимается */
    min-width: 80px; /* ✅ Минимальная ширина для корзины + стрелки */
    align-items: center;
    gap: 12px;
}

.fcnc-delete-group-btn {
    background: transparent;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    opacity: 0;
}

.fcnc-broadcast-group:hover .fcnc-delete-group-btn {
    opacity: 1;
}

.fcnc-delete-group-btn:hover {
    background: #fee;
    color: #dc3545;
    transform: scale(1.1);
}

.fcnc-delete-group-btn:active {
    transform: scale(0.95);
}

/* Адаптивность: на мобильных кнопка всегда видна */
@media (max-width: 768px) {
    .fcnc-delete-group-btn {
        opacity: 1;
    }
}

