/* Modern FluxCP Theme - Based on Nova Flux Design */
:root {
    --bg-dark: #0f172a;
    /* slate-900 */
    --bg-darker: #020617;
    /* slate-950 */
    --text-primary: #e2e8f0;
    /* slate-200 */
    --text-secondary: #94a3b8;
    /* slate-400 */
    --accent: #d4c06b;
    /* Soft Champagne Gold */
    --accent-hover: #bda852;
    /* Darker Soft Gold */
    --accent-light: #e8d78e;
    /* Pale Gold */
    --card-bg: rgba(30, 41, 59, 0.5);
    /* slate-800/50 */
    --border-color: #334155;
    /* slate-700 */
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    background-image: url('../img/wallpaper.jpg');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Fix Headers Visibility */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: white !important;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-light);
}

/* Utilities */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-8 {
    gap: 2rem;
}

.grid {
    display: grid;
}

.hidden {
    display: none;
}

.block {
    display: block;
}

@media (min-width: 768px) {
    .md\:flex {
        display: flex;
    }

    .md\:hidden {
        display: none;
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .md\:col-span-2 {
        grid-column: span 2;
    }
}

@media (min-width: 1024px) {
    .lg\:flex {
        display: flex;
    }

    .lg\:hidden {
        display: none;
    }

    .lg\:block {
        display: block;
    }
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(15, 23, 42, 0.95);
    /* More solid background for readability */
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    padding: 0.75rem 0;
    /* Slightly Reduce padding height */
}

/* Mobile Sidebar Wrapper - Add Padding */
.mobile-links {
    padding: 1.5rem !important;
    /* Increase padding to detach text from border */
}

/* Mobile Sidebar (Drawer) */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 85%;
    /* Use percentage for better mobile fit, max-width limit */
    max-width: 320px;
    background-color: rgba(15, 23, 42, 0.95);
    /* Slightly transparent as requested */
    backdrop-filter: blur(10px);
    /* Nice blur effect */
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 25px rgba(0, 0, 0, 0.7);
    z-index: 9999;
    /* Max Z-Index to cover everything */
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    padding-bottom: 2rem;
    display: block;
    /* Ensure it is displayed for transition */
    touch-action: pan-y;
    /* Improve scrolling on touch devices */
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
}

.mobile-sidebar.active {
    transform: translateX(0);
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.8);
    /* Stronger shadow when active */
}

/* Ensure overlay is strictly under the sidebar but over content */
#mobile-overlay {
    z-index: 9998 !important;
    /* One less than sidebar */
    cursor: pointer;
    /* Indicate it closes the menu */
    display: none;
    /* Hidden by default until JS fades it in */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

/* Navbar Items */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.nav-logo-box {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #6366f1, #9333ea);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.text-accent {
    color: var(--accent-light);
}

/* Nav Links - Desktop Only */
.nav-links {
    display: none;
    /* Hidden by default (Mobile) */
}

@media (min-width: 1024px) {
    .nav-links {
        display: flex;
        /* Show only on LG screens */
        gap: 1.5rem;
    }
}

.nav-link {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-secondary);
}

.nav-link:hover {
    color: white;
}

/* Utilities override */
/* .hidden { display: none !important; } REMOVED explicitly to fix desktop menu conflict */

/* Explicit Desktop Visibility Control */
.desktop-only {
    display: none !important;
}

@media (min-width: 1024px) {
    .desktop-only {
        display: flex !important;
    }
}

/* Responsive Forms & Tables */
@media (max-width: 768px) {

    /* Prevent horizontal scroll globally on mobile */
    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative;
    }

    /* RESET Table Styles for Mobile */
    .generic-form-table,
    .generic-form-table tbody,
    .generic-form-table tr,
    .generic-form-table th,
    .generic-form-table td {
        display: block !important;
        width: 100% !important;
        border: none !important;
        /* Remove ugly table borders */
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        /* Reset margins */
        box-sizing: border-box !important;
        /* Fix width calculation */
    }

    /* spacing between fields */
    .generic-form-table tr {
        margin-bottom: 1.25rem !important;
        display: flex !important;
        flex-direction: column;
        width: 100%;
        max-width: 100vw;
        /* Hard limit */
    }

    /* Label Styling */
    .generic-form-table th,
    .generic-form-table label {
        text-align: left !important;
        color: var(--accent) !important;
        /* Gold color for labels */
        font-size: 0.85rem;
        text-transform: uppercase;
        font-weight: 700;
        margin-bottom: 0.4rem !important;
        display: block !important;
        width: 100%;
    }

    /* Input Container Styling */
    .generic-form-table td {
        padding: 0 !important;
        width: 100%;
        display: block;
    }

    /* Make inputs nice and visible */
    .generic-form-table input[type="text"],
    .generic-form-table input[type="password"],
    .generic-form-table input[type="email"],
    .generic-form-table select {
        width: 100% !important;
        min-width: 0 !important;
        /* Allow shrinking */
        max-width: 100% !important;
        /* Prevent overflow */
        box-sizing: border-box !important;
        /* Include padding in width */
        background-color: rgba(15, 23, 42, 0.6) !important;
        border: 1px solid var(--border-color) !important;
        padding: 10px 12px !important;
        border-radius: 6px;
        color: white !important;
        height: auto;
        /* Larger touch area */
        font-size: 16px !important;
        /* Prevent iOS zoom */
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    .generic-form-table input:focus,
    .generic-form-table select:focus {
        border-color: var(--accent) !important;
        outline: none;
    }

    /* Fix Gender/Radio buttons on mobile */
    .generic-form-table td p {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
        background: rgba(15, 23, 42, 0.5);
        padding: 1rem;
        border-radius: 8px;
        border: 1px solid var(--border-color);
        margin: 0 !important;
    }

    /* Hide sidebar in mobile if not handled by drawer */
    .sidebar-right {
        display: none !important;
    }

    .container {
        padding: 0 1.25rem;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: var(--accent);
    color: #0f172a;
    /* Dark text on gold button for readability */
    transition: all 0.2s;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Layout */
/* Layout */
.main-layout {
    padding-top: 7rem;
    /* Space for navbar */
    min-height: 80vh;
    margin-bottom: 4rem;
}

.content-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
}

.main-content {
    flex: 1 1 600px;
    max-width: 900px;
    width: 100%;
}

.sidebar-right {
    flex: 0 0 300px;
    width: 300px;
}

@media (max-width: 1023px) {
    .sidebar-right {
        display: none;
    }

    .main-content {
        max-width: 100%;
    }
}

/* Hero */
.hero {
    position: relative;
    margin-bottom: 1rem;
    text-align: center;
    padding: 2rem 1rem 1rem 1rem;
    background: transparent;
    /* Was radial-gradient */
    overflow: hidden;
}

/* Hide flux content box ONLY on homepage */
body.page-main-index .main-content {
    display: none !important;
}

/* Hide Navbar Logo ONLY on homepage */
body.page-main-index .nav-brand img {
    display: none !important;
}

/* But keep sidebar if needed, although user wanted to remove the box primarily */
body.page-main-index .content-grid {
    justify-content: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #ddb95a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

/* Hero Text Box Styling - Unified Box */
.hero .container {
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    padding: 3rem;
    border-radius: 1rem;
    display: inline-block;
    max-width: 900px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero p {
    color: #e2e8f0;
}

/* Cards & Content */
.card,
.main-content {
    background-color: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

/* Sidebar Widgets */
.discord-widget {
    background-color: rgba(88, 101, 242, 0.9);
    /* Slight transparency */
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    color: white;
}

.discord-icon {
    background: rgba(255, 255, 255, 0.1);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

/* Footer */
.footer {
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem 0;
    margin-top: auto;
}

.footer h4 {
    color: white;
    font-weight: bold;
    margin-bottom: 1rem;
}

.footer ul {
    list-style: none;
    padding: 0;
}

.footer li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* FluxCP Input Overrides & Dark Mode Fixes */
input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=date],
select,
textarea {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.5rem;
    border-radius: 0.5rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* AGGRESSIVE Dark Mode Overrides for FluxCP Structures */
table,
tr,
td,
th,
tbody,
thead {
    background: transparent !important;
    background-color: transparent !important;
    border-color: var(--border-color) !important;
}

/* Remove backgrounds from common Flux container divs */
.generic-form-div,
#loginbox,
#content,
.content-table {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
}

/* Target specific white cells from FluxCP legacy themes */
td[bgcolor],
th[bgcolor] {
    background-color: transparent !important;
}

/* Fix text colors in tables */
td,
p,
span,
div,
li {
    color: var(--text-primary) !important;
}

/* Ensure inputs keep their text color */
input,
select,
textarea {
    color: white !important;
}

th,
label,
strong,
b {
    color: var(--accent) !important;
    font-weight: 600;
}

/* Specific fix for the user's issue with black text in amount displays */
.generic-form-table td {
    color: var(--text-primary) !important;
}

/* Hide legacy border images if they exist */
img[src*="content_tl.gif"],
img[src*="content_tr.gif"],
img[src*="content_bl.gif"],
img[src*="content_br.gif"],
img[src*="loginbox_tl.gif"],
img[src*="loginbox_tr.gif"],
img[src*="loginbox_bl.gif"],
img[src*="loginbox_br.gif"] {
    display: none !important;
}

table {
    width: 100%;
    border-collapse: collapse;
}

td,
th {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color) !important;
}

/* Hero Text Gradient Update */
.hero-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #D4AF37);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--bg-darker);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text-secondary);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {
    background-color: var(--border-color);
    color: white;
}

/* AGGRESSIVE BUTTON OVERRIDE */
input[type="submit"],
input[type="button"],
button,
.main-submit {
    background-image: none !important;
    background-color: var(--bg-darker) !important;
    color: var(--accent) !important;
    border: 1px solid var(--border-color) !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    font-weight: bold !important;
    text-shadow: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

input[type="submit"]:hover,
input[type="button"]:hover,
button:hover,
.main-submit:hover {
    background-color: var(--accent) !important;
    color: #000 !important;
    border-color: var(--accent) !important;
}

/* FIX GENERIC FORM TABLES (Login, Register, etc) */
.generic-form-table,
.generic-form-table tr,
.generic-form-table td,
.generic-form-table th {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
}

.generic-form-table th,
.generic-form-table label {
    color: var(--accent) !important;
    font-weight: bold;
    text-align: right;
    padding-right: 1rem;
}

.generic-form-table input[type="text"],
.generic-form-table input[type="password"],

/* AGGRESSIVE FLUXCP LAYOUT FIXES (Admin, Tables, Pagination) */

/* 1. Global Background Reset for Flux Text Content */
.generic-form,
.search-form,
.vertical-table,
.horizontal-table,
.flux-content,
.paginator,
.pages {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--text-primary) !important;
}

/* 2. Paginator / "Found a total of..." bars REFINED */
.paginator,
.pages,
.paginator-info,
/* FluxCP sometimes uses this */
p.paginator,
/* Specific P override */
div[style*="background-color: #F4F4F4"],
div[style*="background-color: #f4f4f4"],
div[class="pages"] {
    background: transparent !important;
    background-color: var(--bg-darker) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color) !important;
    padding: 0.5rem !important;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Fix specific white code blocks / pre tags */
pre,
code,
.code {
    background-color: var(--bg-darker) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    padding: 0.5rem;
    display: block;
}

/* 3. Global Table Styling - Responsive & Wide */
table {
    border-collapse: collapse;
    width: 100%;
    /* min-width: 800px; REMOVED - Causes mobile layout issues */
}

/* Widen the main container to fit potentially large tables */
.main-content {
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: auto;
    /* Scroll horizontally if needed */
}

.vertical-table {
    display: block;
    width: 100%;
    overflow-x: auto;
}

th,
td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    /* white-space: nowrap; REMOVED - functionality handled better with responsive rules */
}

th {
    background-color: rgba(15, 23, 42, 0.95) !important;
    /* Make headers darker/solid */
    color: var(--accent) !important;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
}

tr:nth-child(even) td {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

tr:hover td {
    background-color: rgba(212, 192, 107, 0.05) !important;
}

/* 4. Links in tables */
td a,
.paginator a {
    color: var(--accent) !important;
    text-decoration: none;
}

td a:hover,
.paginator a:hover {
    color: white !important;
    text-decoration: underline;
}

/* 5. Admin Form Labels & Inputs */
label,
.generic-form label {
    color: var(--accent) !important;
    font-weight: bold;
    display: block;
    margin-bottom: 0.25rem;
}

input[type="text"],
input[type="password"],
textarea,
select {
    background-color: var(--bg-darker) !important;
    color: white !important;
    border: 1px solid var(--border-color) !important;
    padding: 0.75rem;
    border-radius: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    /* Ensure padding doesn't break width */
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(212, 192, 107, 0.2);
}

/* 6. Fix "Not Applicable" / "None" text */
.not-applicable {
    color: var(--text-secondary) !important;
    opacity: 0.6;
    font-style: italic;
}

/* 7. Toggle Links (Search...) */
.toggler a {
    color: var(--text-secondary) !important;
    font-size: 0.9rem;
}

/* --- FIXES FOR REGISTRATION FORM (Desktop Specific High Specificity) --- */

/* Fix for Gender Radio Buttons & Labels inline display on DESKTOP */
@media (min-width: 769px) {
    html body .generic-form-table td label {
        display: inline-flex !important;
        align-items: center;
        width: auto !important;
        margin-right: 20px !important;
        cursor: pointer;
        text-align: left !important;
        float: none !important;
        font-weight: normal !important;
        color: var(--text-primary) !important;
        margin-bottom: 0 !important;
    }

    html body .generic-form-table td input[type="radio"] {
        width: auto !important;
        display: inline-block !important;
        margin: 0 8px 0 0 !important;
        height: auto !important;
        box-shadow: none !important;
        vertical-align: middle !important;
    }

    /* Fix for Date Selects (Birthdate) to sit side-by-side */
    html body .generic-form-table td select {
        width: auto !important;
        display: inline-block !important;
        min-width: 70px;
        margin-right: 5px !important;
        max-width: 120px !important;
        vertical-align: middle !important;
    }
}

/* Ensure the container P doesn't enforce block align */
html body .generic-form-table td p {
    text-align: left !important;
    margin: 0 !important;
    display: block !important;
}

/* ========================================= */
/* MOBILE OVERRIDES (MUST BE AT THE END)     */
/* ========================================= */
@media (max-width: 768px) {

    /* Kill horizontal scroll */
    html,
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        position: relative;
    }

    .main-content {
        padding: 1rem !important;
        border: none !important;
        background: transparent !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Force tables to behave like blocks */
    table,
    .generic-form-table,
    tbody,
    tr,
    td,
    th {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        white-space: normal !important;
        /* Allow wrapping */
        border: none !important;
    }

    /* Reset paddings/margins for stacked view */
    .generic-form-table tr {
        margin-bottom: 1.5rem !important;
        border-bottom: none !important;
    }

    .generic-form-table th,
    .generic-form-table label {
        text-align: left !important;
        color: var(--accent) !important;
        font-size: 0.9rem;
        text-transform: uppercase;
        font-weight: 700;
        margin-bottom: 0.5rem !important;
        display: block !important;
        width: 100%;
    }

    .generic-form-table td {
        padding: 0 !important;
    }

    /* Full width inputs */
    .generic-form-table input[type="text"],
    .generic-form-table input[type="password"],
    .generic-form-table input[type="email"],
    .generic-form-table select {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        margin: 0 !important;
    }

    /* Gender selection special case */
    .generic-form-table td p {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
        background: rgba(15, 23, 42, 0.5);
        padding: 1rem;
        border-radius: 8px;
        border: 1px solid var(--border-color) !important;
    }

    /* Re-enable inline labels for radio/gender specifically inside the flex p */
    .generic-form-table td p label {
        display: inline-flex !important;
        width: auto !important;
        margin-bottom: 0 !important;
        color: white !important;
    }

    .generic-form-table td p input[type="radio"] {
        width: auto !important;
        margin-right: 0.5rem !important;
    }

    /* Hide sidebar in mobile */
    .sidebar-right {
        display: none !important;
    }

    .container {
        padding: 0 1rem;
    }

    /* Date selects on mobile - stack them or flow them? Flow is better */
    .generic-form-table td select {
        display: inline-block !important;
        /* Allow them to sit next to each other if they fit */
        width: 32% !important;
        /* 3-column roughly */
        min-width: 80px;
        margin-right: 1% !important;
    }
}