/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #0078d4;
    --primary-dark: #106ebe;
    --primary-light: #1e3a52;
    --bg: #1e1e1e;
    --bg-panel: #252526;
    --bg-white: #2d2d2d;
    --bg-hover: #333333;
    --bg-selected: #1e3a52;
    --text-primary: #e8e6e3;
    --text-secondary: #b0aeac;
    --text-muted: #6e6c6a;
    --border: #3a3a3a;
    --border-dark: #4a4a4a;
    --danger: #e04045;
    --success: #4ec94e;
    --star: #ffc83d;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
    --sidebar-width: 230px;
    --list-width: 400px;
    --topbar-height: 48px;
    --radius: 4px;
    --transition: 0.15s ease;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg);
    overflow: hidden;
    color-scheme: dark;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Skeleton Loading ===== */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--border) 25%, #3e3e3e 50%, var(--border) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite linear;
}
.skel-item {
    list-style: none;
    padding: 9px 16px;
}

/* ===== Spinner ===== */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
.spinner-small {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

/* ===== Top Bar ===== */
.top-bar {
    height: var(--topbar-height);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    position: relative;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 210px;
}

.menu-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: background var(--transition);
    flex-shrink: 0;
}
.menu-toggle:hover { background: rgba(255,255,255,0.15); }

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
}
.app-logo i { font-size: 16px; }
.logo-accent { font-weight: 300; opacity: 0.85; }

.top-bar-center {
    flex: 1;
    max-width: 520px;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.18);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 0 10px;
    height: 32px;
    transition: all var(--transition);
}
.search-box:focus-within { background: #fff; border-color: #fff; }
.search-box i { color: rgba(255,255,255,0.75); font-size: 12px; transition: color var(--transition); }
.search-box:focus-within i { color: var(--text-muted); }
.search-box input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13px;
    padding: 0 8px;
    font-family: inherit;
}
.search-box:focus-within input { color: var(--text-primary); }
.search-box input::placeholder { color: rgba(255,255,255,0.65); }
.search-box:focus-within input::placeholder { color: var(--text-muted); }
.search-clear {
    background: none; border: none;
    color: rgba(255,255,255,0.55);
    cursor: pointer; padding: 2px 4px;
    font-size: 11px; display: none; line-height: 1;
}
.search-clear.visible { display: block; }
.search-box:focus-within .search-clear { color: var(--text-muted); }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.top-btn {
    background: none; border: none;
    color: #fff; font-size: 15px;
    cursor: pointer; padding: 6px 9px;
    border-radius: var(--radius);
    transition: background var(--transition);
}
.top-btn:hover { background: rgba(255,255,255,0.15); }
.top-btn.spinning i { animation: spin 0.8s linear infinite; }

.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: #005a9e;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    cursor: pointer; margin-left: 4px;
    border: 2px solid rgba(255,255,255,0.4);
    transition: border-color var(--transition);
}
.user-avatar:hover { border-color: rgba(255,255,255,0.8); }

/* ===== Main Container ===== */
.main-container {
    display: flex;
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    transition: margin-left 0.22s ease, opacity 0.22s ease, min-width 0.22s ease, width 0.22s ease;
    flex-shrink: 0;
}
.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
    min-width: 0; width: 0; opacity: 0;
}

.sidebar-section { padding: 10px 0; }
.sidebar-heading {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted); padding: 4px 16px 8px;
}
.sidebar-divider { height: 1px; background: var(--border); margin: 2px 12px; }

.category-list { list-style: none; }
.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}
.category-item:hover { background: var(--bg-hover); }
.category-item.active {
    background: var(--bg-selected);
    color: var(--primary-dark);
    font-weight: 600;
}
.category-item.active::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: var(--primary);
    border-radius: 0 2px 2px 0;
}
.category-item i { width: 16px; text-align: center; font-size: 13px; flex-shrink: 0; }
.category-item span:not(.count) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-item .count {
    margin-left: auto;
    font-size: 11px; color: var(--text-muted);
    background: var(--bg-white); padding: 1px 7px;
    border-radius: 10px; font-weight: 500; flex-shrink: 0;
}
.category-item.active .count { background: var(--primary-light); color: var(--primary-dark); }

/* Tag Cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 10px; }
.tag-pill {
    font-size: 11px; padding: 3px 10px;
    border-radius: 12px; background: var(--bg-white);
    color: var(--text-secondary); cursor: pointer;
    transition: all var(--transition); border: 1px solid transparent;
    user-select: none;
}
.tag-pill:hover { background: var(--primary-light); color: var(--primary-dark); }
.tag-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== News List Panel ===== */
.news-list-panel {
    width: var(--list-width);
    min-width: 260px;
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    background: var(--bg-white);
    flex-shrink: 0;
    position: relative;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    min-height: 46px; gap: 8px;
    flex-shrink: 0;
}
.list-header-left { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.list-header-left h2 {
    font-size: 15px; font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-count { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.list-header-right { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }

.filter-btn {
    background: none; border: 1px solid transparent;
    color: var(--text-muted); cursor: pointer;
    padding: 4px 8px; border-radius: var(--radius);
    font-size: 12px; font-family: inherit;
    transition: all var(--transition); white-space: nowrap;
}
.filter-btn:hover { background: var(--bg-hover); color: var(--text-secondary); }
.filter-btn.active { color: var(--primary); background: var(--primary-light); border-color: var(--primary-light); font-weight: 600; }

.view-toggle { display: flex; margin-left: 6px; border-left: 1px solid var(--border); padding-left: 6px; gap: 2px; }
.view-btn {
    background: none; border: 1px solid transparent;
    color: var(--text-muted); cursor: pointer;
    padding: 4px 7px; border-radius: var(--radius); font-size: 12px;
    transition: all var(--transition);
}
.view-btn:hover { background: var(--bg-hover); }
.view-btn.active { color: var(--primary); background: var(--primary-light); border-color: var(--primary-light); }

/* Toolbar */
.list-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 5px 14px; border-bottom: 1px solid var(--border);
    background: var(--bg-panel); flex-shrink: 0;
}
.select-all { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; user-select: none; }
.select-all input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; }
.toolbar-actions { display: flex; gap: 2px; }
.toolbar-btn {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 4px 8px; border-radius: var(--radius);
    font-size: 12px; font-family: inherit;
    display: flex; align-items: center; gap: 4px;
    transition: all var(--transition);
}
.toolbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.toolbar-btn i { font-size: 11px; }

/* News List */
.news-list { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* List loading / error states */
.list-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 48px 24px; text-align: center;
    color: var(--text-muted); gap: 12px;
}
.list-state i { font-size: 32px; opacity: 0.3; }
.list-state p { font-size: 13px; line-height: 1.6; max-width: 240px; }
.list-state .retry-btn {
    margin-top: 4px;
    background: var(--primary); color: #fff;
    border: none; padding: 7px 18px; border-radius: var(--radius);
    font-size: 12px; font-family: inherit; cursor: pointer;
    transition: background var(--transition);
}
.list-state .retry-btn:hover { background: var(--primary-dark); }

/* Skeleton news items */
.news-skel {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.news-skel .skel-title { height: 13px; border-radius: 6px; margin-bottom: 8px; }
.news-skel .skel-excerpt { height: 11px; border-radius: 5px; width: 80%; margin-bottom: 8px; }
.news-skel .skel-meta { height: 10px; border-radius: 5px; width: 50%; }

/* News Items */
.news-item {
    display: flex; align-items: flex-start;
    gap: 8px; padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
}
.news-item:hover { background: var(--bg-hover); }
.news-item.selected { background: var(--bg-selected); }
.news-item.unread { border-left: 3px solid var(--primary); padding-left: 11px; }
.news-item.unread .news-item-title { font-weight: 700; color: var(--text-primary); }

.news-item-check { flex-shrink: 0; margin-top: 3px; accent-color: var(--primary); cursor: pointer; }
.news-item-star {
    flex-shrink: 0; cursor: pointer;
    color: var(--border-dark); font-size: 12px;
    margin-top: 3px; transition: color var(--transition); line-height: 1;
}
.news-item-star:hover { color: var(--star); }
.news-item-star.starred { color: var(--star); }

.news-item-body { flex: 1; min-width: 0; }
.news-item-source { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); margin-bottom: 3px; }
.news-item-title {
    font-size: 13px; font-weight: 400; color: var(--text-secondary);
    line-height: 1.4; margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-item-excerpt {
    font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.news-item-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta-item { display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-muted); }
.meta-item i { font-size: 10px; }
.meta-item.comments { color: var(--success); }
.category-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.news-item-right { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 44px; }
.news-item-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.news-item-share {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 3px 5px; border-radius: var(--radius);
    font-size: 11px; transition: all var(--transition); line-height: 1;
}
.news-item-share:hover { background: var(--primary-light); color: var(--primary); }

/* Compact view */
.news-list.compact .news-item { padding: 6px 14px; }
.news-list.compact .news-item.unread { padding-left: 11px; }
.news-list.compact .news-item-excerpt { display: none; }
.news-list.compact .news-item-title { -webkit-line-clamp: 1; margin-bottom: 2px; }
.news-list.compact .news-item-star,
.news-list.compact .news-item-check { margin-top: 0; }

/* ===== Resize Drag Handles ===== */
.drag-handle {
    width: 5px;
    flex-shrink: 0;
    cursor: col-resize;
    background: transparent;
    position: relative;
    z-index: 20;
    transition: background 0.1s ease;
    user-select: none;
}
.drag-handle:hover,
.drag-handle.dragging {
    background: var(--primary);
}
.drag-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 40px;
    background: var(--border-dark);
    border-radius: 2px;
    pointer-events: none;
}
.drag-handle:hover::after,
.drag-handle.dragging::after {
    background: var(--primary);
}
body.resizing-h { cursor: col-resize !important; user-select: none !important; }
body.resizing-h * { pointer-events: none !important; }
body.resizing-h .drag-handle { pointer-events: all !important; }

/* News item thumbnail */
.news-item-thumb {
    width: 64px;
    height: 52px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-panel);
    align-self: flex-start;
    margin-top: 2px;
    display: block;
}
.news-item-thumb-placeholder {
    width: 64px;
    height: 52px;
    border-radius: var(--radius);
    flex-shrink: 0;
    background: var(--bg-panel);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 18px;
    align-self: flex-start;
    margin-top: 2px;
}

/* Compact view — hide thumbnail */
.news-list.compact .news-item-thumb,
.news-list.compact .news-item-thumb-placeholder { display: none; }

/* Load More */
.load-more-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-panel);
    flex-shrink: 0;
}
.load-more-btn {
    width: 100%;
    background: none;
    border: 1px solid var(--border-dark);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px; font-family: inherit;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 6px;
    transition: all var(--transition);
}
.load-more-btn:hover { background: var(--bg-hover); border-color: var(--text-muted); color: var(--primary); }
.load-more-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===== Preview Panel ===== */
.news-preview-panel { flex: 1; overflow-y: auto; background: var(--bg-panel); min-width: 200px; }

.preview-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100%;
    color: var(--text-muted); text-align: center; padding: 40px;
}
.empty-icon { font-size: 60px; margin-bottom: 18px; opacity: 0.25; }
.preview-empty h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.preview-empty p { font-size: 13px; max-width: 260px; line-height: 1.6; }

.preview-content { animation: fadeSlideIn 0.2s ease; }
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

.preview-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 18px; border-bottom: 1px solid var(--border);
    background: var(--bg-panel); position: sticky; top: 0; z-index: 10;
}
.preview-actions { display: flex; gap: 2px; }
.preview-action-btn {
    background: none; border: none;
    color: var(--text-secondary); cursor: pointer;
    padding: 6px 8px; border-radius: var(--radius);
    font-size: 14px; transition: all var(--transition);
}
.preview-action-btn:hover { background: var(--bg-hover); color: var(--primary); }
.preview-action-btn.active { color: var(--star); }
.preview-action-btn.bookmarked { color: var(--primary); }

.preview-category-badge {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.6px;
    padding: 3px 10px; border-radius: 12px;
}

.preview-image {
    width: 100%;
    height: 240px;
    position: relative;
    overflow: hidden;
    display: none;
    background: var(--bg-white);
    flex-shrink: 0;
}
.preview-image.visible { display: block; }
.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.preview-image .img-gradient {
    /* fallback gradient when no image */
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: rgba(255,255,255,0.3);
}

.preview-body { padding: 22px 26px 48px; max-width: 800px; }

.preview-title {
    font-size: 22px; font-weight: 700;
    line-height: 1.3; color: var(--text-primary); margin-bottom: 14px;
}

.preview-meta {
    display: flex; align-items: flex-start;
    justify-content: space-between; margin-bottom: 14px;
    flex-wrap: wrap; gap: 10px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.preview-author { display: flex; align-items: center; gap: 10px; }
.author-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
    overflow: hidden;
}
.author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-info { display: flex; flex-direction: column; gap: 1px; }
.author-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.preview-date { font-size: 11px; color: var(--text-muted); }

.preview-stats { display: flex; gap: 14px; align-items: center; }
.preview-stats .stat { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.preview-stats .stat i { font-size: 12px; }

.preview-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.preview-tags .tag-pill { font-size: 11px; }

/* WordPress article content */
.wp-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
}
.wp-content p { margin-bottom: 14px; }
.wp-content h1, .wp-content h2, .wp-content h3,
.wp-content h4, .wp-content h5, .wp-content h6 {
    color: var(--text-primary);
    margin: 22px 0 10px;
    line-height: 1.3;
}
.wp-content h2 { font-size: 18px; }
.wp-content h3 { font-size: 16px; }
.wp-content img {
    max-width: 100%; height: auto;
    border-radius: var(--radius);
    margin: 8px 0 14px;
    display: block;
}
.wp-content a { color: var(--primary); text-decoration: none; }
.wp-content a:hover { text-decoration: underline; }
.wp-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 8px 16px;
    margin: 16px 0;
    background: var(--bg-white);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
    font-style: italic;
}
.wp-content ul, .wp-content ol { padding-left: 24px; margin-bottom: 14px; }
.wp-content li { margin-bottom: 4px; }
.wp-content figure { margin: 0 0 14px; }
.wp-content figure figcaption { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.wp-content iframe { max-width: 100%; border-radius: var(--radius); margin: 8px 0; }
.wp-content pre, .wp-content code {
    background: var(--bg-white); border-radius: var(--radius);
    padding: 2px 6px; font-size: 13px;
}
.wp-content pre { padding: 12px 16px; overflow-x: auto; margin-bottom: 14px; }

/* Preview Footer */
.preview-footer {
    display: flex; align-items: center;
    gap: 10px; margin-top: 24px; padding-top: 18px;
    border-top: 1px solid var(--border);
}
.like-btn, .comment-btn {
    display: flex; align-items: center; gap: 6px;
    background: none; border: 1px solid var(--border-dark);
    color: var(--text-secondary); cursor: pointer;
    padding: 7px 14px; border-radius: 20px;
    font-size: 13px; font-family: inherit;
    transition: all var(--transition);
}
.like-btn:hover, .comment-btn:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.like-btn.liked { color: var(--danger); border-color: var(--danger); background: #fde8e8; }
.like-count { font-weight: 600; }

/* ===== Comments ===== */
.comment-box { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.comments-heading { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); }

.comment-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.comment-form-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 10px; }
.comment-form-fields {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px; margin-bottom: 8px;
}
.comment-form-fields input,
.comment-input-area textarea {
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    padding: 8px 12px; font-family: inherit;
    font-size: 13px; outline: none;
    transition: border-color var(--transition);
    color: var(--text-primary);
    background: var(--bg-white);
    width: 100%;
}
.comment-form-fields input:focus,
.comment-input-area textarea:focus { border-color: var(--primary); }
.comment-input-area textarea { resize: vertical; min-height: 70px; }

.comment-submit { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.comment-note { font-size: 12px; color: var(--text-muted); }
.comment-note.error { color: var(--danger); }
.comment-note.success { color: var(--success); }

.submit-btn {
    background: var(--primary); color: #fff;
    border: none; padding: 7px 18px;
    border-radius: var(--radius); font-size: 13px;
    font-family: inherit; cursor: pointer;
    font-weight: 500; display: flex; align-items: center; gap: 6px;
    transition: background var(--transition);
}
.submit-btn:hover { background: var(--primary-dark); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.comments-closed {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--bg-white);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}

/* Comment items */
.comments-list { margin-top: 16px; }
.comment-item {
    display: flex; gap: 10px;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary-dark);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 10px; font-weight: 700; flex-shrink: 0;
    overflow: hidden;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-item-body { flex: 1; min-width: 0; }
.comment-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-item-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.comment-item-time { font-size: 11px; color: var(--text-muted); }
.comment-item-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.comment-item-text a { color: var(--primary); }
/* Strip any WP-injected paragraph tags in comment content */
.comment-item-text p { display: inline; }

.pending-badge {
    font-size: 10px; padding: 1px 6px;
    background: #fff4ce; color: #7a5c00;
    border-radius: 10px; font-weight: 500;
}

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: #323130; color: #fff;
    padding: 10px 20px; border-radius: 4px;
    font-size: 13px; z-index: 999;
    pointer-events: none; opacity: 0;
    transition: all 0.25s ease; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Mobile bottom nav (hidden on desktop) ===== */
.mobile-nav { display: none; }
.sidebar-overlay { display: none; }
.preview-back-btn { display: none; }

/* ===== Responsive — Tablet ===== */
@media (max-width: 1100px) {
    :root { --sidebar-width: 200px; --list-width: 320px; }
}

@media (max-width: 900px) {
    :root { --list-width: 290px; }

    /* Sidebar becomes a drawer overlay */
    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        height: calc(100vh - var(--topbar-height));
        z-index: 200;
        box-shadow: var(--shadow-lg);
        transition: transform 0.25s ease, opacity 0.25s ease;
        transform: translateX(0);
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
        opacity: 1;
    }
    .sidebar.collapsed {
        transform: translateX(calc(-1 * var(--sidebar-width)));
        margin-left: 0;
        opacity: 0;
    }

    /* Overlay behind drawer */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        top: var(--topbar-height);
        background: rgba(0,0,0,0.55);
        z-index: 199;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .sidebar-overlay.visible {
        opacity: 1;
        pointer-events: all;
    }

    /* Hide left drag handle when sidebar is a drawer */
    #dragHandleLeft { display: none; }
}

/* ===== Responsive — Mobile ===== */
@media (max-width: 640px) {
    :root { --topbar-height: 52px; --mobile-nav-height: 60px; }

    /* --- Top bar --- */
    .top-bar { padding: 0 8px; gap: 8px; }
    .app-logo span { display: none; }          /* hide text, keep icon */
    .app-logo i { font-size: 20px; }
    .top-bar-left { min-width: unset; gap: 6px; }
    .top-bar-center { flex: 1; max-width: none; }
    .top-btn[title="Settings"] { display: none; }  /* hide settings on mobile */
    .user-avatar { display: none; }

    /* --- Body / layout --- */
    body { overflow: hidden; }

    .main-container {
        height: calc(100vh - var(--topbar-height) - var(--mobile-nav-height));
        position: relative;
        overflow: hidden;
    }

    /* Drag handles hidden on mobile */
    .drag-handle { display: none; }

    /* --- Panels: slide-based navigation --- */
    .news-list-panel,
    .news-preview-panel {
        position: absolute;
        top: 0; bottom: 0; left: 0; right: 0;
        width: 100% !important;
        min-width: 0 !important;
        border: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    opacity  0.3s ease;
    }

    /* Default: list visible, preview hidden to the right */
    .main-container[data-mobile-view="list"] .news-list-panel {
        transform: translateX(0);
        opacity: 1;
        z-index: 2;
    }
    .main-container[data-mobile-view="list"] .news-preview-panel {
        transform: translateX(100%);
        opacity: 0;
        z-index: 1;
        pointer-events: none;
    }

    /* Article open: preview slides in, list slides left */
    .main-container[data-mobile-view="article"] .news-list-panel {
        transform: translateX(-30%);
        opacity: 0;
        z-index: 1;
        pointer-events: none;
    }
    .main-container[data-mobile-view="article"] .news-preview-panel {
        transform: translateX(0);
        opacity: 1;
        z-index: 2;
    }

    /* --- News list adjustments --- */
    .list-toolbar { display: none; }  /* hide toolbar on mobile to save space */

    .list-header { padding: 8px 12px; min-height: 44px; }
    .list-header-left h2 { font-size: 15px; }
    .filter-btn { padding: 4px 7px; font-size: 11px; }
    .filter-btn i { display: none; } /* icon-only on tiny screens */
    .view-toggle { display: none; }  /* hide view toggle on mobile */

    .news-item { padding: 10px 12px; gap: 10px; }
    .news-item.unread { padding-left: 9px; }
    .news-item-thumb { width: 76px; height: 62px; }
    .news-item-thumb-placeholder { width: 76px; height: 62px; font-size: 22px; }
    .news-item-check { display: none; }  /* no checkboxes on mobile */
    .news-item-title { font-size: 14px; -webkit-line-clamp: 2; }
    .news-item-excerpt { -webkit-line-clamp: 2; }
    .news-item-date { font-size: 10px; }
    .news-item-share { padding: 5px 6px; font-size: 13px; }
    .news-item-source { font-size: 10px; }

    .load-more-btn { padding: 12px; font-size: 14px; }

    /* --- Preview panel adjustments --- */
    .preview-header { padding: 8px 10px; }
    .preview-back-btn { display: flex; }  /* show back button on mobile */
    .preview-action-btn { padding: 5px 7px; font-size: 15px; }
    .preview-action-btn[title="Print"] { display: none; }

    .preview-image { height: 200px; }

    .preview-body { padding: 16px 14px 80px; }  /* extra bottom for nav bar */
    .preview-title { font-size: 19px; }
    .preview-meta { flex-direction: column; gap: 8px; align-items: flex-start; }
    .preview-stats { gap: 12px; }

    .comment-box { margin-top: 20px; padding-top: 16px; }
    .comment-form-fields { grid-template-columns: 1fr; gap: 8px; }
    .comment-submit { flex-direction: column; align-items: stretch; gap: 8px; }
    .comment-note { text-align: center; }

    /* --- Bottom navigation --- */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: var(--mobile-nav-height);
        background: var(--bg-panel);
        border-top: 1px solid var(--border);
        z-index: 300;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.35);
    }
    .mobile-nav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 10px;
        font-family: inherit;
        cursor: pointer;
        transition: color var(--transition), background var(--transition);
        padding: 6px 0 8px;
        position: relative;
    }
    .mobile-nav-btn i { font-size: 20px; transition: transform 0.2s ease; }
    .mobile-nav-btn:active i { transform: scale(0.88); }
    .mobile-nav-btn.active { color: var(--primary); }
    .mobile-nav-btn.active::before {
        content: '';
        position: absolute;
        top: 0; left: 20%; right: 20%;
        height: 2px;
        background: var(--primary);
        border-radius: 0 0 2px 2px;
    }
    .mobile-nav-btn:disabled { opacity: 0.35; cursor: default; }
    .mobile-nav-btn:not(:disabled):active { background: var(--bg-hover); }

    /* --- Sidebar on mobile --- */
    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        height: calc(100vh - var(--topbar-height) - var(--mobile-nav-height));
        z-index: 200;
        width: min(300px, 85vw) !important;
        min-width: 0 !important;
        box-shadow: var(--shadow-lg);
        transform: translateX(0);
        opacity: 1;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease;
    }
    .sidebar.collapsed {
        transform: translateX(-110%);
        opacity: 0;
        margin-left: 0;
    }
    .sidebar-overlay {
        bottom: var(--mobile-nav-height);
    }

    /* --- Back button --- */
    .preview-back-btn {
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        padding: 6px 10px 6px 4px;
        font-size: 16px;
        border-radius: var(--radius);
        transition: color var(--transition);
        margin-right: 2px;
        flex-shrink: 0;
    }
    .preview-back-btn:active { color: var(--primary); }

    /* --- Misc --- */
    .wp-content { font-size: 15px; line-height: 1.85; }
    .preview-footer { gap: 8px; flex-wrap: wrap; }
    .like-btn, .comment-btn { padding: 8px 14px; font-size: 13px; }

    /* --- Toast higher up so nav doesn't cover it --- */
    .toast { bottom: calc(var(--mobile-nav-height) + 12px); }
}

/* Very small screens */
@media (max-width: 360px) {
    .filter-btn { padding: 3px 5px; font-size: 10px; }
    .preview-title { font-size: 17px; }
    .news-item-thumb { width: 64px; height: 52px; }
}
