/*
╔═══════════════════════════════════════════════════════════════════╗
║ BLOG ADMIN - Post-centric admin with inline comment drawers      ║
╚═══════════════════════════════════════════════════════════════════╝
*/

.blog-admin {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* ====================================================================
   HEADER
   ==================================================================== */

.ba-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--io-space-lg) var(--io-space-xl);
    border-bottom: 1px solid var(--io-border);
    flex-shrink: 0;
    gap: var(--io-space-lg);
    flex-wrap: wrap;
}

.ba-header-left {
    display: flex;
    align-items: center;
    gap: var(--io-space-md);
}

.ba-header-left h1 {
    font-size: var(--io-text-xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--io-space-sm);
    margin: 0;
}

.ba-header-left h1 i {
    color: var(--io-accent);
}

.ba-header-count {
    font-size: var(--io-text-sm);
    color: var(--io-text-tertiary);
}

.ba-header-right {
    display: flex;
    gap: var(--io-space-sm);
}

/* ====================================================================
   FILTERS BAR
   ==================================================================== */

.ba-filters {
    display: flex;
    gap: var(--io-space-md);
    padding: var(--io-space-md) var(--io-space-xl);
    border-bottom: 1px solid var(--io-border-subtle);
    flex-shrink: 0;
    align-items: center;
    flex-wrap: wrap;
}

.ba-chip {
    padding: var(--io-space-xs) var(--io-space-md);
    border: 1px solid var(--io-border);
    border-radius: var(--io-radius-sm);
    font-size: var(--io-text-xs);
    color: var(--io-text-secondary);
    cursor: pointer;
    transition: var(--io-transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
    font-family: var(--io-font-primary);
}

.ba-chip:hover {
    border-color: var(--io-accent);
    color: var(--io-text-primary);
}

.ba-chip.active {
    background: var(--io-accent);
    color: var(--io-on-accent);
    border-color: var(--io-accent);
}

.ba-filter-sep {
    width: 1px;
    height: 20px;
    background: var(--io-border);
}

.ba-search {
    background: var(--io-surface-sunken);
    border: 1px solid var(--io-border-subtle);
    border-radius: var(--io-radius-sm);
    padding: var(--io-space-xs) var(--io-space-md);
    color: var(--io-text-primary);
    font-family: var(--io-font-primary);
    font-size: var(--io-text-xs);
    width: 200px;
    transition: var(--io-transition-base);
}

.ba-search:focus {
    outline: none;
    border-color: var(--io-accent);
    box-shadow: 0 0 0 2px var(--io-accent-subtle);
}

.ba-search::placeholder {
    color: var(--io-text-tertiary);
}

.ba-deleted-toggle {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--io-space-sm);
    font-size: var(--io-text-xs);
    color: var(--io-text-tertiary);
    cursor: pointer;
    transition: var(--io-transition-fast);
    background: none;
    border: 1px solid var(--io-border-subtle);
    border-radius: var(--io-radius-sm);
    padding: var(--io-space-xs) var(--io-space-md);
    font-family: var(--io-font-primary);
}

.ba-deleted-toggle:hover {
    color: var(--io-error);
    border-color: var(--io-error);
}

.ba-deleted-toggle.active {
    color: var(--io-error);
    border-color: var(--io-error);
    background: var(--io-error-subtle);
}

.ba-deleted-toggle i {
    color: var(--io-error);
}

/* ====================================================================
   BULK ACTION BAR
   ==================================================================== */

.ba-bulk-bar {
    display: none;
    padding: var(--io-space-sm) var(--io-space-xl);
    background: var(--io-accent-subtle);
    border-bottom: 1px solid var(--io-accent);
    align-items: center;
    gap: var(--io-space-md);
    flex-shrink: 0;
}

.ba-bulk-bar.active {
    display: flex;
}

.ba-bulk-count {
    font-size: var(--io-text-sm);
    color: var(--io-accent);
    font-weight: 600;
}

/* ====================================================================
   BUTTONS (local)
   ==================================================================== */

.ba-btn {
    display: flex;
    align-items: center;
    gap: var(--io-space-sm);
    padding: var(--io-space-sm) var(--io-space-lg);
    border: none;
    border-radius: var(--io-radius-sm);
    font-family: var(--io-font-primary);
    font-size: var(--io-text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--io-transition-base);
    white-space: nowrap;
}

.ba-btn-primary {
    background: var(--io-accent);
    color: var(--io-on-accent);
}

.ba-btn-primary:hover {
    background: var(--io-accent-bright);
    box-shadow: var(--io-glow-sm);
}

.ba-btn-ghost {
    background: transparent;
    color: var(--io-text-secondary);
    border: 1px solid var(--io-border);
}

.ba-btn-ghost:hover {
    background: var(--io-surface-hover);
    color: var(--io-text-primary);
    border-color: var(--io-accent);
}

.ba-btn-sm {
    padding: var(--io-space-xs) var(--io-space-sm);
    font-size: var(--io-text-xs);
}

.ba-btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--io-border);
    border-radius: var(--io-radius-sm);
    color: var(--io-text-tertiary);
    cursor: pointer;
    transition: var(--io-transition-fast);
    font-size: var(--io-text-xs);
}

.ba-btn-icon:hover {
    border-color: var(--io-accent);
    color: var(--io-accent);
    background: var(--io-accent-subtle);
}

.ba-btn-icon.danger:hover {
    border-color: var(--io-error);
    color: var(--io-error);
    background: var(--io-error-subtle);
}

.ba-btn-icon.success:hover {
    border-color: var(--io-success);
    color: var(--io-success);
    background: var(--io-success-subtle);
}

/* ====================================================================
   TABLE
   ==================================================================== */

.ba-table-wrap {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.ba-table {
    width: 100%;
    border-collapse: collapse;
}

.ba-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--io-surface-sunken);
}

.ba-table th {
    padding: var(--io-space-sm) var(--io-space-md);
    text-align: left;
    font-size: var(--io-text-xs);
    font-weight: 600;
    color: var(--io-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--io-border);
    white-space: nowrap;
}

.ba-table td {
    padding: var(--io-space-md);
    border-bottom: 1px solid var(--io-border-subtle);
    vertical-align: middle;
}

/* ====================================================================
   POST ROW
   ==================================================================== */

.ba-post-row {
    transition: background var(--io-transition-fast);
    cursor: pointer;
}

.ba-post-row:hover {
    background: var(--io-surface-hover);
}

.ba-post-row.expanded {
    background: var(--io-surface-raised);
    border-bottom-color: var(--io-accent);
}

/* Title cell */
.ba-post-title-cell {
    display: flex;
    align-items: center;
    gap: var(--io-space-md);
    min-width: 0;
}

.ba-post-img {
    width: 48px;
    height: 48px;
    border-radius: var(--io-radius-sm);
    object-fit: cover;
    border: 1px solid var(--io-border-subtle);
    flex-shrink: 0;
}

.ba-post-img-ph {
    width: 48px;
    height: 48px;
    border-radius: var(--io-radius-sm);
    background: var(--io-surface-sunken);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--io-accent);
    font-size: var(--io-text-lg);
    flex-shrink: 0;
    border: 1px solid var(--io-border-subtle);
}

.ba-post-title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ba-post-title-text strong {
    font-size: var(--io-text-sm);
    color: var(--io-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
    display: block;
}

.ba-post-title-text span {
    font-size: var(--io-text-xs);
    color: var(--io-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
    display: block;
}

/* Chevron */
.ba-chevron {
    transition: transform var(--io-transition-base);
    color: var(--io-text-tertiary);
    font-size: var(--io-text-xs);
}

.ba-post-row.expanded .ba-chevron {
    transform: rotate(90deg);
    color: var(--io-accent);
}

/* Stat cell */
.ba-stat {
    display: flex;
    align-items: center;
    gap: var(--io-space-xs);
    color: var(--io-text-secondary);
    font-size: var(--io-text-xs);
    font-family: var(--io-font-mono);
}

.ba-stat i {
    color: var(--io-accent);
    font-size: 10px;
}

/* Category */
.ba-category {
    color: var(--io-text-secondary);
    font-size: var(--io-text-xs);
}

/* Date */
.ba-date {
    color: var(--io-text-secondary);
    font-size: var(--io-text-xs);
    white-space: nowrap;
}

/* Actions */
.ba-actions-cell {
    display: flex;
    gap: var(--io-space-xs);
}

/* ====================================================================
   BADGES
   ==================================================================== */

.ba-badges {
    display: flex;
    gap: var(--io-space-xs);
    flex-wrap: wrap;
}

.ba-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: var(--io-radius-sm);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ba-badge-published { background: var(--io-success-subtle); color: var(--io-success); }
.ba-badge-draft     { background: var(--io-warning-subtle); color: var(--io-warning); }
.ba-badge-private   { background: var(--io-error-subtle);   color: var(--io-error); }
.ba-badge-scheduled { background: var(--io-info-subtle);    color: var(--io-info); }
.ba-badge-pinned    { background: var(--io-accent-subtle);  color: var(--io-accent); }

/* ====================================================================
   COMMENTS DRAWER
   ==================================================================== */

.ba-drawer {
    display: none;
}

.ba-drawer.open {
    display: table-row;
}

.ba-drawer td {
    padding: 0;
    background: var(--io-surface-sunken);
    border-bottom: 2px solid var(--io-accent);
}

.ba-comments-panel {
    padding: var(--io-space-lg) var(--io-space-xl);
    max-height: 500px;
    overflow-y: auto;
}

.ba-comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--io-space-md);
}

.ba-comments-header h3 {
    font-size: var(--io-text-sm);
    color: var(--io-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--io-space-sm);
    margin: 0;
}

.ba-comments-header h3 i {
    color: var(--io-accent);
}

.ba-comments-filters {
    display: flex;
    gap: var(--io-space-sm);
}

/* ====================================================================
   COMMENT ITEM
   ==================================================================== */

.ba-comment {
    display: flex;
    gap: var(--io-space-md);
    padding: var(--io-space-md);
    border: 1px solid var(--io-border-subtle);
    border-radius: var(--io-radius-sm);
    margin-bottom: var(--io-space-sm);
    background: var(--io-surface-base);
    transition: var(--io-transition-fast);
}

.ba-comment:hover {
    border-color: var(--io-border);
    background: var(--io-surface-raised);
}

.ba-comment:last-child {
    margin-bottom: 0;
}

.ba-comment.deleted {
    opacity: 0.5;
    border-left: 3px solid var(--io-error);
}

.ba-comment.reply {
    margin-left: 32px;
    border-left: 2px solid var(--io-accent-subtle);
}

.ba-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--io-radius-sm);
    background: var(--io-accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--io-accent);
    font-size: var(--io-text-xs);
    font-weight: 700;
    flex-shrink: 0;
}

.ba-comment-body {
    flex: 1;
    min-width: 0;
}

.ba-comment-meta {
    display: flex;
    gap: var(--io-space-md);
    align-items: center;
    margin-bottom: var(--io-space-xs);
    flex-wrap: wrap;
}

.ba-comment-author {
    font-weight: 600;
    color: var(--io-text-primary);
    font-size: var(--io-text-xs);
}

.ba-comment-date {
    font-size: var(--io-text-xs);
    color: var(--io-text-tertiary);
}

.ba-comment-deleted-tag {
    font-size: 10px;
    color: var(--io-error);
    font-weight: 600;
    text-transform: uppercase;
}

.ba-comment-text {
    font-size: var(--io-text-sm);
    color: var(--io-text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ba-comment-reactions {
    display: flex;
    gap: var(--io-space-sm);
    margin-top: var(--io-space-xs);
}

.ba-comment-reaction {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border: 1px solid var(--io-border-subtle);
    border-radius: var(--io-radius-sm);
    font-size: 10px;
    color: var(--io-text-tertiary);
}

.ba-comment-actions {
    display: flex;
    flex-direction: column;
    gap: var(--io-space-xs);
    flex-shrink: 0;
}

/* ====================================================================
   COMMENTS EMPTY STATE
   ==================================================================== */

.ba-comments-empty {
    text-align: center;
    color: var(--io-text-tertiary);
    padding: var(--io-space-xl);
}

.ba-comments-empty i {
    font-size: 2rem;
    opacity: 0.3;
    margin-bottom: var(--io-space-sm);
    display: block;
}

/* ====================================================================
   LOADING / EMPTY STATES
   ==================================================================== */

.ba-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--io-space-lg);
    padding: var(--io-space-2xl);
    color: var(--io-text-tertiary);
}

.ba-loading i {
    font-size: 3rem;
    color: var(--io-accent);
}

.ba-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--io-space-lg);
    padding: var(--io-space-2xl);
    color: var(--io-text-tertiary);
}

.ba-empty i {
    font-size: 4rem;
    color: var(--io-accent);
    opacity: 0.3;
}

/* ====================================================================
   SCROLLBAR
   ==================================================================== */

.ba-table-wrap::-webkit-scrollbar,
.ba-comments-panel::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.ba-table-wrap::-webkit-scrollbar-track,
.ba-comments-panel::-webkit-scrollbar-track {
    background: var(--io-surface-sunken);
}

.ba-table-wrap::-webkit-scrollbar-thumb,
.ba-comments-panel::-webkit-scrollbar-thumb {
    background: var(--io-accent-subtle);
    border-radius: 3px;
}

.ba-table-wrap::-webkit-scrollbar-thumb:hover,
.ba-comments-panel::-webkit-scrollbar-thumb:hover {
    background: var(--io-accent);
}

/* ====================================================================
   CHECKBOX
   ==================================================================== */

.ba-table input[type="checkbox"] {
    accent-color: var(--io-accent);
}

/* ====================================================================
   RESPONSIVE
   ==================================================================== */

@media (max-width: 1200px) {
    .ba-post-title-text strong,
    .ba-post-title-text span {
        max-width: 240px;
    }
}

@media (max-width: 900px) {
    .ba-header {
        padding: var(--io-space-md) var(--io-space-lg);
    }

    .ba-filters {
        padding: var(--io-space-sm) var(--io-space-lg);
    }

    .ba-post-title-text strong,
    .ba-post-title-text span {
        max-width: 160px;
    }
    
    .ba-comment.reply {
        margin-left: 16px;
    }
}

@media (max-width: 768px) {
    .ba-header-right {
        width: 100%;
    }

    .ba-header-right .ba-btn {
        flex: 1;
        justify-content: center;
    }

    .ba-post-img,
    .ba-post-img-ph {
        width: 36px;
        height: 36px;
        font-size: var(--io-text-sm);
    }
}