/* ═══════════════════════════════════════════════════════════════════
   pinned-articles.css — Блок закреплённых статей
   Цветовая схема сайта: #6366f1 / #747bf5
   ═══════════════════════════════════════════════════════════════════ */

/* ── Секция-обёртка ──────────────────────────────────────────────── */
.pinned-articles-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: linear-gradient(135deg, rgba(99,102,241,0.06) 0%, rgba(113,115,233,0.03) 100%);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: 8px;
    padding: 12px 14px 14px;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

/* Декоративная полоса слева */
.pinned-articles-section::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #6366f1 0%, #a5b4fc 100%);
    border-radius: 3px 0 0 3px;
}

/* ── Заголовок ───────────────────────────────────────────────────── */
.pinned-articles-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.pinned-articles-header .pin-header-icon {
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.6rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
}

.pinned-articles-header h2,
.pinned-articles-header h3 {
    font-size: 0.68rem;
    font-weight: 700;
    color: #4338ca;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

/* Счётчик */
#pinned-count-badge {
    margin-left: auto;
    font-size: 0.62rem;
    font-weight: 600;
    background: rgba(99,102,241,0.12);
    color: #6366f1;
    border-radius: 20px;
    padding: 1px 8px;
    border: 1px solid rgba(99,102,241,0.2);
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

#pinned-count-badge.is-full {
    background: rgba(245,158,11,0.12);
    color: #b45309;
    border-color: rgba(245,158,11,0.3);
}

/* ── Сетка карточек ──────────────────────────────────────────────── */
.pinned-articles-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    max-width: 100%;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(99,102,241,0.3) transparent;
}

.pinned-articles-grid::-webkit-scrollbar { height: 3px; }
.pinned-articles-grid::-webkit-scrollbar-thumb {
    background: rgba(99,102,241,0.35);
    border-radius: 3px;
}

/* Пустой текст */
.pinned-empty-msg {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 0;
    padding: 8px 0;
    font-style: italic;
}

/* ── Карточка ────────────────────────────────────────────────────── */
.pinned-card {
    flex: 0 0 125px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(99,102,241,0.15);
    overflow: hidden;
    text-decoration: none !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s;
    position: relative;
    min-width: 110px;
    max-width: 145px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Верхняя цветная полоска на карточке */
.pinned-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a5b4fc);
    opacity: 0;
    transition: opacity 0.2s;
}

/* Изображение */
.pinned-card-img {
    width: 100%;
    height: 70px;
    overflow: hidden;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pinned-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99,102,241,0.12);
    border-color: rgba(99,102,241,0.3);
}

.pinned-card:hover::after {
    opacity: 1;
}

.pinned-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.pinned-card:hover .pinned-card-thumb {
    transform: scale(1.03);
}

.pinned-card-no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #a5b4fc;
    font-size: 1.4rem;
}

/* Тело карточки */
.pinned-card-body {
    padding: 8px 9px 7px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: relative;
}

/* Булавка-бейдж */
.pinned-label {
    position: absolute;
    top: -10px;
    right: 8px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    box-shadow: 0 2px 5px rgba(99,102,241,0.35);
}

/* Заголовок */
.pinned-card-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pinned-card-author {
    font-size: 0.6rem;
    color: #94a3b8;
    margin-top: auto;
    padding-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid #f1f5f9;
}

/* ── Кнопка Pin в dropdown карточки ─────────────────────────────── */
.pin-article-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 8px 14px !important;
    min-height: 38px !important;
    border: none !important;
    background: transparent !important;
    color: #475569 !important;
    cursor: pointer !important;
    transition: background 0.15s, color 0.15s !important;
    white-space: nowrap !important;
    text-align: left !important;
    border-top: 1px solid #f1f5f9 !important;
    box-sizing: border-box !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    border-radius: 0 !important;
    text-decoration: none !important;
}

.pin-article-btn .pin-icon,
.pin-article-btn .fa-thumbtack {
    color: #94a3b8;
    font-size: 0.85rem;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.pin-article-btn .pin-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pin-article-btn:hover {
    background: #eef2ff !important;
    color: #6366f1 !important;
}

.pin-article-btn.is-pinned {
    background: #fef9c3 !important;
    color: #b45309 !important;
}

.pin-article-btn.is-pinned .fa-thumbtack,
.pin-article-btn.is-pinned .pin-icon .fa-thumbtack {
    color: #b45309;
}

.pin-article-btn.is-pinned:hover {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.pin-article-btn.loading {
    opacity: 0.55;
    pointer-events: none;
}

/* ── Кастомное окно подтверждения открепления ───────────────────────── */
.pin-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}
.pin-confirm-box {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    min-width: 320px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    text-align: center;
}
.pin-confirm-box h3 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    color: #1e293b;
}
.pin-confirm-box p {
    margin: 0 0 22px;
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.5;
}
.pin-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.pin-confirm-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.pin-confirm-btn--cancel {
    background: #f1f5f9;
    color: #475569;
}
.pin-confirm-btn--cancel:hover { background: #e2e8f0; }
.pin-confirm-btn--confirm {
    background: #ef4444;
    color: #fff;
}
.pin-confirm-btn--confirm:hover { background: #dc2626; }

.pin-article-btn .pin-icon {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
}

/* ── Toast уведомление ───────────────────────────────────────────── */
.pin-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(14px);
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.83rem;
    font-weight: 500;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.pin-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.pin-toast--success { background: linear-gradient(135deg, #059669, #10b981); }
.pin-toast--error   { background: linear-gradient(135deg, #dc2626, #ef4444); }

/* ── Мобильная адаптация ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .pinned-articles-section {
        margin-left: 0;
        margin-right: 0;
        border-radius: 10px;
        padding: 10px 12px 12px;
    }

    .pinned-articles-grid {
        gap: 6px;
    }

    .pinned-card {
        flex: 0 0 108px;
        min-width: 100px;
        max-width: 130px;
    }

    .pinned-card-img { height: 60px; }

    .pinned-card-title {
        font-size: 0.66rem;
        -webkit-line-clamp: 2;
    }

    .pinned-card-author { font-size: 0.58rem; }
}

@media (max-width: 480px) {
    .pinned-articles-section { padding: 9px 10px 10px; }

    .pinned-articles-header h2,
.pinned-articles-header h3 { font-size: 0.62rem; }

    .pinned-card {
        flex: 0 0 98px;
        min-width: 92px;
    }
    .pinned-card-img { height: 52px; }
    .pinned-card-body { padding: 6px 7px 5px; }
    .pinned-card-title { font-size: 0.62rem; }
    .pinned-card-author { font-size: 0.56rem; }
}

/* ── Лейбл "Закреплено" в карточке статьи (index.php) ─────────────── */
.pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fef3c7;
    color: #b45309;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #fde68a;
    margin-left: 0;
    white-space: nowrap;
    min-width: 68px;
    text-align: center;
}

.pinned-badge i {
    font-size: 0.75rem;
}

/* Мобильная версия — скрыть текст "Закреплено", оставить только иконку */
@media (max-width: 868px) {
    .article-meta-item.pinned-badge .pinned-badge-text {
        display: none !important;
    }
    .article-meta-item.pinned-badge {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        margin-left: 4px !important;
        font-size: 0 !important;
        min-width: 24px !important;
        text-align: center !important;
    }
}
