/*
 * Private Community Website Software
 * Copyright (c) 2026 Ole Rasmussen
 *
 * Licensed under the MIT License.
 * See the LICENSE file for details.
 */
/* ============================================================
   SocialWeb — Dark Theme CSS
   Desktop-first responsive layout
   System fonts only, no external resources
   ============================================================ */

/* ── CSS Variables — default theme: blue-red ────────────────── */
:root {
    --color-bg:           #1a1a2e;
    --color-surface:      #16213e;
    --color-surface2:     #0f3460;
    --color-accent:       #e94560;
    --color-accent-hover: #c73652;
    --color-text:         #e0e0e0;
    --color-text-muted:   #9090a0;
    --color-border:       #2a2a4a;
    --color-success:      #2ecc71;
    --color-error:        #e74c3c;
    --color-warning:      #f39c12;
    --color-info:         #3498db;
    --color-like:         #e94560;
    --color-badge:        #e94560;

    --font-main:   system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono:   "Courier New", Courier, monospace;

    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:  16px;
    --radius-full: 9999px;

    --shadow-sm:   0 1px 3px rgba(0,0,0,.4);
    --shadow-md:   0 4px 12px rgba(0,0,0,.5);
    --shadow-lg:   0 8px 24px rgba(0,0,0,.6);

    --transition:  0.2s ease;
    --container-w: 1200px;
    --sidebar-w:   300px;
    --nav-height:  50px; /* approximate height of .main-nav; used for scroll-margin */
}

/* ── Theme: gray-orange ─────────────────────────────────────── */
[data-theme="gray-orange"] {
    --color-bg:           #1c1c1c;
    --color-surface:      #252525;
    --color-surface2:     #333333;
    --color-accent:       #e87c2a;
    --color-accent-hover: #c56620;
    --color-text:         #e0e0e0;
    --color-text-muted:   #999999;
    --color-border:       #3a3a3a;
    --color-like:         #e87c2a;
    --color-badge:        #e87c2a;
}

/* ── Theme: purple-red ──────────────────────────────────────── */
[data-theme="purple-red"] {
    --color-bg:           #1a0a2e;
    --color-surface:      #230e3c;
    --color-surface2:     #3d1a60;
    --color-accent:       #e94560;
    --color-accent-hover: #c73652;
    --color-text:         #e0e0e0;
    --color-text-muted:   #9090a0;
    --color-border:       #3a1a5a;
    --color-like:         #e94560;
    --color-badge:        #e94560;
}

/* ── Theme: green-teal ──────────────────────────────────────── */
[data-theme="green-teal"] {
    --color-bg:           #0a1a0f;
    --color-surface:      #0f2418;
    --color-surface2:     #1a3d28;
    --color-accent:       #00bfa5;
    --color-accent-hover: #00a08a;
    --color-text:         #dff5ee;
    --color-text-muted:   #80b09a;
    --color-border:       #1e4030;
    --color-like:         #00bfa5;
    --color-badge:        #00bfa5;
}

/* ── Theme: dark-gold ───────────────────────────────────────── */
[data-theme="dark-gold"] {
    --color-bg:           #111111;
    --color-surface:      #1c1c1c;
    --color-surface2:     #2a2a2a;
    --color-accent:       #f0a500;
    --color-accent-hover: #c98b00;
    --color-text:         #f0e6cc;
    --color-text-muted:   #9a8a6a;
    --color-border:       #333320;
    --color-like:         #f0a500;
    --color-badge:        #f0a500;
}

/* ── Theme: navy-cyan ───────────────────────────────────────── */
[data-theme="navy-cyan"] {
    --color-bg:           #050d1f;
    --color-surface:      #0a1530;
    --color-surface2:     #122040;
    --color-accent:       #00bcd4;
    --color-accent-hover: #0097a7;
    --color-text:         #d0eef5;
    --color-text-muted:   #7090a0;
    --color-border:       #162840;
    --color-like:         #00bcd4;
    --color-badge:        #00bcd4;
}

/* ══════════════════════════════════════════════════════════════
   Light mode overrides — applied when data-mode="light"
   ══════════════════════════════════════════════════════════════ */

/* ── Light: blue-red (default) ──────────────────────────────── */
[data-mode="light"] {
    --color-bg:           #f0f4ff;
    --color-surface:      #ffffff;
    --color-surface2:     #e2e8f5;
    --color-accent:       #d63050;
    --color-accent-hover: #b02040;
    --color-text:         #1a1a2e;
    --color-text-muted:   #5060a0;
    --color-border:       #c0c8e0;
    --color-like:         #d63050;
    --color-badge:        #d63050;

    --shadow-sm:   0 1px 3px rgba(0,0,0,.12);
    --shadow-md:   0 4px 12px rgba(0,0,0,.15);
    --shadow-lg:   0 8px 24px rgba(0,0,0,.18);
}

/* ── Light: gray-orange ─────────────────────────────────────── */
[data-theme="gray-orange"][data-mode="light"] {
    --color-bg:           #f5f5f5;
    --color-surface:      #ffffff;
    --color-surface2:     #eeeeee;
    --color-accent:       #d06020;
    --color-accent-hover: #b05018;
    --color-text:         #1c1c1c;
    --color-text-muted:   #666666;
    --color-border:       #dddddd;
    --color-like:         #d06020;
    --color-badge:        #d06020;
}

/* ── Light: purple-red ──────────────────────────────────────── */
[data-theme="purple-red"][data-mode="light"] {
    --color-bg:           #f8f2ff;
    --color-surface:      #ffffff;
    --color-surface2:     #ede0ff;
    --color-accent:       #c73050;
    --color-accent-hover: #a82040;
    --color-text:         #1a0a2e;
    --color-text-muted:   #6040a0;
    --color-border:       #d0b8e8;
    --color-like:         #c73050;
    --color-badge:        #c73050;
}

/* ── Light: green-teal ──────────────────────────────────────── */
[data-theme="green-teal"][data-mode="light"] {
    --color-bg:           #f0faf5;
    --color-surface:      #ffffff;
    --color-surface2:     #dff5ee;
    --color-accent:       #00897b;
    --color-accent-hover: #00706a;
    --color-text:         #0a1a0f;
    --color-text-muted:   #406050;
    --color-border:       #b0d8cc;
    --color-like:         #00897b;
    --color-badge:        #00897b;
}

/* ── Light: dark-gold ───────────────────────────────────────── */
[data-theme="dark-gold"][data-mode="light"] {
    --color-bg:           #fffbf0;
    --color-surface:      #ffffff;
    --color-surface2:     #fff3cc;
    --color-accent:       #b07800;
    --color-accent-hover: #906000;
    --color-text:         #111111;
    --color-text-muted:   #6a5a3a;
    --color-border:       #e8d8a0;
    --color-like:         #b07800;
    --color-badge:        #b07800;
}

/* ── Light: navy-cyan ───────────────────────────────────────── */
[data-theme="navy-cyan"][data-mode="light"] {
    --color-bg:           #f0f8ff;
    --color-surface:      #ffffff;
    --color-surface2:     #deeef8;
    --color-accent:       #0097a7;
    --color-accent-hover: #007a8a;
    --color-text:         #05101f;
    --color-text-muted:   #405870;
    --color-border:       #b0d4e8;
    --color-like:         #0097a7;
    --color-badge:        #0097a7;
}


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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

img { max-width: 100%; height: auto; display: block; }

ul { list-style: none; }

/* ── Utility ─────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
.muted     { color: var(--color-text-muted); }
.inline-form { display: inline; }

/* ── Container ───────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 0 1rem;
    flex: 1;
}

/* ── Site Header ─────────────────────────────────────────────── */
.site-header {
    background: var(--color-surface);
}

/* Push banner below the fixed nav when a nav is present */
.has-nav.site-header {
    padding-top: var(--nav-height);
}

/* ── Navigation (fixed at very top, always visible) ─────────── */
.main-nav {
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-accent);
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

/* ── Nav pin toggle ──────────────────────────────────────────── */
.nav-pin-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color var(--transition), opacity var(--transition);
    opacity: 0.45;
    line-height: 1;
}

.nav-pin-btn:hover {
    color: var(--color-accent);
    opacity: 1;
}

.nav-pin-btn[aria-pressed="true"] {
    color: var(--color-accent);
    opacity: 1;
}

/* ── Unpinned state: nav scrolls naturally with the page ─────── */
/* position: relative (not sticky) is intentional — "unpinned" means  *
 * the nav behaves as a normal page element and scrolls away,          *
 * giving a clear visual distinction from the pinned (fixed) state.    */
html.nav-unpinned .main-nav {
    position: relative;
}

html.nav-unpinned .has-nav.site-header {
    padding-top: 0;
}

.main-nav ul {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    max-width: var(--container-w);
    margin: 0 auto;
}

.main-nav ul li a {
    display: block;
    padding: 0.65rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* ── Banner (below nav, 1400×250) ────────────────────────────── */
.header-banner {
    background: linear-gradient(135deg, var(--color-surface2) 0%, var(--color-surface) 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 250px;
    max-height: 250px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-banner.has-banner {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Site name overlay — positioned via inline style set from DB */
.site-logo {
    position: absolute;
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    user-select: none;
    line-height: 1.2;
    text-decoration: none;
}

/* ── Badge (unread count) ─────────────────────────────────────── */
.badge {
    display: inline-block;
    background: var(--color-badge);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    vertical-align: middle;
    margin-left: 3px;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1.2rem;
    border-radius: var(--radius-md);
    margin: 0.75rem 0;
    border-left: 4px solid transparent;
    font-size: 0.9rem;
}
.alert-success { background: rgba(46,204,113,.1); border-color: var(--color-success); color: var(--color-success); }
.alert-error   { background: rgba(231,76,60,.1);  border-color: var(--color-error);   color: var(--color-error);   }
.alert-warning { background: rgba(243,156,18,.1); border-color: var(--color-warning); color: var(--color-warning); }
.alert-info    { background: rgba(52,152,219,.1); border-color: var(--color-info);    color: var(--color-info);    }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
    text-align: center;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

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

.btn-secondary { background: var(--color-surface2); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border); color: var(--color-text); }

.btn-success   { background: var(--color-success); color: #fff; }
.btn-danger    { background: var(--color-error);   color: #fff; }
.btn-warning   { background: var(--color-warning); color: #fff; }

.btn-sm  { padding: 0.35rem 0.85rem; font-size: 0.8rem; }
.btn-xs  { padding: 0.2rem 0.6rem;  font-size: 0.75rem; }
.btn-block { display: block; width: 100%; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(233,69,96,.15);
}

textarea { resize: vertical; min-height: 80px; }

.input-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

/* ── Search form ─────────────────────────────────────────────── */
.search-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.search-form .search-input { flex: 1; min-width: 200px; }

/* ── Two-column layout ────────────────────────────────────────── */
.two-col-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    gap: 1.5rem;
    padding: 1.5rem 0;
    max-width: var(--container-w);
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.col-left  { min-width: 0; }
.col-right { min-width: 0; }

/* Reset standalone layout helpers when used inside the two-col-layout */
.col-right.gallery-layout {
    padding: 0;
    max-width: none;
    margin: 0;
}
.col-right .settings-layout {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: none;
    margin: 0;
}
.profile-sidebar .settings-layout {
    padding-left: 0;
    padding-right: 0;
    max-width: none;
    margin: 0;
    margin-top: 2rem;
    text-align: left;
}
.col-right .page-header {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: none;
    margin: 0;
}
.col-right .forum-layout {
    padding: 0;
    max-width: none;
    margin: 0;
}

/* ── Widget ──────────────────────────────────────────────────── */
.widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.widget-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--color-text-muted);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

/* ── Shoutbox ─────────────────────────────────────────────────── */
.shoutbox-messages {
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.shout-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.85rem;
}
.shout-item:last-child { border-bottom: none; }

.shout-avatar {
    display: inline-block;
    border-radius: var(--radius-full);
    vertical-align: middle;
    margin-right: 5px;
}

.shout-user a { color: var(--color-accent); font-weight: 600; }
.shout-time   { font-size: 0.75rem; color: var(--color-text-muted); margin-left: 6px; }
.shout-text   { margin-top: 2px; color: var(--color-text); line-height: 1.4; }

.shoutbox-form {
    display: flex;
    gap: 0.5rem;
}
.shoutbox-form input { flex: 1; padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* ── Site stats ───────────────────────────────────────────────── */
.site-stats {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ── Latest Photos widget ─────────────────────────────────────── */
.latest-photos-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 0.25rem;
}

.latest-photos-row {
    display: flex;
    gap: 6px;
}

.latest-photos-thumb {
    width: 70px;
    height: 70px;
    overflow: hidden;
    border-radius: var(--radius-sm);
    position: relative;
    display: block;
    background: var(--color-surface2);
}

.latest-photos-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition);
}

.latest-photos-thumb:hover img {
    transform: scale(1.07);
}

.latest-photos-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3px 5px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity var(--transition);
}

.latest-photos-thumb:hover .latest-photos-caption {
    opacity: 1;
}

.latest-photos-empty {
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

/* ── Post composer ────────────────────────────────────────────── */
.post-composer {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.post-composer textarea {
    width: 100%;
    min-height: 80px;
    margin-bottom: 0.75rem;
}

.post-composer.drag-over {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 5%, transparent);
    outline: 2px dashed var(--color-accent);
    outline-offset: -2px;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.image-preview img {
    max-width: 120px;
    max-height: 90px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.drag-drop-error {
    font-size: 0.85rem;
    color: var(--color-danger, #c0392b);
}

/* ── Post item ────────────────────────────────────────────────── */
.post-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: border-color var(--transition);
}
.post-item:hover { border-color: var(--color-surface2); }

.post-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.post-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-author {
    font-weight: 700;
    color: var(--color-text);
    font-size: 0.95rem;
}
.post-author:hover { color: var(--color-accent); }

.post-time {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 1px;
}

.post-content {
    margin: 0.75rem 0;
    line-height: 1.65;
    word-break: break-word;
}

.post-media {
    margin: 0.75rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    max-width: 75%;
    position: relative;
}

.post-img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: opacity var(--transition);
}

.post-video {
    width: 100%;
    border-radius: var(--radius-md);
    background: #000;
}

.post-album-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 0.5rem;
}

.post-album-thumbs .album-thumb {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition);
    display: block;
}

.post-album-thumbs .album-thumb:hover {
    opacity: 0.85;
}

.post-album-thumbs .video-thumb-wrap {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition);
}

.post-album-thumbs .video-thumb-wrap:hover {
    opacity: 0.85;
}

.post-album-thumbs .video-thumb-wrap .video-play-icon {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.7rem;
}

.post-album-thumb-wrap {
    position: relative;
    display: inline-block;
}

.post-album-thumb-wrap .ai-badge-mini {
    position: absolute;
    bottom: 2px;
    left: 2px;
}

.post-footer {
    display: flex;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    margin-top: 0.75rem;
}

.btn-like, .btn-comment {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.85rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
    position: relative;
}
.btn-like:hover  { border-color: var(--color-like); color: var(--color-like); }
.btn-like.liked  { background: rgba(233,69,96,.12); border-color: var(--color-like); color: var(--color-like); }
.btn-comment:hover { border-color: var(--color-info); color: var(--color-info); }

/* ── Like / Comment hover tooltip ───────────────────────────── */
.reaction-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface2, #2a2a2a);
    color: var(--color-text, #e0e0e0);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 6px);
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
    white-space: normal;
    max-width: 260px;
    overflow-wrap: break-word;
    pointer-events: none;
    z-index: 200;
    box-shadow: var(--shadow-sm);
    line-height: 1.5;
    text-align: center;
}
.reaction-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-border);
}

/* ── Comments ─────────────────────────────────────────────────── */
.comments-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.comment-item {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.65rem;
    font-size: 0.88rem;
}

.comment-body {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    flex: 1;
}

.comment-author {
    font-weight: 700;
    color: var(--color-text);
    margin-right: 0.4rem;
}

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

.comment-text { margin-top: 3px; }

.comment-item--highlight,
.comment-highlight {
    animation: comment-highlight-fade 2s ease-out forwards;
}

@keyframes comment-highlight-fade {
    0%   { background-color: var(--color-accent-light, #fff3cd); }
    100% { background-color: transparent; }
}

.post-item--highlight {
    animation: post-highlight-fade 2.5s ease-out forwards;
}

@keyframes post-highlight-fade {
    0%   { box-shadow: 0 0 0 3px var(--color-accent, #f0ad4e); background-color: var(--color-accent-light, #fff3cd); }
    100% { box-shadow: none; background-color: transparent; }
}

.comment-footer {
    margin-top: 0.35rem;
}

.btn-like-comment {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.78rem;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    transition: color var(--transition);
}
.btn-like-comment:hover  { color: var(--color-like); }
.btn-like-comment.liked  { color: var(--color-like); font-weight: 600; }
.btn-like-comment:disabled { opacity: 0.6; cursor: default; }

.comment-edit-btn {
    float: right;
    margin-left: 0.4rem;
}

.comment-edited {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-left: 0.3rem;
}

.comment-edit-form {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}
.comment-edit-form input {
    flex: 1;
    min-width: 0;
}
.comment-edit-form .comment-edit-actions {
    display: flex;
    gap: 0.3rem;
}

.comment-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.comment-form input { flex: 1; min-width: 0; }

.blog-comment-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.blog-comment-form input { flex: 1; min-width: 0; }

/* Drag-over state for comment forms */
.comment-form-drag-over,
.comment-form-drag-over * {
    outline: 2px dashed var(--color-accent);
    border-radius: var(--radius-sm);
}

/* Comment image preview strip (inside comment form) */
.comment-image-preview {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}
.comment-attachment-preview-img {
    max-height: 80px;
    max-width: 120px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 2px solid var(--color-border);
}
.comment-attachment-uploading {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Attached image thumbnail inside rendered comment */
.comment-attached-image {
    display: block;
    max-height: 120px;
    max-width: 180px;
    border-radius: var(--radius-sm);
    margin-top: 0.4rem;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--color-border);
    transition: opacity var(--transition);
}
.comment-attached-image:hover { opacity: 0.85; }
.comment-image-trigger { display: inline-block; }

/* ── Comment image picker modal ─────────────────────────────── */
.comment-picker-inner {
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.comment-picker-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
}
.comment-picker-tab {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: background var(--transition), color var(--transition);
}
.comment-picker-tab:hover  { background: var(--color-surface2); color: var(--color-text); }
.comment-picker-tab.active { background: var(--color-accent);   color: #fff; }

/* Drop zone (upload tab) */
.comment-img-drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 2rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    transition: border-color var(--transition), background var(--transition);
    cursor: default;
}
.comment-img-drop-zone.drag-over {
    border-color: var(--color-accent);
    background: rgba(233, 69, 96, 0.06);
}
.comment-img-drop-zone p { margin: 0.3rem 0; font-size: 0.9rem; }
.comment-picker-hint { font-size: 0.78rem; }

.comment-picker-upload-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    background: var(--color-surface2);
    border-radius: var(--radius-sm);
}
.comment-picker-upload-preview img {
    max-height: 100px;
    max-width: 150px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

/* Album list grid */
.comment-picker-album-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    max-height: 45vh;
    overflow-y: auto;
}
.comment-picker-album-item {
    cursor: pointer;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-surface2);
    transition: transform var(--transition), box-shadow var(--transition);
    text-align: center;
}
.comment-picker-album-item:hover { transform: scale(1.03); box-shadow: var(--shadow-md); }
.comment-picker-album-cover {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    font-size: 2rem;
}
.comment-picker-album-cover img { width: 100%; height: 100%; object-fit: cover; }
.comment-picker-album-title { font-size: 0.8rem; padding: 0.2rem 0.4rem; color: var(--color-text); font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.comment-picker-album-count { font-size: 0.72rem; color: var(--color-text-muted); padding-bottom: 0.3rem; }

/* Image grid inside album */
.comment-picker-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.5rem;
    max-height: 40vh;
    overflow-y: auto;
    margin-top: 0.5rem;
}
.comment-picker-img-item {
    cursor: pointer;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 3px solid transparent;
    transition: border-color var(--transition), transform var(--transition);
    aspect-ratio: 1;
}
.comment-picker-img-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comment-picker-img-item:hover   { transform: scale(1.04); }
.comment-picker-img-item.selected { border-color: var(--color-accent); }

.comment-picker-loading { color: var(--color-text-muted); font-size: 0.85rem; }
.comment-picker-empty   { color: var(--color-text-muted); font-size: 0.85rem; }

.load-more-comments {
    font-size: 0.82rem;
    color: var(--color-info);
    display: block;
    margin-bottom: 0.5rem;
}

.load-more-blog-comments {
    font-size: 0.82rem;
    color: var(--color-info);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: block;
    margin-bottom: 0.5rem;
    text-align: left;
}

.load-more-comments-note {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

/* ── Avatars ─────────────────────────────────────────────────── */
.avatar {
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-small  { width: 36px;  height: 36px;  }
.avatar-medium { width: 64px;  height: 64px;  }
.avatar-large  { width: 128px; height: 128px; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 1rem 0;
    justify-content: center;
}

/* ── Load More floating button ───────────────────────────────── */
.load-more-wrap {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    pointer-events: none;
}
.btn-load-more {
    pointer-events: all;
    padding: 0.65rem 2.2rem;
    border-radius: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}
.btn-load-more:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.btn-load-more:disabled {
    opacity: 0.65;
    cursor: default;
}
.load-more-wrap.hidden {
    display: none;
}

.page-link {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 0.88rem;
    transition: all var(--transition);
}
.page-link:hover, .page-link.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem 1rem 0.75rem;
    max-width: var(--container-w);
    margin: 0 auto;
}
.page-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
}

/* ── Members grid ────────────────────────────────────────────── */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 0 1rem 1.5rem;
    max-width: var(--container-w);
    margin: 0 auto;
}

.member-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    transition: border-color var(--transition), transform var(--transition);
}
.member-card:hover { border-color: var(--color-accent); transform: translateY(-2px); }

.member-avatar {
    width: 80px; height: 80px;
    border-radius: var(--radius-full);
    object-fit: cover;
    margin: 0 auto 0.75rem;
    border: 3px solid var(--color-border);
}

.member-username {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text);
    display: block;
    margin-bottom: 0.4rem;
}
.member-last-online {
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}
.member-bio {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}
.member-links {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    font-size: 0.82rem;
}

/* ── Profile layout ──────────────────────────────────────────── */
.profile-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.profile-sidebar {
    text-align: center;
}

.profile-avatar-wrap {
    margin-bottom: 1rem;
}

.profile-avatar {
    width: 200px; height: 200px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid var(--color-accent);
    margin: 0 auto;
}

.profile-username {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.profile-joined {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.profile-bio {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0.5rem 0 1rem;
    text-align: left;
    background: var(--color-bg);
    padding: 0.75rem;
    border-radius: var(--radius-md);
}

.friend-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.friend-status {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    padding: 0.4rem;
}

.profile-gallery-btn {
    display: block;
    margin: 0.75rem 0;
}

.profile-friends h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    text-align: left;
}

.friends-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.friends-grid a img {
    border-radius: var(--radius-full);
    transition: transform var(--transition);
}
.friends-grid a:hover img { transform: scale(1.1); }

.avatar-crop-container {
    margin-top: 1rem;
    text-align: center;
}

.profile-posts h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Gallery ─────────────────────────────────────────────────── */
.gallery-layout {
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.gallery-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.gallery-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.gallery-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}
.gallery-breadcrumb a {
    color: var(--color-accent);
    text-decoration: none;
}
.gallery-breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { opacity: 0.5; }

.album-header-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.inline-form-row {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.hidden { display: none !important; }

/* ── Photos page tabs ────────────────────────────────────────── */
.photos-tabs,
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin: 0 1rem 1.25rem;
}

.photos-tab-btn,
.admin-tab-btn {
    padding: 0.55rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}

.photos-tab-btn:hover,
.admin-tab-btn:hover {
    color: var(--color-text);
}

.photos-tab-btn.active,
.admin-tab-btn.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.photos-tab-panel {
    padding: 0 1rem 1.5rem;
}

.photos-my-albums-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

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

.album-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
}
.album-card:hover { border-color: var(--color-accent); transform: translateY(-2px); }

.album-cover {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.album-card:hover .album-cover img { transform: scale(1.05); }

.album-cover-placeholder { font-size: 3rem; color: var(--color-text-muted); }

.album-title {
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.65rem 0.85rem 0.25rem;
}
.album-count {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    padding: 0 0.85rem 0.65rem;
}
.album-actions {
    padding: 0 0.85rem 0.75rem;
}

.album-view-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.album-description {
    line-height: 1.7;
    word-break: break-word;
    margin-bottom: 1.25rem;
}

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

/* ── Photos hub: Latest Photos grid ─────────────────────────── */
.photos-latest-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.photos-latest-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

.photos-latest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

/* Override masonry absolute positioning for this uniform grid */
.photos-latest-grid .media-item {
    position: relative;
    width: auto;
    aspect-ratio: 1;
}

.photos-latest-grid .media-item .lightbox-trigger {
    display: block;
    height: 100%;
}

.photos-latest-grid .media-item .lightbox-trigger img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photos-load-more-wrap {
    text-align: center;
    margin-top: 1.25rem;
}

/* ── Dropzone ────────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.25rem;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    background: var(--color-surface);
}
.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 5%, transparent);
}
.dropzone-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.dropzone-link { color: var(--color-accent); text-decoration: underline; cursor: pointer; }
.dropzone-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}
.dropzone-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    flex-shrink: 0;
}
.dropzone-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.dropzone-preview-item .preview-remove {
    position: absolute;
    top: 2px; right: 2px;
    background: rgba(0,0,0,.65);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    width: 20px; height: 20px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.dropzone-preview-item .preview-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 0.6rem;
    padding: 2px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dropzone-video-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: var(--color-surface2);
}
.dropzone-upload-row {
    margin-top: 0.85rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    align-items: center;
}
.dropzone-count {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ── Upload progress bar ─────────────────────────────────── */
.upload-progress {
    display: none;
    margin-top: 1rem;
    padding: 0.6rem 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

/* Step indicators */
.upload-progress-steps {
    display: flex;
    align-items: flex-end;
    margin-bottom: 0.65rem;
}
.upload-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}
.upload-step-icon {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    background: var(--color-surface2);
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    line-height: 1;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.upload-step.active .upload-step-icon {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}
.upload-step.done .upload-step-icon {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}
.upload-step-label {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    transition: color 0.3s ease;
}
.upload-step.active .upload-step-label {
    color: var(--color-text);
    font-weight: 600;
}
.upload-step.done .upload-step-label {
    color: var(--color-success);
}
.upload-step-line {
    flex: 1;
    height: 2px;
    background: var(--color-border);
    margin: 0 0.4rem;
    margin-bottom: 1rem;
    transition: background 0.3s ease;
}
.upload-step-line.done {
    background: var(--color-success);
}

.upload-progress-track {
    height: 8px;
    background: var(--color-surface2, var(--color-border));
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--color-accent);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}
.upload-progress-info {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    text-align: center;
}

.upload-rejection-summary {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.upload-rejection-list strong {
    display: block;
    font-size: 0.85rem;
    color: var(--color-error);
    margin-bottom: 0.25rem;
}
.upload-rejection-list ul {
    margin: 0;
    padding-left: 1.2em;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}
.upload-rejection-list li { margin-bottom: 0.1rem; }

/* ── Media item actions (set cover + delete) ──────────────────── */
.media-item-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 5px;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    opacity: 0;
    transition: opacity var(--transition);
}
.media-item:hover .media-item-actions { opacity: 1; }

.set-cover-btn {
    font-size: 0.68rem;
    padding: 2px 6px;
}

/* ── Cover badge ─────────────────────────────────────────────── */
.cover-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    pointer-events: none;
    letter-spacing: 0.3px;
}

.media-item.is-cover {
    border-color: var(--color-accent);
}

/* ── AI Generated badge ─────────────────────────────────────── */
.ai-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    pointer-events: none;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 2;
}

.ai-badge-lightbox {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-left: auto;
}

.ai-toggle-btn {
    margin-left: 6px;
    font-size: 0.7rem;
}
.ai-toggle-btn.active {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #fff;
    border-color: #7c3aed;
}

.ai-generated-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}
.ai-generated-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.ai-badge-mini {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Cover / Avatar crop modal ───────────────────────────────── */
/* ── Info modals (Welcome & How it Works) ────────────────── */
.info-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.info-modal-inner {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.info-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition);
}

.info-modal-close:hover {
    color: var(--color-text);
}

.info-modal-inner h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    text-align: center;
}

.info-modal-tech-title {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-accent) !important;
    text-align: center;
    margin-bottom: 1.5rem !important;
}

.info-modal-subtitle {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-accent);
    text-align: center;
    margin-bottom: 1.5rem;
}

.info-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .info-modal-grid { grid-template-columns: 1fr; }
}

.info-modal-grid h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.info-modal-grid p {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.info-modal-tip {
    border-left: 3px solid var(--color-accent);
    padding: 0.5rem 0.75rem;
    margin: 0.75rem 0 0;
    font-size: 0.83rem;
    color: var(--color-text-muted);
    background: rgba(233,69,96,.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.info-modal-footer-box {
    background: var(--color-surface2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin-top: 1rem;
}

.info-modal-footer-title {
    color: var(--color-accent);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* ── Sidebar quick-links list ────────────────────────────── */
.site-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.site-links-list .btn-link {
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    width: 100%;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}

.site-links-list .btn-link:hover {
    background: var(--color-surface2);
    color: var(--color-accent);
}

.crop-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.crop-modal-inner {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 540px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
.crop-modal-inner h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}
.crop-modal-inner > .muted {
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
#cover-crop-canvas,
#avatar-crop-canvas {
    display: block;
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 2px dashed var(--color-border);
    cursor: crosshair;
    touch-action: none;
    margin: 0 auto;
}

/* ── Banner crop canvas (admin settings) ────────────────────── */
#banner-crop-container {
    display: none;
    margin-top: 1rem;
}

#banner-crop-canvas {
    display: block;
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 2px dashed var(--color-border);
    cursor: crosshair;
    touch-action: none;
    margin: 0 auto;
}

.banner-crop-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Banner overlay editor (admin settings preview) ─────────── */
.banner-overlay-preview {
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 200px;
    background: linear-gradient(135deg, var(--color-surface2) 0%, var(--color-surface) 100%);
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
    margin-bottom: 1rem;
    cursor: default;
}

.banner-overlay-handle {
    position: absolute;
    transform: translate(-50%, -50%);
    font-weight: 800;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: move;
    white-space: nowrap;
    user-select: none;
    line-height: 1.2;
    border: 2px dashed rgba(233,69,96,.6);
}

.banner-overlay-handle:hover {
    border-color: var(--color-accent);
}

.crop-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ── Banner library modal ─────────────────────────────────── */
.banner-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.banner-library-item {
    position: relative;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface2);
    transition: border-color 0.2s;
}

.banner-library-item--active {
    border-color: var(--color-accent);
}

.banner-library-thumb {
    display: block;
    width: 100%;
    height: 80px;
    object-fit: cover;
}

.banner-library-badge {
    position: absolute;
    top: 0.35rem;
    left: 0.35rem;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    pointer-events: none;
}

.banner-library-actions {
    display: flex;
    gap: 0.4rem;
    padding: 0.5rem;
    background: var(--color-surface);
    justify-content: flex-end;
}

.media-grid {
    position: relative;  /* Container for absolute-positioned items in JS-driven masonry layout */
}

.media-load-sentinel {
    height: 1px;
    margin: 0;
}

.media-load-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    padding: 1.5rem 0;
}

.media-load-spinner-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--color-accent);
    animation: media-dot-bounce 1.2s ease-in-out infinite;
}

.media-load-spinner-dot:nth-child(2) { animation-delay: 0.2s; }
.media-load-spinner-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes media-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1; }
}

.media-item {
    position: absolute;  /* placed by masonry_layout.js */
    border-radius: var(--radius-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-sizing: border-box;
}

.media-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}
.media-item:hover img { transform: scale(1.06); }

/* Clip the hover-scale transform to the card boundary.
   overflow: hidden alone does not always clip composited children
   (transform creates a new compositing layer); wrapping the image
   in a block with its own overflow: hidden fixes this in all browsers. */
.media-item .lightbox-trigger {
    display: block;
    overflow: hidden;
    line-height: 0;
}

.media-item .media-delete-form {
    position: absolute;
    top: 4px; right: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}
.media-item:hover .media-delete-form { opacity: 1; }

.media-item-top-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
    opacity: 0;
    transition: opacity var(--transition);
}
.media-item:hover .media-item-top-actions { opacity: 1; }

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

/* Video thumbnail in media grid */
.video-thumb-wrap {
    display: block;
    overflow: hidden;
    position: relative;
    line-height: 0;
}

.media-video-thumb {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.media-item:hover .media-video-thumb { transform: scale(1.06); }

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 3rem;
    height: 3rem;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    pointer-events: none;
    transition: background 0.2s;
}

.video-thumb-wrap:hover .video-play-icon {
    background: rgba(0, 0, 0, 0.85);
}

/* ── Messages (webmail interface) ────────────────────────────── */
.mail-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "toolbar toolbar"
        "sidebar viewer";
    gap: 0;
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 1.5rem 1rem;
    height: calc(100vh - 140px);
    min-height: 520px;
}

/* ── Toolbar ─── */
.mail-toolbar {
    grid-area: toolbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    flex-wrap: wrap;
}

.mail-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.mail-folder-tabs {
    display: flex;
    gap: 0.4rem;
}

.mail-delete-form { margin: 0; }

/* ── Sidebar mailbox list ─── */
.mail-sidebar {
    grid-area: sidebar;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    border-right: none;
    border-radius: 0 0 0 var(--radius-lg);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.mail-list {
    display: flex;
    flex-direction: column;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mail-item a {
    display: block;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    transition: background var(--transition);
    text-decoration: none;
}
.mail-item a:hover,
.mail-item.active a {
    background: var(--color-bg);
}
.mail-item.unread a { border-left: 3px solid var(--color-accent); padding-left: calc(0.85rem - 3px); }
.mail-item.active a { background: var(--color-bg); }

.mail-item-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.mail-item-from {
    flex: 1;
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mail-unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    flex-shrink: 0;
}

.mail-item-subject {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.15rem;
}
.mail-item.unread .mail-item-subject { color: var(--color-text); font-weight: 600; }

.mail-item-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ── Message viewer / compose panel ─── */
.mail-viewer {
    grid-area: viewer;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.mail-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* ── Message viewer ─── */
.mail-msg-wrap { padding: 1.5rem; }

.mail-msg-subject {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--color-text);
}

.mail-msg-meta {
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    width: 100%;
}
.mail-msg-meta th {
    color: var(--color-text-muted);
    font-weight: 600;
    padding: 0.25rem 0.75rem 0.25rem 0;
    white-space: nowrap;
    vertical-align: middle;
}
.mail-msg-meta td {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0;
    color: var(--color-text);
    vertical-align: middle;
}

.mail-msg-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.25rem;
}

.mail-msg-body {
    font-size: 0.92rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--color-text);
}

/* ── Compose form ─── */
.mail-compose-wrap { padding: 1.5rem; }

.mail-compose-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--color-text);
}

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

.mail-compose-form textarea { min-height: 200px; resize: vertical; }

.mail-compose-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ── Notifications ───────────────────────────────────────────── */
.notifications-list {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1rem 1.5rem;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 0.6rem;
    transition: border-color var(--transition);
}
.notif-item.unread {
    border-color: var(--color-accent);
    background: rgba(233,69,96,.05);
}

.notif-body { flex: 1; font-size: 0.9rem; }
.notif-body p { margin-bottom: 3px; }
.notif-body a { font-size: 0.82rem; color: var(--color-info); }
.notif-body .notif-chat-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--color-info);
}

.notif-time {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    margin-left: auto;
}

.notif-delete-btn {
    margin-left: 0.5rem;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition);
}
.notif-item:hover .notif-delete-btn {
    opacity: 1;
}

/* ── Settings ────────────────────────────────────────────────── */
.settings-layout {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.settings-layout h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.settings-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
    text-transform: none;
    letter-spacing: 0;
}

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-page {
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-container { width: 100%; max-width: 420px; }

.auth-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-accent);
    margin-bottom: 0.25rem;
}

.auth-box h2 {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.auth-subtitle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: -1rem;
    margin-bottom: 1.25rem;
}

.auth-form { margin-top: 0.5rem; }

.auth-alt {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

/* ── Admin layout ────────────────────────────────────────────── */
.admin-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.admin-nav {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    height: fit-content;
    position: sticky;
    top: 80px;
}

.admin-nav h3 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--color-text-muted);
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.admin-nav ul { display: flex; flex-direction: column; gap: 3px; }

.admin-nav ul li a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 0.88rem;
    transition: all var(--transition);
}
.admin-nav ul li a:hover,
.admin-nav ul li a.active {
    background: var(--color-bg);
    color: var(--color-accent);
}

.admin-main h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.admin-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.admin-section h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Stats grid (admin) ──────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--color-accent); }

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-accent);
    line-height: 1;
    margin-bottom: 0.4rem;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Tables ──────────────────────────────────────────────────── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.admin-table th {
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--color-bg);
}

.admin-table tr:hover td { background: rgba(255,255,255,.02); }

.admin-table code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--color-bg);
    padding: 2px 6px;
    border-radius: 3px;
}

/* ── Badges (admin) ──────────────────────────────────────────── */
.badge-success { color: var(--color-success); font-size: 0.8rem; font-weight: 700; }
.badge-danger  { color: var(--color-error);   font-size: 0.8rem; font-weight: 700; }
.badge-warning { color: var(--color-warning); font-size: 0.8rem; font-weight: 700; }

/* ── Media admin grid ────────────────────────────────────────── */
.media-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.media-admin-item {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.media-admin-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.media-admin-video-icon {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.media-admin-info {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.media-admin-thumb-link {
    display: block;
    line-height: 0;
    cursor: zoom-in;
}

.media-admin-delete {
    position: absolute;
    top: 4px; right: 4px;
}

/* ── Media admin breadcrumb ─────────────────────────────────── */
.media-admin-breadcrumb {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.media-admin-breadcrumb a {
    color: var(--color-accent);
}

.media-admin-breadcrumb a:hover {
    text-decoration: underline;
}

/* ── Media admin actions bar ─────────────────────────────── */
.media-admin-actions {
    margin-bottom: 1rem;
}

/* ── Lightbox overlay ────────────────────────────────────────── */
#lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    cursor: pointer;
}

#lightbox-overlay img {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    cursor: default;
    animation: fadeInLightbox 0.2s ease;
}

@keyframes fadeInLightbox {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}

.lightbox-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.lightbox-btn {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    width: 44px; height: 44px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}
.lightbox-btn:hover { background: rgba(255,255,255,.25); }

/* ── Lazy image loading ──────────────────────────────────────── */
/* Thumbnails display immediately; medium-res upgrades silently in background */
.lazy-image { display: block; }

/* Batch reveal for items loaded by infinite scroll */
@keyframes media-item-reveal {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.media-item-new {
    animation: media-item-reveal 0.35s ease forwards;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* ── Site footer ─────────────────────────────────────────────── */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-top: auto;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .two-col-layout {
        grid-template-columns: 1fr;
    }
    .col-left {
        order: 2;
    }
    .col-right {
        order: 1;
    }

    .profile-layout,
    .admin-layout,
    .mail-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        grid-template-areas:
            "toolbar"
            "sidebar"
            "viewer";
        height: auto;
    }

    .mail-toolbar { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .mail-sidebar  { border-right: 1px solid var(--color-border); border-radius: 0; max-height: 260px; }
    .mail-viewer   { border-radius: 0 0 var(--radius-lg) var(--radius-lg); min-height: 300px; }

    .profile-sidebar { text-align: left; }

    .admin-nav {
        position: static;
        margin-bottom: 1rem;
    }
    .admin-nav ul {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .main-nav ul {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    .main-nav ul li a {
        padding: 0.5rem 0.65rem;
        font-size: 0.82rem;
    }

    .post-item { border-radius: var(--radius-md); }
    .auth-box  { padding: 1.75rem 1.25rem; }
}

/* ── Media stats overlay (like + comment counts on masonry images) ── */
.media-stats {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 0.4rem;
    padding: 4px 7px;
    background: linear-gradient(transparent, rgba(0,0,0,.65));
    pointer-events: none;
}

.media-stat {
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.2px;
}

/* ── Lightbox inner layout (image + panel side by side) ────────── */
.lightbox-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-height: 82vh;
    cursor: default;
}

.lightbox-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* When the comment panel is open, shrink the image a bit */
#lightbox-overlay.has-panel .lightbox-image-wrap img {
    max-width: 62vw;
    max-height: 82vh;
}

/* Lightbox video element */
.lightbox-video {
    max-width: 100%;
    max-height: 82vh;
    border-radius: var(--radius-md);
    background: #000;
    display: block;
}

#lightbox-overlay.has-panel .lightbox-video {
    max-width: 62vw;
}

/* ── Lightbox comment/like panel ───────────────────────────────── */
.lightbox-panel {
    width: 300px;
    min-width: 260px;
    max-width: 92vw;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    max-height: 82vh;
    overflow: visible;
    cursor: default;
}

.lightbox-comments-list,
.lightbox-comment-form {
    overflow-x: hidden;
}

.lightbox-panel-header {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.btn-like-media {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
    position: relative;
}
.btn-like-media.liked {
    color: var(--color-like);
    border-color: var(--color-like);
    background: rgba(233,69,96,.15);
}
.btn-like-media:hover:not(:disabled) {
    border-color: var(--color-like);
    color: var(--color-like);
}
.btn-like-media:disabled { opacity: 0.6; cursor: default; }

.btn-album-link {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition);
}
.btn-album-link:hover {
    color: var(--color-primary);
}

.lightbox-comment-count-text {
    color: var(--color-text-muted);
    font-size: 0.82rem;
}

.lightbox-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.lightbox-empty-comments {
    color: var(--color-text-muted);
    text-align: center;
    font-size: 0.82rem;
    padding: 0.75rem 0;
}

.lightbox-comment-item {
    display: flex;
    gap: 0.45rem;
    align-items: flex-start;
}

.lightbox-comment-avatar { flex-shrink: 0; }

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

.lightbox-comment-author {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}
.lightbox-comment-author:hover { text-decoration: underline; }

.lightbox-comment-time {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-left: 0.35rem;
}

.lightbox-comment-text {
    font-size: 0.82rem;
    margin-top: 0.15rem;
    word-break: break-word;
    color: var(--color-text);
}

.lightbox-comment-edit-btn {
    float: right;
    margin-left: 0.4rem;
}

.lightbox-comment-form {
    padding: 0.55rem 0.85rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex-shrink: 0;
}

.lightbox-comment-form input[type="text"] {
    flex: 1;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.35rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: var(--font-main);
}
.lightbox-comment-form input[type="text"]:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* Responsive: stack vertically on mobile */
@media (max-width: 820px) {
    .lightbox-inner {
        flex-direction: column;
        align-items: stretch;
        max-height: 90vh;
        overflow-y: auto;
        width: 92vw;
    }

    #lightbox-overlay.has-panel .lightbox-image-wrap img {
        max-width: 92vw;
        max-height: 45vh;
    }

    .lightbox-panel {
        width: 100%;
        max-height: 38vh;
    }
}

/* ── Banner preview (admin/settings.php) ─────────────────────── */
.banner-preview-img {
    max-width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

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

.settings-form .form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.settings-form input[type="file"] {
    display: block;
    color: var(--color-text);
    background: var(--color-surface2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    width: 100%;
    max-width: 400px;
}

/* ═══════════════════════════════════════════════════════════
   Chat Widget — Oxwall-style real-time messenger
   ═══════════════════════════════════════════════════════════ */

/* ── Outer container: bottom-right flex row ─────────────── */
#chat-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    font-family: var(--font-main);
    pointer-events: none; /* passthrough for empty areas */
}

/* ── Chat windows grow to the left ──────────────────────── */
#chat-windows-container {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 4px;
    pointer-events: none; /* windows themselves set pointer-events:all */
}

/* ── Individual chat window ──────────────────────────────── */
.chat-window {
    pointer-events: all;
    width: 310px;
    height: 460px;
    min-width: 220px;
    min-height: 300px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    resize: both;
}

.chat-window-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.65rem;
    background: var(--color-accent);
    flex-shrink: 0;
    cursor: default;
    user-select: none;
}

.chat-window-avatar {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.chat-window-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Pop-out button ──────────────────────────────────────── */
.chat-win-popout-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.15rem 0.3rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: color var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-win-popout-btn:hover {
    color: #fff;
}

.chat-win-popout-btn svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}



/* ── Contact sidebar ─────────────────────────────────────── */
#chat-sidebar {
    pointer-events: all;
    width: 200px;
    max-height: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    overflow: hidden;
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-accent);
    flex-shrink: 0;
}

.chat-sidebar-icon {
    width: 18px;
    height: 18px;
    fill: #fff;
    flex-shrink: 0;
}

.chat-sidebar-title {
    flex: 1;
    font-size: 0.87rem;
    font-weight: 700;
    color: #fff;
}

.chat-sidebar-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.15rem 0.3rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: color var(--transition);
}

.chat-sidebar-close-btn:hover {
    color: #fff;
}

.chat-sidebar-search {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface2);
    flex-shrink: 0;
}

.chat-sidebar-search input {
    width: 100%;
    box-sizing: border-box;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    padding: 0.3rem 0.6rem;
    font-size: 0.82rem;
    outline: none;
    transition: border-color var(--transition);
}

.chat-sidebar-search input:focus {
    border-color: var(--color-accent);
}

.chat-users-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.chat-user-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    transition: background var(--transition);
}

.chat-user-item:hover {
    background: var(--color-surface2);
}

.chat-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.chat-user-name {
    font-size: 0.83rem;
    color: var(--color-text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Toggle button (shown when sidebar is closed) ────────── */
.chat-toggle-btn {
    pointer-events: all;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    transition: background var(--transition), transform var(--transition);
    margin: 0 1.5rem 1.5rem;
    flex-shrink: 0;
}

.chat-toggle-btn:hover {
    background: var(--color-accent-hover);
    transform: scale(1.08);
}

.chat-toggle-btn svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.chat-toggle-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.7rem;
    line-height: 18px;
    animation: badge-pulse 1.8s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.25); }
}

/* ── Message list ─────────────────────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    scroll-behavior: smooth;
    position: relative;
    min-height: 0;
}

/* Drag-and-drop highlight */
.chat-messages.chat-drop-active::after {
    content: '📷  Drop image here';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    border: 2px dashed var(--color-accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    pointer-events: none;
    z-index: 2;
}

/* ── Message bubble ──────────────────────────────────────── */
.chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    max-width: 90%;
}

.chat-msg--mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg--theirs {
    align-self: flex-start;
}

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.chat-bubble {
    padding: 0.45rem 0.75rem 0.3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    max-width: 200px;
    word-break: break-word;
}

.chat-msg--mine .chat-bubble {
    background: var(--color-accent);
    border-bottom-right-radius: var(--radius-sm);
}

.chat-msg--theirs .chat-bubble {
    background: var(--color-surface2);
    border-bottom-left-radius: var(--radius-sm);
}

.chat-bubble-text {
    margin: 0 0 0.2rem;
    font-size: 0.85rem;
    color: #fff;
    line-height: 1.4;
}

.chat-bubble-text a {
    color: inherit;
    text-decoration: underline;
}

.chat-msg--theirs .chat-bubble-text {
    color: var(--color-text);
}

.chat-msg-time {
    display: block;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: right;
}

.chat-msg--theirs .chat-msg-time {
    color: var(--color-text-muted);
    text-align: left;
}

/* ── Inline image preview ─────────────────────────────────── */
.chat-img-wrap {
    position: relative;
    display: inline-block;
    margin-top: 0.3rem;
}

.chat-img-link {
    display: block;
}

.chat-img-preview {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: var(--radius-md);
    display: block;
    cursor: pointer;
    transition: opacity var(--transition);
}

.chat-img-preview:hover {
    opacity: 0.88;
}

.chat-img-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition);
}

.chat-img-wrap:hover .chat-img-delete-btn {
    display: flex;
}

.chat-img-delete-btn:hover {
    background: rgba(200, 30, 30, 0.85);
}

/* ── Compose bar ─────────────────────────────────────────── */
.chat-compose {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.5rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    flex-shrink: 0;
}

.chat-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--color-surface2);
    border: 1px solid var(--color-border);
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color var(--transition), background var(--transition);
    flex-shrink: 0;
}

.chat-upload-label:hover {
    color: var(--color-text);
    background: var(--color-border);
}

.chat-upload-label svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-input {
    flex: 1;
    background: var(--color-surface2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text);
    padding: 0.35rem 0.75rem;
    font-size: 0.83rem;
    font-family: var(--font-main);
    outline: none;
    transition: border-color var(--transition);
    min-width: 0;
}

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

.chat-input::placeholder {
    color: var(--color-text-muted);
}

/* ── Empty state ─────────────────────────────────────────── */
.chat-empty {
    padding: 1.2rem 0.8rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .chat-window {
        width: calc(100vw - 210px);
        min-width: 200px;
    }

    #chat-sidebar {
        width: 160px;
    }
}

/* ── Chat popup page (standalone tab) ───────────────────── */
body.chat-popup-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--color-bg);
}

body.chat-popup-page #chat-widget {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: all;
    align-items: stretch;
}

body.chat-popup-page #chat-windows-container {
    flex: 1;
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

body.chat-popup-page .chat-window {
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
    border: none;
    resize: none;
    flex: 1;
}

/* Hide the pop-out button when already in a popup tab */
body.chat-popup-page .chat-win-popout-btn,
body.chat-popup-page .chat-win-close-btn {
    display: none;
}

body.chat-popup-page .chat-bubble {
    max-width: 55vw;
}

body.chat-popup-page .chat-img-preview {
    width: 50vw;
    max-width: 50vw;
    max-height: none;
    height: auto;
}
/* ── Blog ────────────────────────────────────────────────────── */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.blog-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.blog-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    flex: 1;
}

.blog-editor-wrap {
    margin-bottom: 2rem;
}

.blog-editor-heading {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-accent);
}

.blog-title-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface2);
    color: var(--color-text);
    margin-bottom: 0.75rem;
    box-sizing: border-box;
}

.blog-title-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(233, 69, 96, .2);
}

/* Toolbar */
.blog-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
    background: var(--color-surface2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: none;
}

.blog-tb-btn {
    padding: 0.25rem 0.55rem;
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    cursor: pointer;
    line-height: 1.4;
    transition: background var(--transition), border-color var(--transition);
    min-width: 28px;
}

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

.blog-tb-sep {
    display: inline-block;
    width: 1px;
    background: var(--color-border);
    margin: 0 0.1rem;
    align-self: stretch;
}

/* Editor area */
.blog-editor {
    min-height: 200px;
    max-height: 600px;
    overflow-y: auto;
    padding: 0.85rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    color: var(--color-text);
    font-size: 1rem;
    line-height: 1.7;
    outline: none;
    box-sizing: border-box;
    word-break: break-word;
}

.blog-editor:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(233, 69, 96, .15);
}

/* Placeholder via CSS data-attribute */
.blog-editor--empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-muted);
    pointer-events: none;
    display: block;
}

/* Rendered content in editor & published posts */
.blog-editor img,
.blog-post-content img,
.forum-post-content img,
.album-description img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 0.5rem 0;
}

/* Resize overlay shown when an image is selected inside the blog editor */
.blog-img-resize-overlay {
    display: none;
    position: absolute;
    box-sizing: border-box;
    outline: 2px solid var(--color-accent);
    pointer-events: none;
    z-index: 1000;
}

.blog-img-resize-handle {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 10px;
    height: 10px;
    background: var(--color-accent);
    border: 2px solid #fff;
    border-radius: 2px;
    pointer-events: all;
    cursor: nwse-resize;
}

.blog-editor blockquote,
.blog-post-content blockquote,
.forum-post-content blockquote,
.album-description blockquote {
    border-left: 4px solid var(--color-accent);
    margin: 0.75rem 0;
    padding: 0.5rem 1rem;
    color: var(--color-text-muted);
    background: var(--color-surface2);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.blog-editor a,
.blog-post-content a,
.forum-post-content a,
.album-description a {
    color: var(--color-accent);
    text-decoration: underline;
}
.blog-editor a:hover,
.blog-post-content a:hover,
.forum-post-content a:hover,
.album-description a:hover { color: var(--color-accent-hover); }

.blog-editor h2, .blog-post-content h2, .forum-post-content h2, .album-description h2 { font-size: 1.3rem; font-weight: 700; margin: 1rem 0 .4rem; }
.blog-editor h3, .blog-post-content h3, .forum-post-content h3, .album-description h3 { font-size: 1.1rem; font-weight: 700; margin: .9rem 0 .35rem; }
.blog-editor h4, .blog-post-content h4, .forum-post-content h4, .album-description h4 { font-size: 1rem;   font-weight: 600; margin: .8rem 0 .3rem; }

.blog-editor ul, .blog-editor ol,
.blog-post-content ul, .blog-post-content ol,
.forum-post-content ul, .forum-post-content ol,
.album-description ul, .album-description ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.blog-editor-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.blog-save-status {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.blog-save-status--success { color: var(--color-success); }
.blog-save-status--error   { color: var(--color-error); }
.blog-save-status--info    { color: var(--color-info); }

/* Published posts */
.blog-post {
    margin-bottom: 1.5rem;
    scroll-margin-top: calc(var(--nav-height) + 8px);
}

.blog-post-header {
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.6rem;
}

.blog-post-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.blog-post-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.blog-post-edited {
    margin-left: 0.4rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
}

.blog-post-content {
    line-height: 1.75;
    word-break: break-word;
}

.blog-post-footer {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--color-border);
    padding-top: 0.6rem;
}

/* ── Back-to-top button ─────────────────────────────────────── */
.back-to-top-btn {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 999;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity var(--transition), visibility var(--transition), transform var(--transition), background var(--transition);
}

.back-to-top-btn svg {
    width: 24px;
    height: 24px;
    fill: #fff;
    pointer-events: none;
}

.back-to-top-btn:hover {
    background: var(--color-accent-hover);
    transform: translateY(0);
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ── Delete Account Modal ────────────────────────────────────── */
.delete-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.delete-modal-inner {
    background: var(--color-surface);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.delete-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition);
}

.delete-modal-close:hover {
    color: var(--color-text);
}

.delete-modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--color-error);
}

.delete-modal-lead {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.delete-consequences {
    margin: 0 0 1.25rem 1.25rem;
    padding: 0;
    line-height: 1.8;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.delete-modal-warning {
    background: rgba(231,76,60,.08);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    color: var(--color-error);
}

.delete-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.delete-confirm-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.05em;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface2);
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.delete-confirm-input:focus {
    outline: none;
    border-color: var(--color-error);
    box-shadow: 0 0 0 2px rgba(231,76,60,.2);
}

.delete-confirm-error {
    color: var(--color-error);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ── Danger Zone (settings panel) ───────────────────────────── */
.danger-zone {
    border-color: var(--color-error) !important;
}

.danger-zone h2 {
    color: var(--color-error);
}

.danger-zone-desc {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.danger-zone-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.delete-modal-tip {
    background: rgba(52,152,219,.08);
    border: 1px solid var(--color-info);
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    color: var(--color-text);
    line-height: 1.5;
}

.delete-download-link {
    color: var(--color-info);
    font-weight: 600;
    text-decoration: underline;
}

.delete-download-link:hover {
    opacity: 0.85;
}

/* ── Smiley Picker ────────────────────────────────────────────── */
.smiley-picker-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.smiley-picker-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem 0.4rem;
    color: var(--color-text-muted);
    line-height: 1;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition);
}

.smiley-picker-btn:hover {
    background: var(--color-surface2);
    color: var(--color-text);
    border-color: var(--color-accent);
}

.smiley-dropdown {
    /* Default layout; JS overrides to position:fixed with viewport coordinates
       at open time so the dropdown escapes any overflow:hidden ancestor. */
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 0.4rem;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.2rem;
    z-index: 10000;
    min-width: 210px;
}

.smiley-dropdown.hidden {
    display: none;
}

.smiley-option {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.2rem;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    transition: background var(--transition);
}

.smiley-option:hover {
    background: var(--color-surface2);
}

.smiley-option-emoji {
    font-size: 1.3rem;
    line-height: 1;
}

.smiley-option-code {
    font-size: 0.6rem;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    line-height: 1;
    white-space: nowrap;
}

/* ── Forum Module ─────────────────────────────────────────────── */

/* Layout wrapper */
.forum-layout {
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Top header row: title + new thread button */
.forum-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.forum-header h1 {
    margin: 0;
    font-size: 1.6rem;
}

/* Breadcrumb */
.forum-breadcrumb {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}
.forum-breadcrumb a { color: var(--color-text-muted); }
.forum-breadcrumb a:hover { color: var(--color-accent); }
.forum-breadcrumb .sep { margin: 0 0.4rem; }

/* Category section */
.forum-category {
    margin-bottom: 2rem;
}
.forum-category-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 0.3rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--color-accent);
}
.forum-category-desc {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}
.forum-empty { padding: 0.5rem 0; font-size: 0.9rem; }

/* Forum list */
.forum-list {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.forum-item {
    display: grid;
    grid-template-columns: 2.5rem 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
}
.forum-item:last-child { border-bottom: none; }
.forum-item:hover { background: var(--color-surface2); }

.forum-icon { font-size: 1.5rem; line-height: 1; }

.forum-info { min-width: 0; }
.forum-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text);
    display: block;
}
.forum-title:hover { color: var(--color-accent); }
.forum-desc { font-size: 0.82rem; margin-top: 0.2rem; }

.forum-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    gap: 0.15rem;
}
.forum-last-post {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    min-width: 120px;
    text-align: right;
}

/* Thread list */
.thread-list {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}
.thread-list-header {
    display: grid;
    grid-template-columns: 1fr 120px 80px 130px;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: var(--color-surface2);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}
.thread-item {
    display: grid;
    grid-template-columns: 1fr 120px 80px 130px;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
}
.thread-item:last-child { border-bottom: none; }
.thread-item:hover { background: var(--color-surface2); }
.thread-item.thread-locked { opacity: 0.8; }

.thread-title-col { min-width: 0; }
.thread-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.thread-title:hover { color: var(--color-accent); }
.thread-date { font-size: 0.78rem; display: block; margin-top: 2px; }
.thread-lock-icon { margin-right: 4px; font-size: 0.85rem; }

.thread-author, .thread-replies, .thread-last-post {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
.thread-replies { text-align: center; }
.thread-last-post { text-align: right; white-space: nowrap; }

/* Forum post (thread view) */
.post-list { margin-bottom: 1rem; }

.forum-post {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: border-color var(--transition);
}
.forum-post:hover { border-color: var(--color-surface2); }

.forum-post-author {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
    min-width: 0;
}
.forum-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--color-border);
}
.forum-post-username {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    word-break: break-all;
}
.forum-post-username:hover { color: var(--color-accent); }

.forum-post-body { min-width: 0; }

.forum-post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.forum-post-content {
    line-height: 1.7;
    word-break: break-word;
    font-size: 0.95rem;
}

/* Inline post edit form */
.forum-post-edit-form {
    margin-top: 0.5rem;
}
.forum-edit-textarea {
    width: 100%;
    box-sizing: border-box;
    background: var(--color-surface2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    resize: vertical;
    font-family: inherit;
}
.forum-edit-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* Reply form */
.forum-reply-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 1rem;
}
.forum-reply-form h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
}
.forum-locked-msg {
    margin-top: 1rem;
    font-style: italic;
}

/* New thread / reply form page */
.forum-form-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 800px;
}
.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Admin forum form */
.forum-admin-form { max-width: 700px; }

/* ── Forum unread indicators ─────────────────────────────────── */
.forum-item.has-unread .forum-title { font-weight: 700; }

.thread-item.thread-unread .thread-title { font-weight: 700; color: var(--color-text); }

.thread-unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-badge);
    vertical-align: middle;
    margin-left: 6px;
    flex-shrink: 0;
}

/* Admin table row states */
.row-deleted td { opacity: 0.55; }

/* Responsive: hide some columns on small screens */
@media (max-width: 700px) {
    .forum-item {
        grid-template-columns: 2rem 1fr;
        grid-template-rows: auto auto;
    }
    .forum-stats, .forum-last-post { display: none; }

    .thread-list-header,
    .thread-item {
        grid-template-columns: 1fr 60px;
    }
    .hidden-sm { display: none; }

    .forum-post {
        grid-template-columns: 1fr;
    }
    .forum-post-author {
        flex-direction: row;
        text-align: left;
        justify-content: flex-start;
    }
}

/* ── Forum post image thumbnail ──────────────────────────────── */
.forum-post-image {
    margin-top: 0.75rem;
}

.forum-post-thumb {
    max-width: 220px;
    max-height: 180px;
    width: auto;
    height: auto;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    display: block;
    object-fit: cover;
    transition: opacity var(--transition), border-color var(--transition);
    cursor: pointer;
}

.forum-post-thumb:hover {
    opacity: 0.85;
    border-color: var(--color-accent);
}

/* ── Forum image picker (form area) ─────────────────────────── */
.forum-image-picker-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

.forum-image-preview {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.forum-image-preview-inner {
    position: relative;
    display: inline-block;
}

.forum-image-remove-btn {
    position: absolute;
    top: -0.4rem;
    right: -0.4rem;
    background: var(--color-danger, #e74c3c);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.forum-image-remove-btn:hover {
    background: var(--color-danger-dark, #c0392b);
}

/* ── Gallery picker overlay ──────────────────────────────────── */
.gallery-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.gallery-picker-inner {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gallery-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.gallery-picker-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.gallery-picker-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0 0.25rem;
}

.gallery-picker-close:hover { color: var(--color-text); }

.gallery-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    grid-auto-rows: minmax(80px, auto);
    gap: 0.5rem;
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.gallery-picker-loading,
.gallery-picker-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-text-muted);
    padding: 1.5rem 0;
    font-size: 0.9rem;
}

.gallery-picker-item {
    background: none;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    aspect-ratio: 1;
    transition: border-color var(--transition), transform var(--transition);
}

.gallery-picker-item:hover {
    border-color: var(--color-accent);
    transform: scale(1.04);
}

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

.gallery-picker-load-more {
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    flex-shrink: 0;
}

/* ── Video page ──────────────────────────────────────────────── */
.video-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.video-upload-panel {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.video-upload-panel h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

/* 3-column video grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .video-grid { grid-template-columns: 1fr; }
}

.video-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .18s, transform .18s;
}

.video-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.video-card-thumb {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
    background: #111;
}

.video-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .25s;
}

.video-card:hover .video-card-thumb img {
    transform: scale(1.05);
}

.video-card-thumb .video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,.7);
    pointer-events: none;
    transition: transform .18s;
}

.video-card:hover .video-card-thumb .video-play-icon {
    transform: translate(-50%, -50%) scale(1.15);
}

.video-duration {
    position: absolute;
    bottom: .4rem;
    right: .5rem;
    background: rgba(0,0,0,.72);
    color: #fff;
    font-size: .72rem;
    padding: .1rem .35rem;
    border-radius: 3px;
    pointer-events: none;
}

.video-card-info {
    padding: .6rem .75rem .75rem;
}

.video-card-desc {
    margin: 0 0 .4rem;
    font-size: .88rem;
    line-height: 1.4;
    color: var(--color-text);
    min-height: 1.2em;
}

.video-card-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .78rem;
    flex-wrap: wrap;
}

.video-card-user {
    display: flex;
    align-items: center;
    gap: .3rem;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.video-card-user:hover { text-decoration: underline; }

.video-card-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* ── Video playback page ─────────────────────────────────────── */
.video-play-wrap {
    max-width: 900px;
    margin: 0 auto;
}

.video-play-back {
    margin-bottom: .75rem;
}

.video-player-box {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

.video-player {
    width: 100%;
    max-height: 540px;
    display: block;
}

.video-play-meta {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.video-play-uploader {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .75rem;
}

.video-play-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.video-play-username {
    font-weight: 700;
    color: var(--color-accent);
    text-decoration: none;
    display: block;
}

.video-play-username:hover { text-decoration: underline; }

.video-play-date {
    font-size: .8rem;
}

.video-play-owner-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}

.video-play-description {
    font-size: .95rem;
    line-height: 1.6;
    margin: .5rem 0;
    white-space: pre-wrap;
}

.video-play-duration {
    font-size: .82rem;
    margin: .25rem 0 0;
}

.video-edit-desc-form {
    margin-top: .5rem;
    margin-bottom: .75rem;
}

.video-edit-desc-form textarea {
    width: 100%;
    resize: vertical;
}

/* ── Video card stats overlay (video.php grid) ────────────────── */
.video-card-stats {
    position: absolute;
    bottom: .4rem;
    left: .5rem;
    display: flex;
    gap: .35rem;
    pointer-events: none;
}

.video-card-stat {
    background: rgba(0,0,0,.72);
    color: #fff;
    font-size: .72rem;
    padding: .1rem .35rem;
    border-radius: 3px;
}

/* ── Video playback: like button + actions bar ────────────────── */
.video-play-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--color-border);
}

.video-comment-count-label {
    font-size: .85rem;
}

/* ── Video playback: comments section ────────────────────────── */
.video-play-comments {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}

.video-comments-heading {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .75rem;
}

.video-comment-form {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
}

.video-comment-input {
    flex: 1;
}

.video-comments-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.video-comments-empty {
    text-align: center;
    font-size: .9rem;
}

.video-comment-item {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
}

.video-comment-avatar-link {
    flex-shrink: 0;
}

.video-comment-body {
    flex: 1;
}

.video-comment-author {
    font-weight: 700;
    color: var(--color-accent);
    text-decoration: none;
    margin-right: .4rem;
}

.video-comment-author:hover { text-decoration: underline; }

.video-comment-time {
    font-size: .78rem;
}

.video-comment-text {
    margin: .2rem 0 0;
    font-size: .9rem;
    word-break: break-word;
}

/* ══════════════════════════════════════════════════════════════════
   Webmail improvements — thread view, attachments, drafts, pagination
   ══════════════════════════════════════════════════════════════════ */

/* ── Thread count badge ── */
.mail-thread-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--color-border);
    color: var(--color-text-muted);
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* ── Draft badge ── */
.mail-draft-badge {
    display: inline-block;
    padding: 0 4px;
    background: #e8a200;
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    vertical-align: middle;
    margin-right: 2px;
}
.mail-item.draft .mail-item-from { color: var(--color-text-muted); }

/* ── Sidebar pagination ── */
.mail-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-top: 1px solid var(--color-border);
}
.mail-page-info {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.btn-xs {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
}

/* ── Thread conversation view ── */
.mail-thread-wrap {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 1.25rem 1.25rem 0;
}

.mail-thread-subject {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.mail-thread-msg {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 0.85rem;
    overflow: hidden;
}

.mail-thread-msg--mine {
    border-left: 3px solid var(--color-accent);
}

.mail-thread-msg-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.83rem;
    flex-wrap: wrap;
}

.mail-thread-msg-from {
    font-weight: 700;
    color: var(--color-text);
}

.mail-thread-msg-to {
    color: var(--color-text-muted);
    flex: 1;
}

.mail-thread-msg-date {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.mail-thread-msg-body {
    padding: 0.85rem;
    font-size: 0.9rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--color-text);
}

/* ── Message attachments in thread view ── */
.mail-thread-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem 0.85rem;
    border-top: 1px solid var(--color-border);
}

.mail-attachment-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    max-width: 120px;
}

.mail-attachment-thumb {
    width: 110px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    cursor: zoom-in;
    transition: opacity var(--transition);
}
.mail-attachment-thumb:hover { opacity: 0.85; }

.mail-attachment-name {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

/* ── Quick reply ── */
.mail-quick-reply {
    margin: 0.5rem 0 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
}

.mail-quick-reply-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 0.85rem;
    border: none;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.55;
    background: transparent;
    color: var(--color-text);
    min-height: 80px;
    outline: none;
    overflow: hidden;
}

.mail-quick-reply-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

/* ── Compose attachment area ── */
.mail-attach-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mail-attach-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

/* Textarea drag-over visual feedback */
#compose-body.drag-over {
    outline: 2px dashed var(--color-accent);
    outline-offset: 2px;
}

/* ── Attachment preview list (compose form) ── */
.attach-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.attach-preview-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    max-width: 220px;
}

.attach-preview-item.attach-pending { opacity: 0.6; }

.attach-preview-item.attach-error {
    border-color: var(--color-danger, #dc3545);
    background: rgba(220, 53, 69, 0.06);
}

.attach-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.attach-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}

.attach-status {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.attach-error-msg {
    color: var(--color-danger, #dc3545);
}

.attach-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}
.attach-remove-btn:hover { color: var(--color-danger, #dc3545); }

/* ── @mention autocomplete dropdown ──────────────────────────────────────── */
.mention-dropdown {
    position: absolute;
    z-index: 9999;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #ddd);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 180px;
    max-width: 280px;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}
.mention-dropdown.hidden { display: none; }

.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.1s;
}
.mention-item:hover,
.mention-item--active {
    background: var(--color-hover, #f0f0f0);
}
.mention-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.mention-username {
    font-weight: 600;
    color: var(--color-primary, #1a73e8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Rendered @mention links inside comment text */
a.mention {
    color: var(--color-primary, #1a73e8);
    font-weight: 600;
    text-decoration: none;
}
a.mention:hover { text-decoration: underline; }


/* ── File Share ───────────────────────────────────────────────────────────── */
.fileshare-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    max-width: var(--container-w);
    margin: 1.5rem auto;
    padding: 0 1rem;
}

/* Sidebar */
.fileshare-sidebar {
    flex-shrink: 0;
    width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.fileshare-sidebar-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin: 0 0 0.75rem;
}

.fileshare-folder-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fileshare-folder-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background var(--transition);
    gap: 0.4rem;
}
.fileshare-folder-link:hover { background: var(--color-surface2); }
.fileshare-folder-link.active {
    background: var(--color-accent);
    color: #fff;
}

.fileshare-folder-count {
    font-size: 0.75rem;
    color: inherit;
    opacity: 0.7;
    margin-left: auto;
}

.fileshare-no-folders {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    padding: 0.25rem 0.6rem;
}

/* Main area */
.fileshare-main {
    flex: 1;
    min-width: 0;
}

.fileshare-header h1 {
    margin: 0 0 1rem;
}

/* Upload section */
.fileshare-upload-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.fileshare-upload-section h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
}

.fileshare-upload-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.fileshare-upload-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.fileshare-upload-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

.fileshare-hint {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.fileshare-file-input {
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.5rem;
    font-size: 0.875rem;
}

.fileshare-select {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
}

/* Files section */
.fileshare-files-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.fileshare-files-section h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fileshare-total {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text-muted);
}

.fileshare-empty {
    color: var(--color-text-muted);
    font-style: italic;
}

.fileshare-table-wrap {
    overflow-x: auto;
}

.fileshare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.fileshare-table th {
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--color-bg);
}

.fileshare-table tbody tr:hover {
    background: var(--color-surface2);
}

.fileshare-filename {
    word-break: break-all;
    max-width: 280px;
}

.fileshare-size {
    white-space: nowrap;
    color: var(--color-text-muted);
}

.fileshare-date {
    white-space: nowrap;
    color: var(--color-text-muted);
    font-size: 0.82rem;
}

.fileshare-no-folder {
    color: var(--color-text-muted);
}

.fileshare-download-btn {
    white-space: nowrap;
}

/* Admin file share */
.fileshare-admin-create-form {
    display: inline-block;
}

.fileshare-admin-create-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.fileshare-admin-folder-input {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    min-width: 220px;
}

.fileshare-admin-count {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.fileshare-admin-table-wrap {
    overflow-x: auto;
}

.fileshare-admin-filename {
    word-break: break-all;
    max-width: 260px;
}

.fileshare-admin-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fileshare-admin-move-form {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.fileshare-admin-move-select {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 640px) {
    .fileshare-layout {
        flex-direction: column;
    }
    .fileshare-sidebar {
        width: 100%;
    }
    .fileshare-upload-row {
        flex-direction: column;
    }
}
