/* ========================================
   FORUM TABLES DARK MODE FIX
   ======================================== */

/* Make all forum tables dark */
#subforums-table,
#sticky-threads,
#forum-view .ui.table,
.view-forum .ui.table,
.forum-topic .ui.table,
.ui.table {
    background: rgba(30, 30, 50, 0.8) !important;
    border: 1px solid rgba(139, 92, 246, 0.2) !important;
    color: #F8FAFC !important;
}

#subforums-table thead,
#sticky-threads thead,
#forum-view .ui.table thead,
.view-forum .ui.table thead {
    background: rgba(139, 92, 246, 0.2) !important;
}

#subforums-table th,
#sticky-threads th,
#forum-view .ui.table th,
.view-forum .ui.table th {
    color: #F8FAFC !important;
    background: rgba(139, 92, 246, 0.2) !important;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3) !important;
}

#subforums-table td,
#sticky-threads td,
#forum-view .ui.table td,
.view-forum .ui.table td {
    border-bottom: 1px solid rgba(139, 92, 246, 0.1) !important;
}

#subforums-table tbody tr,
#sticky-threads tbody tr,
#forum-view .ui.table tbody tr,
.view-forum .ui.table tbody tr {
    background: rgba(30, 30, 50, 0.6) !important;
}

#subforums-table tbody tr:hover,
#sticky-threads tbody tr:hover,
#forum-view .ui.table tbody tr:hover,
.view-forum .ui.table tbody tr:hover {
    background: rgba(139, 92, 246, 0.1) !important;
}

/* Forum headers */
#subforums-table .ui.header,
#sticky-threads .ui.header,
#forum-view .ui.header {
    color: #F8FAFC !important;
}

#subforums-table .sub.header,
#sticky-threads .sub.header,
#forum-view .sub.header {
    color: #94A3B8 !important;
}

/* Links in tables */
#subforums-table a,
#sticky-threads a,
#forum-view .ui.table a {
    color: #8B5CF6 !important;
}

#subforums-table a:hover,
#sticky-threads a:hover,
#forum-view .ui.table a:hover {
    color: #EC4899 !important;
}

/* ========================================
   BREADCRUMB MARGIN FIX
   ======================================== */

.ui.breadcrumb {
    margin-top: 20px !important;
    margin-bottom: 10px !important;
    background: rgba(18, 18, 31, 0.6) !important;
    padding: 10px 15px !important;
    border-radius: 8px !important;
}

.ui.breadcrumb .section {
    color: #94A3B8 !important;
}

.ui.breadcrumb .section.active {
    color: #8B5CF6 !important;
    font-weight: 600 !important;
}

.ui.breadcrumb a.section:hover {
    color: #EC4899 !important;
}

/* ========================================
   STICKY FOOTER FIX
   ======================================== */

/* Ensure body takes full height */
html, body {
    height: 100% !important;
    margin: 0 !important;
}

/* Flexbox layout for sticky footer */
body {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
}

/* Main content should grow to fill space */
#wrapper {
    flex: 1 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Pusher should also grow */
.pusher {
    flex: 1 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Footer should stay at bottom */
#footer {
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

/* Ensure footer doesn't get cut off */
.footer.segment {
    margin-top: 2rem !important;
}

/* Alternative sticky footer for older browsers */
@supports not (display: flex) {
    #footer {
        position: relative !important;
        bottom: 0 !important;
        width: 100% !important;
    }
}

/* ========================================
   EMOJI SIZE FIX
   ======================================== */

/* Fix oversized emojis in forum posts */
.emoji,
.emojione,
img.emoji,
.emojioneemoji,
[data-emoji="true"],
.forum-emoji {
    width: 1.2em !important;
    height: 1.2em !important;
    max-width: 1.2em !important;
    max-height: 1.2em !important;
    font-size: inherit !important;
    vertical-align: middle !important;
    display: inline-block !important;
}

/* Prevent emojis from breaking line height */
p .emoji,
span .emoji,
.post-content .emoji,
.forum-post .emoji {
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Twemoji specific fix */
.twemoji,
img.twemoji {
    width: 1.2em !important;
    height: 1.2em !important;
    max-width: 1.2em !important;
    max-height: 1.2em !important;
}

/* JoyPixels/EmojiOne specific */
img.emojione {
    width: 1.2em !important;
    height: 1.2em !important;
}

/* Any image that might be an emoji in forum */
.forum-post img,
.topic-content img,
.post-body img {
    max-width: 100%;
}

.forum-post img.emoji,
.topic-content img.emoji,
.post-body img.emoji,
.forum-post .emojione,
.topic-content .emojione,
.post-body .emojione {
    width: 1.2em !important;
    height: 1.2em !important;
}

/* ========================================
   DROPDOWN Z-INDEX FIX - OVERLAPPING
   ======================================== */

/* Fix dropdowns falling behind content */
.ui.dropdown .menu,
.ui.dropdown .menu.visible,
.ui.selection.dropdown .menu,
.ui.floating.dropdown .menu,
.ui.pointing.dropdown .menu,
.dropdown-menu,
.dropdown .menu {
    z-index: 100000 !important;
    position: absolute !important;
}

/* Ensure dropdown is above ALL content */
.ui.dropdown.active .menu,
.ui.dropdown.open .menu,
.ui.dropdown.visible .menu {
    z-index: 100000 !important;
}

/* Fix for forum specific dropdowns */
.res.right.floated .ui.dropdown .menu,
.topic-controls .ui.dropdown .menu,
.post-actions .ui.dropdown .menu,
.forum-topic .ui.dropdown .menu,
.post .ui.dropdown .menu {
    z-index: 100000 !important;
    position: absolute !important;
}

/* Fix navbar dropdowns */
.navbar .ui.dropdown .menu,
.nav-menu .ui.dropdown .menu,
header .ui.dropdown .menu {
    z-index: 100001 !important;
}

/* Ensure parent elements don't clip dropdowns */
.ui.dropdown,
.dropdown,
.nav-item,
.navbar-nav,
.forum-nav,
.topic-controls,
.post-actions {
    position: relative !important;
}

/* Remove overflow hidden from dropdown parents */
.ui.dropdown .text,
.dropdown-toggle,
.btn-group {
    overflow: visible !important;
}

/* Fix for Semantic UI dropdown positioning */
.ui.dropdown > .menu {
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    margin-top: 0.25rem !important;
}

/* Right-aligned dropdowns */
.ui.dropdown.right > .menu,
.ui.dropdown[class*="right"] > .menu {
    left: auto !important;
    right: 0 !important;
}

/* Floating dropdowns */
.ui.floating.dropdown > .menu {
    margin-top: 0.5rem !important;
}

/* ========================================
   FORUM SPECIFIC DROPDOWN FIXES
   ======================================== */

/* Forum topic action dropdowns */
.topic-actions .dropdown,
.topic-options .dropdown,
.post-management .dropdown {
    z-index: 100000 !important;
}

.topic-actions .dropdown-menu,
.topic-options .dropdown-menu,
.post-management .dropdown-menu {
    z-index: 100001 !important;
}

/* Delete/Edit/Move buttons dropdown */
.res.right.floated > .ui.dropdown,
.right.floated .ui.dropdown {
    z-index: 9999 !important;
}

.res.right.floated > .ui.dropdown > .menu,
.right.floated .ui.dropdown > .menu {
    z-index: 100000 !important;
}
