/* =============================================
   MyFxBoard - Main Stylesheet
   ============================================= */

/* Page Layout */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 0 0 2rem 0;
    background-color: #f5f5f5;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-paper {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
    padding: 8px 16px;
}

.header-logo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.header-logo {
    max-height: 60px;
    width: auto;
    display: block;
}

/* Header Auth */
.header-auth {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.header-username {
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.header-login-btn {
    display: inline-block;
    padding: 6px 18px;
    border: 1.5px solid rgba(255,255,255,0.6);
    border-radius: 4px;
    color: #ffffff !important;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none !important;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

    .header-login-btn:hover {
        background: rgba(255,255,255,0.15);
        border-color: #ffffff;
    }

/* TopBar */
.topbar-nav {
    background-color: #0f3460;
}

.topbar-paper {
    background-color: #0f3460 !important;
}

.topbar-toolbar {
    background-color: #0f3460 !important;
}

.topbar-link {
    color: #e0e0e0 !important;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-decoration: none !important;
    padding: 4px 8px;
    transition: color 0.2s;
}

    .topbar-link:hover {
        color: #ffffff !important;
        background: rgba(255,255,255,0.12);
        border-radius: 4px;
    }

.topbar-link--active {
        color: #ffffff !important;
        background: rgba(255,255,255,0.18);
        border-radius: 4px;
        border-bottom: 2px solid #90caf9;
    }

.topbar-manage-btn {
        display: flex;
        align-items: center;
        padding: 3px 10px !important;
        border: 1px solid rgba(255,255,255,0.35) !important;
        border-radius: 4px;
        opacity: 0.85;
    }

.topbar-manage-btn:hover {
        opacity: 1;
        background: rgba(255,255,255,0.15) !important;
        border-color: rgba(255,255,255,0.6) !important;
    }

.topbar-sep {
    color: #546e7a;
    font-size: 0.8rem;
    padding: 0 2px;
}

/* Home Page */
.home-container {
    padding: 1rem 0 3rem;
}

.welcome-text {
    font-size: 1rem !important;
    color: #1a237e;
    font-weight: 500 !important;
}

/* Slideshow */
.slideshow-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.slideshow-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    background: #1a1a2e;
}

.slide {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.6s ease;
}

    .slide.active {
        display: block;
        animation: fadeIn 0.6s ease;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    color: white;
    border: none;
    padding: 12px 18px;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    z-index: 10;
}

    .slide-btn:hover {
        background: rgba(0,0,0,0.7);
    }

    .slide-btn.prev {
        left: 10px;
    }

    .slide-btn.next {
        right: 10px;
    }

.slide-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.2s;
}

    .dot.active-dot {
        background: white;
    }

/* Action Links */
.action-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.action-link-item {
    font-size: 1.1rem !important;
    font-weight: 500 !important;
}

.action-sep {
    color: #9e9e9e;
    font-size: 1.1rem;
}

/* Board Cards */
.board-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

    .board-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    }

.board-nav-card {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: center;
}

    .board-nav-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
    }

/* Board Hero */
.board-hero {
    background: linear-gradient(135deg, #1a237e, #0d47a1);
    color: white;
    padding: 2rem;
    border-radius: 12px;
}

.board-title {
    color: white !important;
}

.board-desc {
    color: rgba(255,255,255,0.85) !important;
}

/* Post Styles */
.post-content {
    line-height: 1.7;
    font-size: 0.95rem;
}

    .post-content p {
        margin-bottom: 0.75rem;
    }

.post-preview {
    max-height: 120px;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.post-list-item {
    border-left: 4px solid transparent;
    transition: border-color 0.2s;
}

    .post-list-item:hover {
        border-left-color: #1976d2;
    }

.post-title-link {
    font-weight: 500 !important;
}

.reply-card {
    margin-left: 2rem;
    border-left: 3px solid #e3f2fd;
}

/* HTML Editor */
.html-editor-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.my-html-editor {
    background: white;
}

.quill-editor-container {
    min-height: 150px;
    max-height: 400px;
}

.ql-toolbar {
    border-bottom: 1px solid #e0e0e0 !important;
    background: #fafafa;
}

.ql-container {
    border: none !important;
    font-size: 0.95rem;
    font-family: inherit;
}

.ql-editor {
    min-height: 120px;
    padding: 12px 15px;
}

/* Chat */
.chat-window {
    height: 400px;
    overflow-y: auto;
    padding: 12px;
    background: #fafafa;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chat-bubble {
    background: white;
    border-radius: 12px;
    padding: 8px 12px;
    max-width: 80%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.chat-author {
    font-weight: 600;
    font-size: 0.8rem;
    color: #1976d2;
    margin-right: 8px;
}

.chat-time {
    font-size: 0.72rem;
    color: #9e9e9e;
}

.chat-text {
    margin-top: 2px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9e9e9e;
}

/* Picture Card */
.picture-card {
    height: 100%;
    transition: transform 0.2s;
}

    .picture-card:hover {
        transform: translateY(-3px);
    }

/* Footer */
div[style*="background-color: black"] p {
    margin: 0;
    padding: 2px 0;
}

/* Blazor error */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

/* =============================================
   User Menu Dropdown
   ============================================= */
.user-menu-wrapper {
    position: relative;
    display: inline-block;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1.5px solid #ffffff;
    border-radius: 24px;
    padding: 4px 12px 4px 6px;
    cursor: pointer;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: background 0.2s;
    text-shadow: none;
}

    .user-menu-trigger:hover {
        background: rgba(255,255,255,0.18);
    }

.user-menu-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #ffffff;
}

.user-menu-name {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-caret {
    font-size: 0.7rem;
    opacity: 0.8;
}

.user-menu-dropdown {
    position: fixed;
    top: var(--user-menu-top, 60px);
    right: 16px;
    min-width: 185px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    overflow: hidden;
    z-index: 99999;
    animation: dropdownFadeIn 0.12s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #1a1a2e !important;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: background 0.15s;
    cursor: pointer;
}

    .user-menu-item:hover {
        background: #f0f4ff;
        color: #0f3460 !important;
    }

.user-menu-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.user-menu-divider {
    height: 1px;
    background: #e8e8e8;
    margin: 2px 0;
}

.user-menu-admin {
    color: #7b1fa2 !important;
    font-weight: 600;
}

    .user-menu-admin:hover {
        background: #f3e5f5 !important;
        color: #6a0080 !important;
    }

.user-menu-logout {
    color: #c62828 !important;
}

    .user-menu-logout:hover {
        background: #ffebee !important;
        color: #b71c1c !important;
    }

/* Board Stats Row */
.board-stats-row {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 24px;
    padding: 5px 16px;
    margin-top: 4px;
}

.board-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
}

.board-stat-emoji {
    font-size: 1rem;
    line-height: 1;
}

.board-stat-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.board-stat-label {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.75);
    letter-spacing: 0.02em;
}

.board-stat-sep {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.25);
}

.board-stats-row--light {
    background: #f5f5f5;
    border-color: #e0e0e0;
}

.board-stats-row--light .board-stat-count {
    color: #1a1a2e;
}

.board-stats-row--light .board-stat-sep {
    background: #d0d0d0;
}

/* Message Board Table */
.mb-topic-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.mb-topic-table thead tr {
    background-color: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
}

.mb-topic-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: #555;
    text-transform: uppercase;
}

.mb-topic-table th.text-center,
.mb-topic-table td.text-center {
    text-align: center;
}

.mb-topic-table td {
    padding: 8px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #eeeeee;
}

.mb-topic-table .mb-data-row:hover td {
    background-color: #f0f4ff;
}

.mb-topic-table .mb-data-row:nth-child(even) td {
    background-color: #fafafa;
}

.mb-topic-table .mb-data-row:nth-child(even):hover td {
    background-color: #f0f4ff;
}

.mb-topic-table .mb-separator-row td {
    background: #f0f0f0;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #555;
    border-bottom: none;
}

.mb-topic-table .mb-separator-row.sticky-sep td {
    background: #fff8e1;
    color: #e65100;
}

/* Page inner padding */
.page-content-inner {
    padding: 0 1rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   PROFILE PAGE
══════════════════════════════════════════════════════════════════════════ */

.prof-page {
    background: #f5f5f5;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* Cover photo */
.prof-cover {
    position: relative;
    height: 220px;
    background: linear-gradient(135deg, #1a237e 0%, #0d47a1 60%, #1565c0 100%);
    background-size: cover;
    background-position: center;
}

.prof-cover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.25);
}

.prof-cover-edit {
    position: absolute;
    bottom: 12px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s;
}

.prof-cover-edit:hover { background: rgba(0,0,0,0.75); }

/* Avatar row */
.prof-avatar-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 0 24px 16px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.prof-avatar-wrap {
    position: relative;
    margin-top: -48px;
    flex-shrink: 0;
}

.prof-avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    display: block;
}

.prof-settings-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.prof-avatar-edit-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1976d2;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid #fff;
    transition: background 0.15s;
}

.prof-avatar-edit-btn:hover { background: #1565c0; }

/* Online presence dot */
.prof-online-dot {
    position: absolute;
    bottom: 6px;
    left: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #43a047;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(67,160,71,0.35);
}

.prof-avatar-info {
    padding-bottom: 4px;
    flex: 1;
    min-width: 0;
}

.prof-display-name {
    font-weight: 700 !important;
    line-height: 1.2;
}

.prof-stat-pill {
    font-size: 0.78rem;
    color: #666;
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 12px;
}

/* Tabs */
.prof-tabs {
    background: #fff !important;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 24px;
}

.prof-tab-panel {
    padding: 24px 0 !important;
}

/* Stats rows */
.prof-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.875rem;
}

.prof-stats-row:last-child { border-bottom: none; }

/* Detail rows (about card) */
.prof-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.prof-detail-icon {
    color: #90a4ae;
    flex-shrink: 0;
}

/* Activity feed */
.prof-activity-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.prof-activity-row:last-child { border-bottom: none; }

.prof-activity-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.prof-activity-body { flex: 1; min-width: 0; }

/* Board cards (overview mini) */
.prof-board-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    height: 100%;
}

/* Board cards (boards tab) */
.prof-board-full-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.prof-board-banner {
    border-radius: 8px 8px 0 0;
    min-height: 60px;
    display: flex;
    align-items: flex-end;
}

/* Friends */
.prof-friend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.prof-friend-row:last-child { border-bottom: none; }

.prof-friend-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e0e0e0;
}

.prof-friend-info { flex: 1; min-width: 0; }

/* Media grid */
.prof-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.prof-media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}

.prof-media-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.prof-media-item:hover .prof-media-thumb { transform: scale(1.05); }

.prof-media-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.prof-media-item:hover .prof-media-overlay { opacity: 1; }

/* Settings upload label */
.prof-upload-label {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.prof-upload-label:hover { background: #bbdefb; }

/* ── CreateBoard – category chip input ─────────────────────────────────── */

.cb-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 48px;
    padding: 6px 10px;
    border: 1px solid rgba(0,0,0,0.23);
    border-radius: 4px;
    cursor: text;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
}

.cb-chips-wrap--focused {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 1px var(--mud-palette-primary);
}

.cb-chip {
    margin: 2px 0 !important;
}

.cb-chip-input {
    flex: 1 1 120px;
    min-width: 80px;
}

/* Strip MudAutocomplete's extra padding so it sits flush in the chip strip */
.cb-chip-input .mud-input-control > .mud-input {
    padding: 0 !important;
    margin: 0 !important;
    min-height: unset !important;
}

.cb-chip-input .mud-input-slot {
    padding: 2px 0 !important;
}

/* ── TopBar join / leave buttons ───────────────────────────────────────── */

.topbar-join-btn {
    color: #fff !important;
    background-color: #1976d2 !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    padding: 0 12px !important;
    height: 28px !important;
    min-width: unset !important;
}

.topbar-leave-btn {
    color: #e53935 !important;
    border-color: #e53935 !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    padding: 0 12px !important;
    height: 28px !important;
    min-width: unset !important;
}

.topbar-leave-btn:hover {
    background-color: rgba(229,57,53,0.08) !important;
}

/* ── ManageBoardImages ─────────────────────────────────────── */
.bimg-preview-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bimg-preview {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.bimg-preview--contain {
    object-fit: contain;
}

.bimg-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 160px;
    background: #f5f5f5;
}

.bimg-preview-label {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #43a047;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.05em;
}

.bimg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.bimg-thumb {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    background: #111;
    transition: border-color 0.15s;
}

.bimg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.15s;
}

.bimg-thumb--active {
    border-color: #43a047;
}

.bimg-thumb:hover img {
    opacity: 0.55;
}

.bimg-thumb-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 4px 5px;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.15s;
}

.bimg-thumb:hover .bimg-thumb-overlay {
    opacity: 1;
}

.bimg-thumb-name {
    font-size: 0.68rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bimg-thumb-date {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 2px;
}

.bimg-thumb-actions {
    display: flex;
    gap: 2px;
    align-items: center;
}

.bimg-confirm-dialog {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* ── ManageBoard_Images ──────────────────────────────────── */

.bimg-active-preview {
    width: 100%;
    height: 180px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    position: relative;
}

.bimg-active-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.bimg-active-preview--title img {
    object-fit: contain;
    background: #f5f5f5;
}

.bimg-active-badge {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.bimg-empty-preview {
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #bbb;
}

.bimg-upload-zone {
    border: 2px dashed #90caf9;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.bimg-upload-zone:hover,
.bimg-upload-zone--drag {
    background: rgba(144,202,249,0.1);
    border-color: #42a5f5;
}

.bimg-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.bimg-thumb {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: default;
    background: #eee;
    aspect-ratio: 1;
}

.bimg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bimg-thumb--active {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76,175,80,0.3);
}

.bimg-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.bimg-thumb:hover .bimg-thumb-overlay {
    opacity: 1;
}

.bimg-thumb-name {
    display: block;
    font-size: 0.65rem;
    text-align: center;
    padding: 2px 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(255,255,255,0.85);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* Upload Files page */
.upload-dropzone {
    border: 2px dashed #b0bec5;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafafa;
}

.upload-dropzone:hover {
    border-color: #1976d2;
    background: #f0f7ff;
}

.upload-entry {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.upload-entry-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.upload-file-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.upload-file-icon-wrap {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.upload-preview-thumb-wrap {
    display: inline-block;
    margin-right: 6px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.upload-preview-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    display: block;
    transition: opacity 0.15s;
}

.upload-preview-thumb:hover {
    opacity: 0.8;
}

.upload-filename {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    font-size: 0.75rem;
}

/* Picture Detail */
.pic-detail-img-wrap {
    width: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 70vh;
    overflow: hidden;
}

.pic-detail-img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.pic-nav-strip {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.pic-nav-thumb {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    max-width: 45%;
    transition: background 0.15s;
}

.pic-nav-thumb:hover {
    background: #eeeeee;
}

.pic-nav-thumb img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.pic-nav-thumb span {
    font-size: 0.85rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pic-nav-thumb--right {
    flex-direction: row-reverse;
    margin-left: auto;
    text-align: right;
}

/* ── ManageBoardImages ──────────────────────────────────────────────────── */

.bimg-preview-wrap {
    position: relative;
    width: 100%;
    height: 180px;
    background: #f0f0f0;
    overflow: hidden;
}

.bimg-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bimg-preview--contain {
    object-fit: contain;
    background: #1a1a2e;
}

.bimg-preview-empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #90a4ae;
}

.bimg-active-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(76,175,80,0.85);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.03em;
}

/* Drop zone */
.bimg-dropzone {
    border: 2px dashed #b0bec5;
    border-radius: 8px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #fafafa;
}

.bimg-dropzone--over {
    border-color: #1976d2;
    background: #e3f2fd;
}

.bimg-dropzone-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #78909c;
    font-size: 0.875rem;
    user-select: none;
}

/* Past uploads grid */
.bimg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.bimg-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s;
}

.bimg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bimg-thumb--active {
    border-color: #4caf50;
}

.bimg-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.bimg-thumb:hover .bimg-thumb-overlay {
    opacity: 1;
}

.bimg-thumb-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.bimg-thumb-name {
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.bimg-thumb-date {
    color: rgba(255,255,255,0.7);
    font-size: 0.6rem;
    display: block;
}

.bimg-thumb-actions {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
}

.bimg-thumb-active-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(76,175,80,0.9);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    pointer-events: none;
}

/* Delete confirm dialog */
.bimg-dialog-wrap {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* ManageBoard – floating save bar */
.manage-save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 12px 32px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    z-index: 100;
}

/* ══════════════════════════════════════════════════════════════════════════
   USER HOVER POPUP
══════════════════════════════════════════════════════════════════════════ */

/* ── Popup card ─────────────────────────────────────────────────────────── */
.user-popup {
    --popup-slide-from: -6px;          /* overridden by JS per open direction */
    position: fixed;
    z-index: 10000;
    display: none;                     /* JS sets display:block before measuring */
    min-width: 240px;
    max-width: 290px;
    padding: 14px 16px 12px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    box-shadow:
        0 4px 6px rgba(0,0,0,.07),
        0 12px 28px rgba(0,0,0,.18),
        0 0 0 1px rgba(0,0,0,.04);
    opacity: 0;
    pointer-events: none;
    transform: translateY(var(--popup-slide-from));
    transition: opacity .18s ease, transform .18s ease;
}

.user-popup.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* ── Close button ───────────────────────────────────────────────────────── */
.popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--mud-palette-text-secondary);
    font-size: 14px;
    line-height: 1;
    opacity: .55;
    transition: opacity .1s, background .1s;
    padding: 0;
}

.popup-close:hover {
    opacity: 1;
    background: var(--mud-palette-action-hover);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.popup-header {
    display: flex;
    align-items: center;
    padding-right: 18px;               /* room for close btn */
}

.popup-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

.popup-username {
    font-weight: 700;
    font-size: .97rem;
}

.popup-firstname {
    font-size: .82rem;
    color: var(--mud-palette-text-secondary);
}

.popup-moderator-badge {
    display: inline-block;
    margin-top: 3px;
    font-size: .7rem;
    background: var(--mud-palette-warning);
    color: #000;
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 600;
}

/* ── Divider ────────────────────────────────────────────────────────────── */
.popup-divider {
    margin: 10px 0;
    border: none;
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* ── Details grid ───────────────────────────────────────────────────────── */
.popup-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    font-size: .82rem;
}

.popup-row-label { color: var(--mud-palette-text-secondary); }
.popup-row-value { font-weight: 600; }

/* ── Actions ────────────────────────────────────────────────────────────── */
.popup-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 2px;
}

/* ── Follow button states ───────────────────────────────────────────────── */
.popup-follow-btn--following {
    color: var(--mud-palette-success) !important;
    border-color: var(--mud-palette-success) !important;
}

/* ── Anchor trigger ─────────────────────────────────────────────────────── */
.username-anchor {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
}