/* ===== Posts Tabs Pro – Frontend CSS ===== */

/* ── CSS Variables (overridden by inline style on nav) ── */
:root {
    --ptb-active-bg:  #3B82F6;
    --ptb-active-txt: #ffffff;
    --ptb-tab-bg:     #F3F4F6;
    --ptb-tab-txt:    #374151;
    --ptb-radius:     8px;
    --ptb-gap:        16px;
}

/* ════════════════════════════════
   NAV — shared base
════════════════════════════════ */
.ptb-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ptb-tabs-nav.ptb-align-center { justify-content: center; }
.ptb-tabs-nav.ptb-align-right  { justify-content: flex-end; }

.ptb-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    transition: background .18s, color .18s, border-color .18s, box-shadow .18s;
    background: var(--ptb-tab-bg);
    color: var(--ptb-tab-txt);
    border-radius: var(--ptb-radius);
}

.ptb-tab-btn.ptb-active,
.ptb-tab-btn:hover {
    background: var(--ptb-active-bg);
    color: var(--ptb-active-txt);
}

/* ── Style: Pills ── */
.ptb-style-pills .ptb-tab-btn { border-radius: 99px; }

/* ── Style: Underline ── */
.ptb-style-underline {
    border-bottom: 2px solid #e5e7eb;
    gap: 0;
}
.ptb-style-underline .ptb-tab-btn {
    background: transparent;
    color: var(--ptb-tab-txt);
    border-radius: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 10px 20px;
}
.ptb-style-underline .ptb-tab-btn.ptb-active,
.ptb-style-underline .ptb-tab-btn:hover {
    background: transparent;
    color: var(--ptb-active-bg);
    border-bottom-color: var(--ptb-active-bg);
}

/* ── Style: Boxed ── */
.ptb-style-boxed .ptb-tab-btn {
    border: 1.5px solid #e5e7eb;
    border-radius: var(--ptb-radius);
}
.ptb-style-boxed .ptb-tab-btn.ptb-active {
    border-color: var(--ptb-active-bg);
}

/* Tab icon */
.ptb-tab-icon { font-size: 15px; }

/* Tab badge */
.ptb-tab-badge {
    display: inline-block;
    background: #EF4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
    line-height: 1.5;
}

/* ════════════════════════════════
   CONTENT PANELS
════════════════════════════════ */
.ptb-tabs-content { position: relative; }

.ptb-tab-panel {
    display: none;
    animation: ptbFadeIn .25s ease;
}
.ptb-tab-panel.ptb-active { display: block; }

@keyframes ptbFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading overlay ── */
.ptb-tab-panel.ptb-loading .ptb-posts-wrap { opacity: .4; pointer-events: none; }
.ptb-tab-panel.ptb-loading::after {
    content: '';
    position: absolute;
    top: 40px; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--ptb-active-bg, #3B82F6);
    border-radius: 50%;
    animation: ptbSpin .7s linear infinite;
}
@keyframes ptbSpin { to { transform: translateX(-50%) rotate(360deg); } }

/* ════════════════════════════════
   POST GRID — columns
════════════════════════════════ */
.ptb-posts-wrap { width: 100%; }

.ptb-posts-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(var(--ptb-columns, 3), 1fr);
}

/* 1 col */
.ptb-cols-1 .ptb-posts-grid { grid-template-columns: 1fr; }
/* 2 col */
.ptb-cols-2 .ptb-posts-grid { grid-template-columns: repeat(2, 1fr); }
/* 3 col */
.ptb-cols-3 .ptb-posts-grid { grid-template-columns: repeat(3, 1fr); }
/* 4 col */
.ptb-cols-4 .ptb-posts-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .ptb-posts-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
    .ptb-posts-grid { grid-template-columns: 1fr !important; }
    .ptb-tabs-nav   { gap: 4px; }
    .ptb-tab-btn    { padding: 7px 12px; font-size: 13px; }
}

/* ════════════════════════════════
   TEMPLATE: CARD
════════════════════════════════ */
.ptb-post-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .2s;
}
.ptb-post-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.08); transform: translateY(-2px); }

.ptb-card-thumb {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}
.ptb-no-thumb {
    width: 100%; height: 180px;
    background: linear-gradient(135deg, #e0e7ff 0%, #f0fdf4 100%);
}

.ptb-card-body { padding: 14px 16px; display: flex; flex-direction: column; flex: 1; }
.ptb-meta { font-size: 11px; color: #6b7280; margin-bottom: 6px; }
.ptb-meta a { color: #6b7280; text-decoration: none; }
.ptb-post-title { font-size: 15px; font-weight: 600; margin: 0 0 8px; line-height: 1.4; }
.ptb-post-title a { color: inherit; text-decoration: none; }
.ptb-post-title a:hover { color: var(--ptb-active-bg, #3B82F6); }
.ptb-excerpt { font-size: 13px; color: #6b7280; line-height: 1.6; margin: 0 0 12px; flex: 1; }
.ptb-read-more { font-size: 13px; color: var(--ptb-active-bg, #3B82F6); text-decoration: none; font-weight: 500; }
.ptb-read-more:hover { text-decoration: underline; }

/* ════════════════════════════════
   TEMPLATE: LIST
════════════════════════════════ */
.ptb-template-list .ptb-posts-grid { grid-template-columns: 1fr !important; gap: 12px; }
.ptb-post-list {
    display: flex;
    gap: 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow .2s;
}
.ptb-post-list:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.ptb-post-list .ptb-thumb-link { flex-shrink: 0; }
.ptb-post-list .ptb-thumb { width: 130px; height: 100%; object-fit: cover; display: block; min-height: 90px; }
.ptb-post-list .ptb-post-body { padding: 14px 14px 14px 0; display: flex; flex-direction: column; justify-content: center; }
.ptb-post-list .ptb-post-title { font-size: 15px; }
.ptb-post-list .ptb-excerpt { font-size: 13px; }

/* ════════════════════════════════
   TEMPLATE: MINIMAL
════════════════════════════════ */
.ptb-template-minimal .ptb-posts-grid { gap: 0; }
.ptb-post-minimal {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: baseline;
    gap: 14px;
}
.ptb-post-minimal .ptb-meta { font-size: 11px; white-space: nowrap; min-width: 80px; }
.ptb-post-minimal .ptb-post-title { font-size: 14px; margin: 0; flex: 1; }
.ptb-post-minimal .ptb-author { font-size: 12px; color: #9ca3af; white-space: nowrap; }

/* ════════════════════════════════
   NO POSTS
════════════════════════════════ */
.ptb-no-posts {
    padding: 40px;
    text-align: center;
    color: #9ca3af;
    font-size: 15px;
    border: 1.5px dashed #e5e7eb;
    border-radius: 10px;
    margin: 8px 0;
}

/* ════════════════════════════════
   PAGINATION
════════════════════════════════ */
.ptb-pagination { margin-top: 28px; display: flex; justify-content: center; }

/* Numbers */
.ptb-pag-numbers { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; }
.ptb-pag-btn {
    min-width: 36px; height: 36px;
    padding: 0 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all .15s;
    display: inline-flex; align-items: center; justify-content: center;
}
.ptb-pag-btn:hover { border-color: var(--ptb-active-bg, #3B82F6); color: var(--ptb-active-bg, #3B82F6); }
.ptb-pag-btn.ptb-pag-active {
    background: var(--ptb-active-bg, #3B82F6);
    border-color: var(--ptb-active-bg, #3B82F6);
    color: #fff;
}
.ptb-pag-ellipsis { font-size: 14px; color: #9ca3af; padding: 0 4px; }
.ptb-pag-prev, .ptb-pag-next { font-size: 18px; }

/* Load More */
.ptb-load-more {
    display: block;
    margin: 0 auto;
    padding: 11px 32px;
    background: var(--ptb-active-bg, #3B82F6);
    color: #fff;
    border: none;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s;
}
.ptb-load-more:hover { filter: brightness(1.08); }
.ptb-load-more:disabled { opacity: .5; cursor: not-allowed; }

/* Infinite scroll sentinel */
.ptb-infinite-sentinel {
    height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.ptb-infinite-sentinel::after {
    content: '';
    width: 24px; height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--ptb-active-bg, #3B82F6);
    border-radius: 50%;
    animation: ptbSpin .7s linear infinite;
}
