/* ============================================================
   ROOT — Современная нейтральная палитра
   ============================================================ */
:root {
    --card-bg: #ffffff;
    --card-border: #eef0f2;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
    --card-radius: 14px;
    
    --text-primary: #0a0a0f;
    --text-secondary: #5a5a6e;
    --text-tertiary: #8e8ea3;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: rgba(37, 99, 235, 0.06);
    
    --status-online: #22c55e;
    --status-offline: #a1a1b5;
}

/* ============================================================
   1. КАРТОЧКА
   ============================================================ */
.fb-kard {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef0f2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
    transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1),
                box-shadow 0.3s ease,
                border-color 0.2s ease;
    display: flex;
    flex-direction: column;

    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.fb-kard:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(0, 0, 0, 0.04);
    border-color: #d5d7e0;
}

/* ============================================================
   2. ШАПКА КАРТОЧКИ
   ============================================================ */
.fb-post-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px 10px;
    position: relative;
}

/* ---- 2a. АВАТАР ---- */
.fb-post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: opacity 0.2s ease;
    background: #f1f3f5;
}

.fb-post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fb-post-avatar:hover {
    opacity: 0.9;
}

.fb-post-avatar .online-status {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: #a1a1b5;
    transition: background 0.25s ease;
}

.fb-post-avatar .online-status.online {
    background: #22c55e;
}

.fb-post-avatar .online-status.away {
    background: #f59e0b;
}

/* ---- 2b. ИНФОРМАЦИЯ ОБ АВТОРЕ ---- */
.fb-post-user {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.fb-post-user .user-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    cursor: pointer;
    font-size: 15px;
    font-weight: 650;
    color: #0a0a0f;
    line-height: 1.35;
    transition: color 0.2s ease;
    letter-spacing: -0.01em;
}

.fb-post-user .user-name:hover {
    color: #2563eb;
}

/* ---- 2c. БЕЙДЖ РОЛИ ---- */
.fb-post-user .role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 550;
    padding: 1px 10px 1px 8px;
    border-radius: 100px;
    background: rgba(37, 99, 235, 0.06);
    color: #2563eb;
    letter-spacing: 0.2px;
    border: none;
    line-height: 20px;
    transition: background 0.2s ease;
}

.fb-post-user .role-badge:hover {
    background: rgba(37, 99, 235, 0.10);
}

.fb-post-user .role-badge.admin {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.06);
}

.fb-post-user .role-badge.moderator {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.06);
}

.fb-post-user .role-badge.premium {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.06);
}

.fb-post-user .role-badge.editor {
    color: #0891b2;
    background: rgba(8, 145, 178, 0.06);
}

/* ---- 2d. МЕТА-ДАННЫЕ ---- */
.fb-post-user .post-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #8e8ea3;
    margin-top: 1px;
    letter-spacing: -0.01em;
}

.fb-post-user .post-meta time {
    color: #8e8ea3;
    transition: color 0.2s ease;
}

.fb-post-user .post-meta time:hover {
    color: #5a5a6e;
}

.fb-post-user .post-meta .meta-separator {
    color: #d0d2db;
    font-size: 10px;
    line-height: 1;
    user-select: none;
}

.fb-post-user .post-meta .meta-location,
.fb-post-user .post-meta .meta-privacy {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #8e8ea3;
}

.fb-post-user .post-meta .meta-location svg,
.fb-post-user .post-meta .meta-privacy svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    stroke: #8e8ea3;
    fill: none;
}

/* ---- 2e. МЕНЮ (троеточие) ---- */
.fb-post-menu {
    flex-shrink: 0;
    margin-left: auto;
    position: relative;
    padding-top: 1px;
}

.fb-post-menu .menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #8e8ea3;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fb-post-menu .menu-btn:hover {
    background: #f1f3f5;
    color: #0a0a0f;
}

.fb-post-menu .menu-btn:active {
    transform: scale(0.92);
}

.fb-post-menu .menu-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---- 2f. ВЫПАДАЮЩЕЕ МЕНЮ ---- */
.fb-post-menu .dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);
    padding: 6px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    z-index: 100;
}

.fb-post-menu .dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.fb-post-menu .dropdown-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 450;
    color: #0a0a0f;
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    font-family: inherit;
}

.fb-post-menu .dropdown-menu .menu-item:hover {
    background: #f5f6f8;
}

.fb-post-menu .dropdown-menu .menu-item.danger {
    color: #dc2626;
}

.fb-post-menu .dropdown-menu .menu-item.danger:hover {
    background: #fef2f2;
}

.fb-post-menu .dropdown-menu .menu-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fb-post-menu .dropdown-menu .menu-divider {
    height: 1px;
    background: #eef0f2;
    margin: 4px 12px;
}

/* ============================================================
   3. КОНТЕНТ КАРТОЧКИ
   ============================================================ */
.fb-post-content {
    padding: 0 18px 12px;
    flex: 1;
    min-height: 80px;
    display: flex;
    flex-direction: column;
}

.fb-post-content h3 {
    font-size: 16px;
    font-weight: 650;
    color: #0a0a0f;
    margin: 0 0 4px;
    line-height: 1.45;
    letter-spacing: -0.01em;
    min-height: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: break-word;
}

.fb-post-content p {
    font-size: 14px;
    color: #5a5a6e;
    line-height: 1.6;
    margin: 0;
    min-height: 22px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: break-word;
}

.fb-post-content .read-more {
    color: #2563eb;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.fb-post-content .read-more:hover {
    color: #1d4ed8;
}

/* ============================================================
   4. ИЗОБРАЖЕНИЕ
   ============================================================ */
.fb-post-image {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
    overflow: hidden;
    background: #f1f3f5;
}

.fb-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.fb-post-image:hover {
    opacity: 0.92;
}

.fb-post-image .photo-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

.fb-post-image .photo-count svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ============================================================
   5. ДЕЙСТВИЯ КАРТОЧКИ
   ============================================================ */
.fb-post-actions {
    display: flex;
    align-items: stretch;
    padding: 4px 8px 8px;
    gap: 4px;
    border-top: 1px solid #eef0f2;

    flex-shrink: 0;
    margin-top: auto;
}

.fb-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    color: #5a5a6e;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    background: transparent;
    border: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
}

.fb-action-btn:hover {
    background: #f5f6f8;
    color: #0a0a0f;
}

.fb-action-btn svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s ease;
}

.fb-action-btn:hover svg {
    transform: scale(1.05);
}

.fb-action-btn .count {
    font-size: 12px;
    color: #8e8ea3;
    font-weight: 450;
    transition: color 0.2s ease;
}

.fb-action-btn:hover .count {
    color: #5a5a6e;
}

/* Активный лайк */
.fb-action-btn.liked {
    color: #2563eb;
}

.fb-action-btn.liked svg {
    fill: #2563eb;
    stroke: #2563eb;
}

.fb-action-btn.liked .count {
    color: #2563eb;
}

/* ============================================================
   6. GRID
   ============================================================ */
.fb-grid,
.fb-materials-grid {
display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 5px;
    margin-top: 16px;
}

/* ============================================================
   7. RESPONSIVE
   ============================================================ */

/* Планшет */
@media (max-width: 1024px) {
    .fb-grid,
    .fb-materials-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Мобильный */
@media (max-width: 768px) {
    .fb-post-header {
        padding: 14px 14px 8px;
        gap: 12px;
    }
    
    .fb-post-avatar {
        width: 40px;
        height: 40px;
    }
    
    .fb-post-avatar .online-status {
        width: 11px;
        height: 11px;
        border-width: 2px;
    }
    
    .fb-post-user .user-name {
        font-size: 14px;
    }
    
    .fb-post-user .role-badge {
        font-size: 10px;
        padding: 0 8px 0 6px;
        line-height: 18px;
    }
    
    .fb-post-user .post-meta {
        font-size: 11px;
        gap: 3px;
    }
    
    .fb-post-user .post-meta .meta-separator {
        font-size: 8px;
    }
    
    .fb-post-user .post-meta .meta-location,
    .fb-post-user .post-meta .meta-privacy {
        gap: 2px;
    }
    
    .fb-post-user .post-meta .meta-location svg,
    .fb-post-user .post-meta .meta-privacy svg {
        width: 11px;
        height: 11px;
    }
    
    .fb-post-content {
        padding: 0 14px 10px;
    }
    
    .fb-post-content h3 {
        font-size: 15px;
    }
    
    .fb-post-content p {
        font-size: 13px;
    }
    
    .fb-post-image {
        min-height: 150px;
    }
    
    .fb-post-actions {
        padding: 3px 6px 6px;
        gap: 3px;
    }
    
    .fb-action-btn {
        padding: 6px 8px;
        font-size: 12px;
        gap: 4px;
    }
    
    .fb-action-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .fb-action-btn .count {
        font-size: 11px;
    }
    
    .fb-post-menu .menu-btn {
        width: 30px;
        height: 30px;
    }
    
    .fb-post-menu .menu-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Маленький мобильный */
@media (max-width: 480px) {
    .fb-grid,
    .fb-materials-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .fb-kard {
        border-radius: 12px;
    }
    
    .fb-post-header {
        padding: 12px 12px 6px;
        gap: 10px;
    }
    
    .fb-post-avatar {
        width: 36px;
        height: 36px;
    }
    
    .fb-post-avatar .online-status {
        width: 10px;
        height: 10px;
        border-width: 1.5px;
    }
    
    .fb-post-user .user-name {
        font-size: 13px;
        gap: 4px;
    }
    
    .fb-post-user .role-badge {
        font-size: 9px;
        padding: 0 6px 0 5px;
        line-height: 16px;
        gap: 3px;
    }
    
    .fb-post-user .post-meta {
        font-size: 10px;
        gap: 2px;
    }
    
    .fb-post-user .post-meta .meta-separator {
        font-size: 7px;
    }
    
    .fb-post-user .post-meta .meta-location,
    .fb-post-user .post-meta .meta-privacy {
        gap: 2px;
    }
    
    .fb-post-user .post-meta .meta-location svg,
    .fb-post-user .post-meta .meta-privacy svg {
        width: 10px;
        height: 10px;
    }
    
    .fb-post-content {
        padding: 0 12px 8px;
    }
    
    .fb-post-content h3 {
        font-size: 14px;
    }
    
    .fb-post-content p {
        font-size: 12px;
        line-height: 1.5;
    }
    
    .fb-post-image {
        min-height: 120px;
    }
    
    .fb-post-image .photo-count {
        font-size: 10px;
        padding: 2px 10px;
        bottom: 8px;
        right: 8px;
    }
    
    .fb-post-image .photo-count svg {
        width: 12px;
        height: 12px;
    }
    
    .fb-post-actions {
        padding: 2px 4px 4px;
        gap: 2px;
    }
    
    .fb-action-btn {
        padding: 5px 4px;
        font-size: 10px;
        gap: 3px;
        border-radius: 6px;
    }
    
    .fb-action-btn span:not(.count) {
        display: none;
    }
    
    .fb-action-btn .count {
        font-size: 10px;
        margin-left: 0;
    }
    
    .fb-action-btn svg {

    }
    
    .fb-post-menu .menu-btn {
        width: 28px;
        height: 28px;
    }
    
    .fb-post-menu .menu-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .fb-post-menu .dropdown-menu {
        min-width: 160px;
        right: -8px;
    }
    
    .fb-post-menu .dropdown-menu .menu-item {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .fb-post-menu .dropdown-menu .menu-item svg {
        width: 14px;
        height: 14px;
    }
}


/* ============================================================
   УНИВЕРСАЛЬНЫЙ ИНДИКАТОР СООБЩЕНИЙ (TOAST)
   ============================================================ */

/* Контейнер для всех toast-уведомлений */
.edit-album-message-container,
.edit-news-message-container,
#edit-album-message-container,
#edit-news-message-container {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 10000 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
    pointer-events: none !important;
    max-width: 400px !important;
    width: auto !important;
}

/* Само сообщение */
.edit-album-header-message,
.edit-news-header-message {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    pointer-events: auto !important;
    animation: toastSlideIn 0.3s ease-out !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Типы сообщений */
.edit-album-header-message.success,
.edit-news-header-message.success {
    background: #f0fdf4 !important;
    color: #16a34a !important;
    border: 1px solid #bbf7d0 !important;
}

.edit-album-header-message.error,
.edit-news-header-message.error {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca !important;
}

.edit-album-header-message.info,
.edit-news-header-message.info {
    background: #f0f9ff !important;
    color: #0284c7 !important;
    border: 1px solid #bae6fd !important;
}

.edit-album-header-message.warning,
.edit-news-header-message.warning {
    background: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fcd34d !important;
}

/* Иконки */
.edit-album-header-message svg,
.edit-news-header-message svg {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
}

/* Анимация появления */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Анимация исчезновения */
@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Мобильная версия */
@media (max-width: 768px) {
    .edit-album-message-container,
    .edit-news-message-container,
    #edit-album-message-container,
    #edit-news-message-container {

        align-items: center !important;
    }
    
    .edit-album-header-message,
    .edit-news-header-message {
        font-size: 13px !important;
        padding: 10px 14px !important;
        max-width: 100% !important;
        
    }
}

@media (max-width: 480px) {
    .edit-album-message-container,
    .edit-news-message-container,
    #edit-album-message-container,
    #edit-news-message-container {
        bottom: 12px !important;
        right: 12px !important;
        left: 12px !important;
    }
    
    .edit-album-header-message,
    .edit-news-header-message {
        font-size: 12px !important;
        padding: 8px 12px !important;
    }
}