/* Hide honeypot field for bots */
.honeypot-field {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}
.mMenu {
    display: flex;
    flex-direction: row;
    align-self: center;
    justify-content: center;
    width: 100%;
    background-color: #3e3f42;
    padding: 0;
}
#leftContent {
    flex-direction: row;
    justify-content: left;
    max-width: 30%;
}
#middleContent {
    flex-direction: row;
    justify-content: center;
    max-width: 30%;
}
#rightContent {
    flex-direction: row;
    justify-content: right;
    max-width: 30%;
}
#contents {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-around;
}
#foot {
    background-color: #242323;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
}
body:not(.django-admin) a:link {
    color: #ffffff;
}
body:not(.django-admin) a:visited {
    color: #ffffff;
}

/* Header positioning */
body:not(.django-admin) header {
    position: relative;
    padding-top: 60px; /* Space for the top elements */
    margin-bottom: 20px;
}

.admin-button {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 1000;
}

.admin-link {
    background-color: #007bff;
    color: white !important;
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

/* Auth links styling */
.auth-links a, .auth-links a:visited {
    color: #ffffff !important;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.top-left {
    position: absolute;
    top: 10px;
    left: 20px;
    text-align: left;
    z-index: 10;
}

.auth-links {
    margin-bottom: 5px;
    font-size: 14px;
}

.uConstruction {
    font-size: 12px;
    color: #ffffff;
    margin-top: 5px;
    text-align: left;
}
#mLogo {
    width: 20%;
    max-width: 160px;
    box-sizing: border-box;
    box-shadow: 0 0 0 1px #6d3aff;
    border-radius: 10px;
    display: block;
}
#fb {
    height: 100px;
}
#wAlogo {
    height: 100px;
}
body:not(.django-admin) * {
    list-style-type: none;
}
body:not(.django-admin) {
    background-color: #000000;
    max-width: 100%;
    font-family: Arial, Helvetica, sans-serif;
    color: #ffffff;
}

/* Django admin table fix - prevent vertical text */
.django-admin table th, .django-admin table td,
body table th, body table td {
    display: table-cell !important;
    flex-direction: unset !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    white-space: normal !important;
}

/* Django admin sidebar navigation fix */
.django-admin #nav-sidebar,
.django-admin .module,
.django-admin .app-label,
.django-admin .model-name,
.django-admin #nav-sidebar ul li a,
.django-admin #nav-sidebar ul li {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    transform: none !important;
    display: block !important;
    flex-direction: row !important;
    white-space: normal !important;
}

/* Fix Django admin header compression */
.django-admin #header {
    height: auto !important;
    min-height: 40px !important;
    padding: 10px 20px !important;
}

.django-admin #branding h1 {
    font-size: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: normal !important;
}
.ucText {
    font-size: 40px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.logoContainer {
    z-index: -1;
}
.ucSize {
    width: 75%;
    text-align: center;
    padding-top: 20px;
}
/* Main navigation menu */
.mMenu {
    background-color: #3e3f42;
    padding: 0;
}

.mMenu ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
}

.mMenu li {
    position: relative;
}

.mMenu li a {
    color: white;
    text-align: center;
    padding: 16px 24px;
    text-decoration: none;
    display: block;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.mMenu li a:hover, .mMenu .dropbtn:hover {
    background-color: #2a2a2a;
}
  /* any link in the body must use this class. */
.whiteLink {
    background-color: #000000;
    color: #ffffff !important;
    text-decoration: underline;
}
body:not(.django-admin) .sMenu {
    display: flex;
    flex-direction: column;
    align-self: center;
    justify-content: center;
    width: 100%;
    color: #ffffff !important;
    background-color: #000000 !important;
    padding: 15px;
}
body:not(.django-admin) .linkPageCenter {
    display: flex;
    flex-direction: column;
    justify-content: left;
    width: 80%;
}
.linkPageMiddle {
    display: flex;
    width: 8%
}
.linkPageRight {
    display: flex;
    width: 8%
}

/* Basic dropdown styles */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #2a2a2a;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 100;
}

.dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    border-bottom: 1px solid #3e3f42;
}

.dropdown-content a:hover {
    background-color: #3e3f42;
}

.dropdown-divider {
    height: 1px;
    margin: 5px 0;
    overflow: hidden;
    background-color: #4a4a4a;
}

/* Show dropdown on hover for desktop */
.dropdown:hover .dropdown-content {
    display: block;
}

/* Show dropdown when active class is applied (for mobile) */
.dropdown-content.active {
    display: block;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    padding: 15px;
    z-index: 200;
}

.mobile-menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Basic navigation menu */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Mobile menu adjustments */
@media (max-width: 768px) {
    /* Prevent horizontal scroll — clamp at the viewport edge */
    html {
        overflow-x: hidden;
        max-width: 100vw;
    }
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        position: relative;
    }

    *, *::before, *::after {
        box-sizing: border-box;
        /* Flex items should be allowed to shrink below their content size */
        min-width: 0;
    }

    /* Images should never overflow the screen */
    img, video, iframe, table {
        max-width: 100%;
        height: auto;
    }

    /* Nav bar: flex row for [toggle], nav-menu wraps below on its own full-width row */
    .mMenu {
        flex-direction: row;
        flex-wrap: wrap;        /* must be wrap so nav-menu drops to next line */
        align-items: center;
        position: relative;
        background-color: #6a1b9a;
        width: 100%;
        /* NO overflow:hidden — that would clip the open nav-menu */
    }

    /* Hamburger button sits on the right of the bar */
    .mobile-menu-toggle {
        display: flex !important;
        flex-shrink: 0;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 21px;
        position: static;
        margin-left: auto;
        cursor: pointer;
        z-index: 999;
        background: transparent;
        padding: 14px 14px;
        border-radius: 4px;
        box-sizing: content-box;
    }

    /* Force hamburger lines white so they're visible on the purple bar */
    .mobile-menu-toggle span {
        background-color: #ffffff !important;
        display: block;
        height: 3px;
        width: 100%;
        border-radius: 3px;
    }

    .mobile-menu-toggle span {
        transition: all 0.3s ease;
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Nav menu is full-width and wraps to the row below the toggle bar */
    .nav-menu {
        display: none !important;
        flex-direction: column;
        width: 100%;
        background: #2a2a2a;
        position: relative;
        z-index: 100;
    }

    .nav-menu.active {
        display: flex !important;
    }

    /* Nav items: full width, text wraps naturally */
    .mMenu li {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid #444;
    }

    .mMenu li a {
        display: block;
        padding: 15px 20px;
        white-space: normal;
        word-break: break-word;
    }

    /* Override hover behavior on mobile */
    .dropdown:hover .dropdown-content {
        display: none !important;
    }

    .dropdown-content {
        display: none !important;
        position: static;
        box-shadow: none;
        width: 100%;
        background-color: #1a1a1a;
    }

    .dropdown-content.active {
        display: block !important;
    }

    .dropdown-content a {
        padding: 12px 20px 12px 40px !important;
        display: block;
    }

    /* Admin dropdown on mobile */
    .admin-dropdown {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        width: 100%;
    }

    .admin-dropdown .dropdown-content {
        right: auto;
        left: 0;
        width: 100%;
    }
}

/* Hide desktop admin dropdown on mobile; use nav version instead */
.mobile-admin-menu {
    display: none;
}
@media (max-width: 768px) {
    header .admin-dropdown {
        display: none !important;
    }
    .nav-menu.active li.mobile-admin-menu,
    .nav-menu li.mobile-admin-menu {
        display: block !important;
        width: 100%;
        border-top: 2px solid #6a1b9a;
    }
}

/* Admin dropdown specific styles */
.admin-dropdown {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 1000;
}

.admin-dropdown .dropdown-content {
    right: 0;
    left: auto;
    min-width: 200px;
}

/* Mobile styles for admin dropdown */
@media (max-width: 768px) {
    .admin-dropdown {
        position: static;
        float: none !important;
        margin: 10px;
    }
    
    .admin-dropdown .dropdown-content {
        position: static;
        width: auto;
        background-color: #1a1a1a;
        border: 1px solid #444;
        margin-top: 5px;
    }
    
    .admin-dropdown .dropdown-content a {
        padding-left: 15px;
    }
}

/* ============================================================
   MOBILE LAYOUT FIXES
   ============================================================ */
@media (max-width: 768px) {
    /* Switch main content from flex-row to plain block — eliminates
       justify-content:space-around pushing content off-screen */
    #contents {
        display: block !important;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Old 3-column layout elements: go full-width */
    #leftContent,
    #middleContent,
    #rightContent {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    /* Every direct child of #contents fills the width */
    #contents > * {
        max-width: 100%;
        box-sizing: border-box;
        min-width: 0;
    }

    /* Header must not overflow */
    body:not(.django-admin) header {
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    /* Pre/code blocks scroll within themselves */
    pre, code {
        max-width: 100%;
        overflow-x: auto;
        word-break: break-all;
    }

    /* Any flex row inside page content wraps on mobile */
    body:not(.django-admin) .row,
    body:not(.django-admin) [style*="display: flex"],
    body:not(.django-admin) [style*="display:flex"] {
        flex-wrap: wrap !important;
    }

    /* Toast notifications: keep inside screen */
    .messages-container {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
        top: 10px;
    }

    /* Header: give more room to the logo */
    body:not(.django-admin) header {
        padding-top: 50px;
        padding-bottom: 10px;
    }

    /* Logo: slightly larger on small screens */
    #mLogo {
        width: 35%;
        max-width: 130px;
    }

    /* Auth links: make text slightly smaller to fit */
    .auth-links {
        font-size: 12px;
    }

    /* Dropdown section labels inside nav */
    .dropdown-section {
        padding: 8px 20px 4px 20px;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #888888;
        pointer-events: none;
    }

    /* Footer: stack social + links vertically on very narrow screens */
    #foot .footer-row {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        text-align: center;
    }
}

/* Dropdown section labels (dark mode, all viewports) */
.dropdown-section {
    padding: 8px 16px 4px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888888;
    pointer-events: none;
    cursor: default;
}
