
/* =====================================================================
   V38 targeted hotfix: header layout, profile/logo visibility,
   giveaway draw reel, winners button, feed moderation visibility.
   Loaded last on purpose.
   ===================================================================== */

/* ---------- header: stable industrial layout ---------- */
.header,
body .header {
    position: sticky !important;
    top: 0 !important;
    z-index: 5000 !important;
    overflow: visible !important;
}

.header .header-inner,
.header-inner {
    width: 100% !important;
    max-width: 1580px !important;
    min-height: 132px !important;
    margin: 0 auto !important;
    padding: 12px 28px 9px !important;
    display: grid !important;
    grid-template-columns: minmax(280px, 1fr) minmax(420px, auto) !important;
    grid-template-rows: 48px 42px 34px !important;
    grid-template-areas:
        "brand user"
        "search search"
        "nav nav" !important;
    gap: 7px 22px !important;
    align-items: center !important;
    overflow: visible !important;
}

.header .header-brand,
.header-brand {
    grid-area: brand !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: visible !important;
}

.header .header-brand .logo,
.header-brand .logo,
h1.logo {
    width: auto !important;
    min-width: 0 !important;
    max-width: min(520px, 100%) !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    transform: none !important;
}

.header .logo-live-link,
.logo-live-link {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    flex: 0 0 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    overflow: visible !important;
    border-radius: 0 !important;
    transform: none !important;
}

.header .logo-live-link .logo-avatar,
.header .logo-avatar,
.logo-avatar,
.logo > img {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    aspect-ratio: 1 / 1 !important;
    display: block !important;
    object-fit: cover !important;
    object-position: center center !important;
    border: 2px solid #70757a !important;
    border-radius: 50% !important;
    box-sizing: border-box !important;
    box-shadow: 3px 3px 0 rgba(0,0,0,.45) !important;
    transform: none !important;
}

.header .industrial-logo,
.industrial-logo {
    min-width: 0 !important;
    max-width: 420px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    overflow: hidden !important;
    text-decoration: none !important;
    transform: none !important;
}

.header .industrial-logo-signal,
.industrial-logo-signal {
    flex: 0 0 8px !important;
    width: 8px !important;
    height: 32px !important;
}

.header .industrial-logo-copy,
.industrial-logo-copy {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    overflow: hidden !important;
}

.header .industrial-logo-name,
.header .industrial-logo-text,
.industrial-logo-name,
.industrial-logo-text {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    font-size: 1.08rem !important;
    line-height: 1 !important;
    letter-spacing: -0.035em !important;
}

.header .industrial-logo-subtitle,
.industrial-logo-subtitle {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
}

.header .header-right,
.header-right {
    grid-area: user !important;
    min-width: 0 !important;
    justify-self: end !important;
    align-self: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    overflow: visible !important;
}

.header #userArea,
#userArea {
    min-width: 0 !important;
    width: auto !important;
    max-width: min(760px, 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    overflow: visible !important;
}

.header .header-user-panel,
.header-user-panel {
    min-width: 0 !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 7px !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    overflow: visible !important;
}

.header .header-profile,
.header-profile {
    flex: 1 1 auto !important;
    min-width: 168px !important;
    max-width: 270px !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 3px 8px 3px 3px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    overflow: hidden !important;
    color: #f2f0e9 !important;
    border-radius: 0 !important;
    transform: none !important;
}

.header .header-profile .feed-card-avatar,
.header .header-profile img,
.header-profile .feed-card-avatar,
.header-profile img {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    flex: 0 0 30px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

.header .header-profile-name,
.header-profile-name {
    flex: 1 1 auto !important;
    min-width: 54px !important;
    max-width: 148px !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: hidden !important;
    color: #f2f0e9 !important;
    -webkit-text-fill-color: #f2f0e9 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: .9rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

.header .user-role-badges,
.header-profile .user-role-badges,
.user-role-badges--compact {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    min-width: 0 !important;
    max-width: 30px !important;
    overflow: hidden !important;
}

.header .user-role-badges--compact .user-role-badge {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
}

.header .user-role-badges--compact .user-role-badge-label {
    display: none !important;
}

.header .header-actions-group,
.header-actions-group {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    min-width: 0 !important;
    padding: 0 5px !important;
}

.header .header-icon-btn,
.header .header-theme-btn,
.header .theme-btn,
.header .header-admin-btn,
.header-icon-btn,
.header-theme-btn,
.header-admin-btn {
    flex: 0 0 auto !important;
    border-radius: 0 !important;
}

.header .header-center,
.header-center {
    grid-area: search !important;
    width: min(660px, calc(100vw - 56px)) !important;
    max-width: 660px !important;
    min-width: 0 !important;
    justify-self: center !important;
    align-self: center !important;
    position: relative !important;
    z-index: 5200 !important;
    transform: translateX(42px) !important;
}

.header .search-section,
.header-center .search-section,
.search-section {
    width: 100% !important;
    max-width: 660px !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: visible !important;
    border-radius: 0 !important;
}

.header .header-nav,
.header-inner > .header-nav,
.header #mainNavigation,
#mainNavigation {
    grid-area: nav !important;
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    justify-self: center !important;
    align-self: end !important;
    width: fit-content !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: inline-flex !important;
    align-items: stretch !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    border-radius: 0 !important;
    transform: translateX(42px) !important;
}

#globalSearchResults.global-search-results {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 2147483500 !important;
}

/* ---------- giveaway draw reel / winner roulette ---------- */
.giveaway-case-modal {
    max-width: min(960px, calc(100vw - 24px)) !important;
}

.giveaway-case-reel {
    transform: translateX(0);
}

.giveaway-case-reel.is-preview-rolling {
    animation: v38GiveawayPreviewRoll 950ms linear infinite;
}

@keyframes v38GiveawayPreviewRoll {
    from { transform: translateX(0); }
    to { transform: translateX(-276px); }
}

.giveaway-case-card.is-winner {
    animation: v38WinnerPop 700ms cubic-bezier(.18,.9,.24,1.3) both;
}

@keyframes v38WinnerPop {
    0% { transform: translateY(0) scale(1); }
    55% { transform: translateY(-10px) scale(1.08); }
    100% { transform: translateY(-6px) scale(1.04); }
}

.giveaway-case-result .profile-link {
    color: inherit !important;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    font: inherit !important;
    text-align: left !important;
}

/* ---------- feed moderation: visible state when toggle is active ---------- */
.feed-moderation-btn.active,
.feed-moderation-btn[aria-pressed="true"] {
    color: #fff !important;
    background: var(--accent, #c92a20) !important;
    border-color: var(--accent, #c92a20) !important;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,.35), 4px 4px 0 rgba(0,0,0,.22) !important;
}

.community-post-card.is-moderation-mode {
    border-color: var(--accent, #c92a20) !important;
    box-shadow: 5px 5px 0 rgba(0,0,0,.32), 0 0 0 1px rgba(201,42,32,.35) !important;
}

.feed-card-moderation-panel {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin: 12px 0 0 !important;
    padding: 9px !important;
    border: 1px solid rgba(201,42,32,.62) !important;
    border-left: 4px solid var(--accent, #c92a20) !important;
    background: rgba(201,42,32,.10) !important;
    color: var(--text-primary, #f2f0e9) !important;
}

.feed-card-moderation-panel strong {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: .78rem !important;
    text-transform: uppercase !important;
    letter-spacing: .08em !important;
}

.feed-card-moderation-actions {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
}

.feed-card-moderation-actions .btn {
    min-height: 30px !important;
    padding: 5px 9px !important;
    border-radius: 0 !important;
    font-size: .76rem !important;
}

body.light .feed-card-moderation-panel {
    background: rgba(201,42,32,.08) !important;
    color: #1e2226 !important;
}

@media (max-width: 1080px) {
    .header .header-inner,
    .header-inner {
        grid-template-columns: minmax(220px, 1fr) minmax(260px, auto) !important;
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
    .header .header-center,
    .header-center,
    .header .header-nav,
    .header-inner > .header-nav,
    #mainNavigation {
        transform: translateX(0) !important;
    }
    .header .industrial-logo,
    .industrial-logo { max-width: 330px !important; }
    .header .header-profile,
    .header-profile { max-width: 220px !important; }
}

@media (max-width: 760px) {
    .header .header-inner,
    .header-inner {
        min-height: 0 !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto auto auto !important;
        grid-template-areas:
            "brand"
            "user"
            "search"
            "nav" !important;
        gap: 8px !important;
        padding: 10px 12px 8px !important;
    }
    .header .header-brand,
    .header-brand,
    .header .header-right,
    .header-right,
    .header .header-center,
    .header-center,
    .header .header-nav,
    .header-inner > .header-nav,
    #mainNavigation {
        width: 100% !important;
        justify-self: stretch !important;
        transform: none !important;
    }
    .header .header-right,
    .header-right,
    .header #userArea,
    #userArea,
    .header .header-user-panel,
    .header-user-panel {
        justify-content: flex-start !important;
    }
    .header .header-profile,
    .header-profile {
        min-width: 0 !important;
        max-width: min(260px, 100%) !important;
    }
    .header .nav-tab,
    .nav-tab {
        min-width: 0 !important;
        flex: 1 1 0 !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    .header .nav-tab span,
    .nav-tab span { font-size: .72rem !important; }
}
