/* ── Blog — Minimalist CSS (v2.0) ── */

:root {
    --bg: #ffffff;
    --bg-secondary: #fafafa;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e5e5e5;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --success: #16a34a;
    --warning: #b45309;
    --radius: 6px;
    --max-width: 680px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navigation ── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 48px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav--admin { background: var(--bg-secondary); }

.nav-brand {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.nav-links { display: flex; gap: 1.25rem; align-items: center; }
.nav-links a {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-external { font-size: 0.8125rem !important; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text);
}

.nav-toggle svg {
    width: 22px;
    height: 22px;
}

/* ── Content ── */
.content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

/* ── Home Page ── */
.home-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.home-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.home-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.pagination-link {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.15s;
}

.pagination-link:hover {
    background: var(--bg-secondary);
    text-decoration: none;
    color: var(--accent);
}

/* ── Reading Time ── */
.reading-time {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-left: 0.75rem;
}

/* ── Post List ── */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-card {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.post-card:last-child { border-bottom: none; }

.post-cover img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.post-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.post-title:hover { color: var(--accent); text-decoration: none; }

.post-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.5rem;
}

.post-summary {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Post Article ── */
.post-article { margin-bottom: 2rem; }

.post-header { margin-bottom: 2rem; }

.post-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.post-body { font-size: 1rem; line-height: 1.8; }

.post-body h1 { font-size: 1.5rem; margin: 2rem 0 1rem; font-weight: 700; }
.post-body h2 { font-size: 1.25rem; margin: 1.75rem 0 0.75rem; font-weight: 600; }
.post-body h3 { font-size: 1.125rem; margin: 1.5rem 0 0.5rem; font-weight: 600; }
.post-body h4 { font-size: 1rem; margin: 1.25rem 0 0.5rem; font-weight: 600; }
.post-body h5 { font-size: 0.9rem; margin: 1rem 0 0.5rem; font-weight: 600; }
.post-body h6 { font-size: 0.875rem; margin: 1rem 0 0.5rem; font-weight: 600; color: var(--text-secondary); }

.post-body p { margin-bottom: 1rem; }

.post-body ul, .post-body ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.post-body li { margin-bottom: 0.375rem; }

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 1rem 0;
}

.post-body code {
    font-family: "SF Mono", "Fira Code", monospace;
    background: var(--bg-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.875em;
}

.post-body pre {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
}

.post-body pre code {
    background: none;
    padding: 0;
}

.post-body blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
}

.post-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.post-body a { color: var(--accent); }

/* ── Markdown Tables ── */
.md-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9375rem;
}

.md-table th,
.md-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}

.md-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.md-table tr:nth-child(even) {
    background: var(--bg-secondary);
}

/* ── Login ── */
.login-card {
    max-width: 360px;
    margin: 4rem auto;
    text-align: center;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.login-card input[type="password"],
.login-card input[type="text"] {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    outline: none;
}

.login-card input[type="password"]:focus,
.login-card input[type="text"]:focus { border-color: var(--accent); }

.login-hint {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.alert-success {
    background: #d4edda;
    color: #155724;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.admin-user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* ── Admin ── */
.admin-sections { margin-top: 1.5rem; }

.admin-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1.5rem 0 0.75rem;
}

.admin-post-list { list-style: none; }

.admin-post-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.admin-post-title {
    flex: 1;
    font-weight: 500;
    color: var(--text);
    min-width: 120px;
}

.admin-post-title:hover { color: var(--accent); text-decoration: none; }

.admin-post-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.admin-post-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

/* ── Preview Banner ── */
.preview-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.preview-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--warning);
    color: #fff;
}

.preview-title {
    font-weight: 600;
    color: var(--text-secondary);
}

.preview-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ── Editor ── */
.editor-form { margin-top: 1.5rem; }

.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-row { margin-bottom: 0.5rem; }

.form-row-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-full {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}

.input-full:focus { border-color: var(--accent); }

/* Image upload */
.image-upload-area {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s;
}

.image-upload-area:hover { border-color: var(--accent); }

.image-upload-area.drag-over {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.05);
}

.image-upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.image-upload-icon { font-size: 2rem; }

.image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

.cover-preview-wrap {
    position: relative;
    display: inline-block;
    margin-top: 0.5rem;
}

.cover-preview-wrap .image-preview {
    margin-top: 0;
}

.remove-cover-form {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
}

/* Editor */
.editor-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.375rem;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--bg-secondary);
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.8125rem;
    border-radius: 3px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.toolbar-btn:hover {
    background: var(--border);
    color: var(--text);
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.show-preview .editor-container {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.editor-textarea {
    width: 100%;
    min-height: 400px;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.show-preview .editor-textarea {
    border-radius: var(--radius);
}

.editor-textarea:focus { border-color: var(--accent); }

.editor-preview {
    display: none;
    min-height: 400px;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.8;
}

.editor-toggle {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.editor-toggle label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-sm {
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
}

.btn-sm:hover { background: var(--bg-secondary); color: var(--text); }

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.inline-form { display: inline; margin: 0; }

/* ── States ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.alert {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ── Slug ── */
.slug-suggestions { margin-top: 0.25rem; font-size: 0.75rem; }
.slug-warning { color: var(--warning); }
.slug-ok { color: var(--success); }

/* ── Back Link ── */
.back-link {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.back-link:hover { color: var(--accent); text-decoration: none; }

/* ── Mobile ── */
.lb-sheet-handle { display: none; }

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links {
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        background: rgba(255,255,255,0.98);
        backdrop-filter: blur(12px);
        flex-direction: column;
        gap: 0;
        padding: 0;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }
    .nav-open .nav-links {
        max-height: 300px;
        padding: 8px 0;
    }
    .nav-links a {
        padding: 12px 20px;
        font-size: 1rem;
        border-radius: 0;
        width: 100%;
    }
    .nav-links a:hover {
        background: var(--bg-hover, #f5f5f5);
    }
    .nav-user {
        padding: 12px 20px;
        display: block;
    }
}
@media (max-width: 480px) {
    .nav { padding: 0 1rem; }
    .nav-brand { font-size: 0.9rem; }
    .content { padding: 1rem 0.75rem 3rem; }
    .form-row-inline { grid-template-columns: 1fr; }
    .post-header h1 { font-size: 1.5rem; }
    .home-header h1 { font-size: 1.5rem; }
    .admin-post-item { flex-direction: column; align-items: flex-start; }
    .admin-post-actions { margin-top: 0.375rem; }
    .show-preview .editor-container { grid-template-columns: 1fr; }
}

/* ── Edit button on post page ── */
.btn-edit-post {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
    margin-left: 0.75rem;
    vertical-align: middle;
}

.btn-edit-post:hover {
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

/* ── Auth Pages ───────────────────────────────────────────────────── */

.auth-page {
    max-width: 400px;
    margin: 2rem auto;
}

.auth-page h1 {
    margin-bottom: 1rem;
}

.auth-form .form-group {
    margin-bottom: 1rem;
}

.auth-link {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-error {
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.nav-user {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ── Ratings ─────────────────────────────────────────────────────── */

.ratings-section {
    margin: 1.5rem 0 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.rating-stars {
    display: inline-flex;
    gap: 0.15rem;
}

.star {
    font-size: 1.3rem;
    color: #d1d5db;
    cursor: default;
    transition: color 0.15s;
}

.star.filled {
    color: #f59e0b;
}

.star.clickable {
    cursor: pointer;
}

.star.clickable:hover {
    color: #f59e0b;
}

.rating-info {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ── Comments ─────────────────────────────────────────────────────── */

.comments-section {
    margin: 2rem 0;
}

.comments-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.comment-list {
    margin-bottom: 1.5rem;
}

.comment-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-author {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.comment-body {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
}

.comment-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

.comment-del {
    position: absolute;
    top: 0.75rem;
    right: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.comment-del:hover {
    color: #dc2626;
    background: #fef2f2;
}

.comment-form-container {
    margin-top: 1rem;
}

.comment-form-container textarea {
    margin-bottom: 0.5rem;
}

.comment-error {
    display: inline-block;
    margin-left: 0.5rem;
    color: #dc2626;
    font-size: 0.82rem;
}

.comment-login-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ── Filter Toolbar ──────────────────────────────────────────────── */

.filter-toolbar {
    margin: 1.2rem 0;
    padding: 0.85rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.filter-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tags-group {
    display: none;
}

.tags-row {
    display: none;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid #dee2e6;
}

.tags-row.active {
    display: flex;
}

.filter-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    padding-top: 0.4rem;
}

.sort-select {
    padding: 0.4rem 2rem 0.4rem 0.7rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.84rem;
    font-family: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 0.55rem center;
    -webkit-appearance: none;
    appearance: none;
    color: #212529;
    cursor: pointer;
    outline: none;
    min-width: 190px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.sort-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 3px rgba(13,110,253,0.15);
}

.tags-inline {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 0.1rem;
}

.tag-check {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    color: #495057;
    background: #fff;
    border: 1px solid #dee2e6;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.tag-count {
    font-size: 0.72rem;
    color: #868e96;
    font-weight: 400;
}

.tag-check:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.tag-check input[type="checkbox"] {
    accent-color: #0d6efd;
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.tag-check:has(input:checked) {
    color: #0d6efd;
    border-color: #0d6efd;
    background: #e7f1ff;
}

.filter-hint {
    font-size: 0.8rem;
    color: #868e96;
    font-style: italic;
}

/* ── Post Tags ────────────────────────────────────────────────────── */

.post-tags {
    margin-top: 0.35rem;
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.post-tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    text-decoration: none;
    color: var(--accent);
    background: var(--bg);
    border: 1px solid var(--accent);
    opacity: 0.85;
    transition: opacity 0.2s;
}

.post-tag:hover {
    opacity: 1;
    background: var(--accent);
    color: #fff;
}

/* ── Form Hints ──────────────────────────────────────────────────── */

.form-hint {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ── User Dashboard ────────────────────────────────────────────────── */

.user-post-list {
    margin-top: 1.5rem;
}

.user-post-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.user-post-item:last-child {
    border-bottom: none;
}

.user-post-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.user-post-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-post-title:hover {
    color: var(--accent);
    text-decoration: underline;
}

.user-post-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.user-post-status {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.user-post-status.published {
    background: #dcfce7;
    color: #166534;
}

.user-post-status.draft {
    background: #fef3c7;
    color: #92400e;
}

.user-post-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.btn-delete {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-delete:hover {
    background: #fef2f2;
    color: #dc2626;
}

.comment-edit-area {
    margin-top: 0.5rem;
}

.comment-edit-area textarea {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

.comment-edit-actions {
    margin-top: 0.3rem;
    display: flex;
    gap: 0.35rem;
}

/* ═══════════════════════════════════════════════════════════
   GALLERY FEATURE — Instagram Style
   ═══════════════════════════════════════════════════════════ */

/* ── Gallery Page ─────────────────────────────────────── */

.gallery-page {
    max-width: 935px;
    margin: 0 auto;
    padding: 30px 20px 0;
    background: #fafafa;
}

/* ── Profile Header ───────────────────────────────────── */

.gallery-header {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    margin-bottom: 44px;
    padding-bottom: 44px;
    border-bottom: 1px solid #dbdbdb;
}

.gallery-header-avatar {
    width: 152px;
    height: 152px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gallery-header-avatar span {
    font-size: 64px;
    color: #fff;
    font-weight: 300;
}

.gallery-header-info {
    flex: 1;
    min-width: 0;
}

.gallery-header-info h1 {
    font-size: 28px;
    font-weight: 300;
    margin: 0 0 4px;
    color: #262626;
}

.gallery-header-bio {
    font-size: 16px;
    color: #262626;
    line-height: 1.5;
    margin-bottom: 16px;
}

.gallery-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 20px;
    font-size: 16px;
    color: #262626;
}

.gallery-stats strong {
    font-weight: 600;
}

.gallery-header-actions {
    display: flex;
    gap: 8px;
}

.gallery-header-actions .btn {
    font-size: 14px;
    font-weight: 600;
    padding: 7px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

.gallery-header-actions .btn-primary {
    background: #0095f6;
    color: #fff;
}

.gallery-header-actions .btn-primary:hover {
    background: #1877f2;
}

/* ── Tabs ─────────────────────────────────────────────── */

.gallery-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 1px solid #dbdbdb;
    padding-bottom: 0;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #8e8e8e;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: -1px;
}

.tab-btn:hover {
    background: none;
    color: #262626;
}

.tab-btn.active {
    background: none;
    color: #262626;
    border-bottom-color: #262626;
}

.tab-count {
    display: none;
}

/* ── Instagram Square Grid ────────────────────────────── */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-top: 4px;
    width: 100%;
}

/* ── Grid Items ───────────────────────────────────────── */

.gallery-item {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #000;
    margin-bottom: 0;
    border-radius: 0;
    box-shadow: none;
    break-inside: auto;
    transition: none;
    width: 100%;
}

.gallery-item:hover {
    transform: none;
    box-shadow: none;
}

.gallery-item-img {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #000;
}

.gallery-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none;
    display: block;
}

.gallery-item:hover .gallery-item-img img {
    transform: none;
    opacity: 0.7;
}

/* Hover overlay */
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.overlay-stats {
    display: flex;
    align-items: center;
    gap: 24px;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.overlay-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.overlay-stat svg {
    width: 20px;
    height: 20px;
    fill: #fff;
    stroke: none;
}

/* Hide grid metadata — shown only in lightbox */
.gallery-item-meta { display: none; }
.gitem-actions { display: none; }
.gallery-item-vis { display: none; }
.gallery-item-title { display: none; }

/* ── Lightbox — Instagram Post Modal ──────────────────── */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox.lb-open {
    display: flex !important;
}

.lightbox-content {
    display: flex;
    flex-direction: row;
    max-width: 85vw;
    max-height: 90vh;
    width: 900px;
    background: #fff;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: none;
}

.lightbox-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    background: #000;
    max-width: 600px;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    display: block;
}

/* Info panel */
.lightbox-info {
    width: 340px;
    min-width: 340px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    color: #262626;
}

.lb-sheet-handle { display: none; }

/* Header */
.lb-header {
    padding: 14px 16px;
    border-bottom: 1px solid #efefef;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
}

.lb-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.lb-header-username {
    font-size: 14px;
    font-weight: 600;
    color: #262626;
    flex: 1;
}

.lb-header-desc {
    font-size: 14px;
    color: #262626;
    margin: 0;
    padding: 12px 16px;
    line-height: 1.5;
    border-bottom: 1px solid #efefef;
}

/* Action bar */
.lb-actions {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid #efefef;
    gap: 12px;
    min-height: 44px;
}

.lb-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    border-radius: 0;
    transition: opacity 0.15s;
    color: #262626;
    margin-left: -4px;
}

.lb-action-btn:hover {
    background: none;
    opacity: 0.6;
}

.lb-action-btn svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lb-action-btn.liked svg {
    fill: #ed4956;
    stroke: #ed4956;
    animation: lb-like-pop 0.3s ease;
}

.lb-action-btn.liked {
    color: #ed4956;
}

@keyframes lb-like-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.lb-like-count {
    font-size: 14px;
    font-weight: 600;
    color: #262626;
    padding: 0 12px 8px;
    display: block;
}

/* Tags inline */
.lb-tags-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.lb-tags-display {
    font-size: 14px;
    color: #00376b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-tags-edit-btn {
    background: none;
    border: none;
    color: #8e8e8e;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.lb-tags-edit-btn:hover {
    background: #f0f0f0;
    color: #262626;
}

.lb-tags-edit-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Tags editor */
.lb-tags-editor {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #efefef;
    background: #fafafa;
}

.lb-tags-editor input {
    flex: 1;
    border: 1px solid #dbdbdb;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}

.lb-tags-editor .btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

.lb-tags-editor .btn-primary {
    background: #0095f6;
    color: #fff;
}

.lb-tags-editor .btn {
    background: #efefef;
    color: #262626;
}

/* Comments */
.lb-comments {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lb-comments-header {
    display: none;
}

.lb-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.lb-comment {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    gap: 12px;
}

.lb-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #efefef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #8e8e8e;
    flex-shrink: 0;
}

.lb-comment-body {
    flex: 1;
    min-width: 0;
}

.lb-comment-body strong {
    color: #262626;
    font-weight: 600;
}

.lb-comment-body strong::after {
    content: " ";
}

.lb-comment-time {
    display: block;
    font-size: 12px;
    color: #8e8e8e;
    margin-top: 4px;
    margin-left: 0;
}

/* Comment form */
.lb-comment-form {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #efefef;
    gap: 12px;
    background: #fff;
    min-height: 52px;
}

.lb-comment-form input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 8px 0;
    color: #262626;
}

.lb-comment-form input::placeholder {
    color: #8e8e8e;
}

.lb-comment-form .btn {
    background: none;
    border: none;
    color: #0095f6;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px;
    border-radius: 0;
    transition: opacity 0.15s;
    opacity: 0.3;
}

.lb-comment-form .btn:hover {
    opacity: 1;
}

.lb-empty {
    font-size: 14px;
    color: #8e8e8e;
    text-align: center;
    padding: 20px;
}

/* Lightbox controls */
.lightbox-close {
    position: fixed;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 0;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.lightbox-close::before {
    content: "\2715";
    font-size: 20px;
    color: #fff;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 0;
    z-index: 10;
}

.lightbox-prev::before,
.lightbox-next::before {
    font-size: 24px;
    color: #fff;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* ── Empty State ──────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #8e8e8e;
    font-size: 16px;
}

.empty-state a {
    color: #0095f6;
}

/* ── Pagination ───────────────────────────────────────── */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
    padding-top: 20px;
    padding-bottom: 40px;
    border-top: none;
}

.pagination-link {
    font-size: 14px;
    font-weight: 600;
    color: #0095f6;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #dbdbdb;
    background: #fff;
    transition: all 0.15s;
}

.pagination-link:hover {
    background: #fafafa;
    text-decoration: none;
}

.pagination span {
    font-size: 14px;
    color: #8e8e8e;
}

/* ── Gallery Manage Page (unchanged) ──────────────────── */

.gallery-manage-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.gallery-upload-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 2px dashed var(--border, #ccc);
    border-radius: 12px;
    background: var(--bg-secondary, #fafafa);
}

.upload-drop-zone {
    text-align: center;
    padding: 2rem;
    transition: background 0.2s, border-color 0.2s;
}

.upload-drop-zone.drag-over {
    background: var(--primary-light, #e8f0fe);
    border-color: var(--primary, #4a90d9);
}

.upload-drop-zone p {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary, #666);
}

.upload-drop-zone button {
    background: var(--primary, #4a90d9);
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.upload-drop-zone button:hover {
    background: var(--primary-dark, #3a7bc8);
}

.upload-queue {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.upload-card {
    background: white;
    border: 1px solid var(--border, #ddd);
    border-radius: 8px;
    overflow: hidden;
    width: 200px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.upload-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.upload-card-body {
    padding: 0.6rem;
}

.upload-card-body .form-group {
    margin-bottom: 0.4rem;
}

.upload-card-body .form-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.upload-card-body .input-full {
    font-size: 0.8rem;
    padding: 0.3rem;
}

.upload-status {
    display: block;
    padding: 0.25rem 0.5rem;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    border-radius: 4px;
}

.upload-status.uploading {
    color: #856404;
    background: #fff3cd;
}

.upload-status.ok {
    color: #155724;
    background: #d4edda;
}

.upload-status.fail {
    color: #721c24;
    background: #f8d7da;
}

.upload-controls {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* ── Edit Modal ────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin: 0 0 1rem;
    font-size: 1.2rem;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.gallery-manage-list h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

/* ── Gallery Tags / Likes (manage page) ───────────────── */

.gitem-tags {
    padding: 0.3rem 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.gtag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--primary-light, #e8f0fe);
    color: var(--primary, #4a90d9);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.gitem-like {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.15rem 0.3rem;
    color: var(--text-secondary, #666);
    transition: transform 0.15s;
}

.gitem-like:hover {
    transform: scale(1.15);
}

.like-heart {
    font-size: 1rem;
}

.gitem-date {
    font-size: 0.75rem;
    color: var(--text-secondary, #999);
}

.lb-label { font-weight: 600; font-size: 0.85rem; color: var(--text-secondary,#666); }

/* ═══════════════════════════════════════════════════════════
   MOBILE OVERRIDES — must be last to beat desktop rules
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .gallery-page {
        padding: 0;
        background: #fff;
    }

    .gallery-header {
        flex-direction: row;
        align-items: center;
        gap: 16px;
        padding: 12px 16px;
        margin-bottom: 0;
        border-bottom: 1px solid #dbdbdb;
    }

    .gallery-header-avatar {
        width: 77px;
        height: 77px;
    }

    .gallery-header-avatar span {
        font-size: 32px;
    }

    .gallery-header-info h1 {
        font-size: 18px;
        font-weight: 400;
        margin: 0 0 8px;
    }

    .gallery-stats {
        gap: 16px;
        font-size: 14px;
        margin-bottom: 8px;
    }

    .gallery-header-actions .btn {
        font-size: 13px;
        padding: 6px 12px;
    }

    .gallery-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .gallery-tabs::-webkit-scrollbar { display: none; }

    .tab-btn {
        padding: 12px 16px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .gallery-grid {
        gap: 2px;
        margin-top: 0;
    }

    .gallery-item {
        position: relative;
        width: 100%;
        padding-bottom: 100%;
        height: 0;
    }

    .gallery-item-img {
        position: absolute;
        inset: 0;
    }

    .gallery-item-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        position: absolute;
    }

    .gallery-item-overlay { display: none; }

    .empty-state {
        padding: 40px 20px;
        font-size: 14px;
    }

    .pagination {
        padding-bottom: 24px;
        margin-top: 20px;
    }

    .lightbox.lb-open {
        display: flex !important;
        flex-direction: column;
        background: #000;
    }

    .lightbox-content {
        flex-direction: column;
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        background: #000;
    }

    .lightbox-img-wrap {
        flex: 1;
        max-width: 100%;
        min-height: 0;
    }

    .lightbox-content img {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    .lightbox-info {
        width: 100%;
        min-width: 100%;
        max-height: 45vh;
        background: #fff;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    }

    .lightbox-close {
        top: 8px;
        right: 8px;
    }

    .lightbox-prev,
    .lightbox-next {
        top: auto;
        bottom: 50vh;
        transform: translateY(50%);
    }

    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }

    .lb-comments {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .lb-comment {
        padding: 8px 12px;
        font-size: 13px;
    }

    .lb-comment-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .lb-comment-form {
        padding: 8px 12px;
    }

    .lb-comment-form input {
        font-size: 13px;
    }

    .lb-like-count {
        font-size: 13px;
        padding: 0 12px 6px;
    }

    .lb-header {
        padding: 10px 12px;
        min-height: 48px;
    }

    .lb-header-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .lb-header-username {
        font-size: 13px;
    }

    .lb-header-desc {
        font-size: 13px;
        padding: 8px 12px;
    }

    .lb-actions {
        padding: 4px 8px;
        min-height: 40px;
    }

    .lb-action-btn {
        padding: 6px;
    }

    .lb-action-btn svg {
        width: 22px;
        height: 22px;
    }

    .lb-tags-inline {
        padding: 6px 12px !important;
    }

    .lb-tags-display {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .gallery-grid { gap: 1px; }
}

/* ── Video Page ──────────────────────────────────────────────────── */

.video-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.video-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}

.video-header-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.video-header-avatar span {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
}

.video-header-info {
    flex: 1;
}

.video-header-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.5rem;
}

.video-stats {
    display: flex;
    gap: 1rem;
    color: #64748b;
    font-size: 0.875rem;
}

.video-stats strong {
    color: #0f172a;
}

.video-header-actions {
    display: flex;
    gap: 0.5rem;
}

.video-header-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.video-header-actions .btn-primary {
    background: #6366f1;
    color: #fff;
    border: none;
}

.video-header-actions .btn-primary:hover {
    background: #4f46e5;
}

.video-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.video-tabs .tab-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.video-tabs .tab-btn.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.video-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.video-item-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    overflow: hidden;
}

.video-item-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.video-item:hover .video-item-overlay {
    opacity: 1;
}

.overlay-stats {
    display: flex;
    gap: 0.75rem;
}

.overlay-stat {
    display: flex;
    align-items: center;
    color: #fff;
}

.overlay-stat svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.vitem-actions {
    display: none;
}

.video-manage-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.video-upload-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}

.video-upload-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 1rem;
}

.video-manage-list h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin: 2rem 0 1rem;
}

.vitem-like {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.875rem;
    cursor: pointer;
    transition: color 0.2s;
}

.vitem-like:hover {
    color: #ef4444;
}

.vitem-date {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Lightbox video wrap */
.lightbox-video-wrap,
.lightbox-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 0;
}

.lightbox-video-wrap video,
.lightbox-media video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.lightbox-media iframe {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
}

.video-item-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    overflow: hidden;
}

.video-item-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
}

.video-url-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}

.video-url-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 1rem;
}

.url-add-form {
    max-width: 600px;
}

.url-add-form .btn {
    margin-top: 0.5rem;
}

#url-status {
    margin-left: 1rem;
}

/* Upload thumb for videos */
.upload-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    background: #0f172a;
}

/* ── Video Responsive ────────────────────────────────────────────── */

@media (max-width: 768px) {
    .video-page {
        padding: 1rem 0.5rem;
    }

    .video-header {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .video-header-actions {
        justify-content: center;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .video-item {
        border-radius: 8px;
    }

    .lightbox.lb-open {
        flex-direction: column;
    }

    .lightbox-content {
        flex-direction: column;
        width: 100%;
        height: 100%;
    }

    .lightbox-video-wrap,
    .lightbox-media {
        flex: none;
        width: 100%;
        height: 40vh;
    }

    .lightbox-media iframe {
        min-height: 250px;
    }

    .lightbox-info {
        flex: 1;
        width: 100%;
        max-height: 50vh;
        overflow-y: auto;
    }

    .lightbox-close {
        top: 8px;
        right: 8px;
    }

    .lightbox-prev,
    .lightbox-next {
        display: none;
    }
}

@media (max-width: 480px) {
    .video-grid { gap: 1px; }
}
