/* CSS Custom Properties for Theme Customization */
:root {
    --primary: #1a1a1a;
    --secondary: #252525;
    --login-bg: color-mix(in srgb, var(--secondary), black 40%);
    /* Dynamically darker than secondary */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Placeholder Styling */
::placeholder {
    color: color-mix(in srgb, var(--secondary), white 50%);
    /* Lighter version of secondary for contrast */
    opacity: 1;
    /* Firefox override */
}

body {
    background-color: var(--secondary);
    color: #e0e0e0;
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* padding-bottom: 60px; Removed to fix mobile spacing */
}

a {
    color: #e0e0e0;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout Container */
.layout-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    background-color: var(--secondary);
    padding: 10px;
    text-align: center;
    max-width: 1200px;
    margin: auto;
    width: 100%;
    /* border-bottom: 1px solid #333; */
}

.site-title {
    font-size: 1.5em;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.header-links {
    font-size: 0.9em;
}

/* Main Content Area */
.main-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    width: 100%;
    overflow: hidden;
    /* For sliding effects */
}

/* Sidebars (Mobile Default: Hidden/Off-canvas) */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 60px;
    /* Above bottom nav */
    width: 80%;
    max-width: 250px;
    background-color: var(--primary);
    /* Primary color for slide-ins */
    z-index: 100;
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    padding: 15px;
    /* box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); */
}

.sidebar-left {
    left: 0;
    transform: translateX(-100%);
}

.sidebar-right {
    right: 0;
    transform: translateX(100%);
    /* border-left: 1px solid #333; */
}

.sidebar.active {
    transform: translateX(0);
}

/* Main Content Column */
.content-column {
    flex: 1;
    padding: 15px;
    padding-bottom: 75px;
    /* Added padding for bottom nav + spacing */
    background-color: var(--primary);
    width: 100%;
    transition: opacity 0.3s;
    /* min-height: 100vh; Removed to prevent header+content > 100vh scroll */
    box-sizing: border-box;
    /* Include padding in height */
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 90;
    /* Below sidebar (100) but above everything else */
    cursor: pointer;
}

.sidebar-overlay.active {
    display: block;
}

/* Footer */
footer {
    background-color: var(--secondary);
    /* padding: 10px; */
    text-align: center;
    font-size: 0.8em;
    color: #888;
    margin-bottom: 60px;
    /* Space for bottom nav */
}

/* Bottom Navigation (Mobile Only) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--primary);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #333;
    z-index: 200;
}

.nav-btn {
    background: var(--primary);
    /* Secondary color for inactive buttons */
    border: none;
    color: #aaa;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    padding: 10px;
    flex: 1;
    text-align: center;
    transition: color 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    stroke: currentColor;
}

.nav-btn.active {
    color: #fff;
    background-color: var(--secondary);
    filter: brightness(.4);
    /* Primary color for active button */
}

/* Navigation List Styling */
.nav-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-list li {
    margin-bottom: 2px;
    /* Reduced margin */
}

.navhead {
    font-weight: bold;
    color: #fff;
    margin-top: 10px;
    margin-bottom: 2px;
    text-transform: uppercase;
    font-size: 0.85em;
    border-bottom: 1px solid var(--secondary);
    padding-bottom: 2px;
}

.navhelp {
    font-size: 0.8em;
    color: #888;
    font-style: italic;
    margin-bottom: 10px;
}

/* Charstats Styling */
.charinfo {
    width: 100%;
}

.charhead,
.charbuffhead {
    background-color: var(--secondary);
    /* Secondary color for stat headers */
    color: #fff;
    padding: 5px;
    font-weight: bold;
    margin-top: 10px;
    border-radius: 3px;
}

.charrow {
    display: flex;
    justify-content: space-between;
    padding: 3px 5px;
    border-bottom: 1px solid var(--secondary);
}

.charstat {
    color: #aaa;
}

.chardata {
    color: #e0e0e0;
    font-weight: bold;
}

/* .charbuffhead {
    color: #4da6ff;
    margin-top: 5px;
    font-weight: bold;
} */

.trlight {
    background-color: var(--secondary);
}

.trdark {
    background-color: var(--primary);
}

.trhead {
    background-color: var(--primary);
}

.list-warriors {
    border-spacing: 0;
}

/* Desktop Styles */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
        background-color: var(--secondary);
        /* Secondary background for the whole page */
    }

    .main-wrapper {
        max-width: 1200px;
        margin: 20px auto;
        background-color: var(--primary);
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        overflow: hidden;
        /* Clip children to border radius */
    }

    .sidebar {
        position: static;
        transform: none;
        width: 250px;
        height: auto;
        background-color: transparent;
        box-shadow: none;
        border: none;
        padding: 20px;
        overflow: visible;
    }

    .sidebar-left {
        order: 1;
    }

    .content-column {
        order: 2;
        border-left: none;
        /* Remove double borders */
        border-right: none;
        background-color: transparent;
        /* Seamless blend */
        min-height: auto;
        /* Reset min-height for desktop */
        padding-bottom: 15px;
        /* Reset padding for desktop */
    }

    .sidebar-right {
        order: 3;
    }

    .bottom-nav {
        display: none;
    }

    footer {
        margin-bottom: 0;
    }

    .content-column.dimmed {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Modal Styling */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background-color: var(--primary);
    /* Primary color for modal background */
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid #444;
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--secondary);
    /* Secondary color for modal header */
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.modal-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    color: #e0e0e0;
}

.modal-body table {
    width: 100%;
}

/* Hide footer elements inside modal */
.modal-body .copyright,
.modal-body footer {
    display: none;
}

/* Input Styling */
input,
textarea,
select {
    background-color: var(--secondary);
    /* Secondary color for inputs */
    color: #e0e0e0;
    border: 1px solid #444;
    padding: 6px;
    /* Reduced padding */
    border-radius: 4px;
    font-family: inherit;
    outline: none;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, filter 0.3s ease;
    margin-bottom: 5px;
    /* Spacing between inputs */
}

input:focus,
textarea:focus,
select:focus {
    border-color: #fff;
    box-shadow: 0 0 8px var(--secondary);
    /* Shadow with secondary color */
    filter: brightness(1.2);
    /* Stand out effect */
}

/* Button Styling */
input[type="submit"],
button {
    background-color: var(--secondary);
    /* Secondary color for buttons */
    color: #fff;
    cursor: pointer;
    border: 1px solid #555;
    font-weight: bold;
    transition: background-color 0.2s, box-shadow 0.2s, filter 0.2s;
}

input[type="submit"]:hover,
button:hover {
    background-color: var(--secondary);
    box-shadow: 0 0 8px var(--secondary);
    /* Shadow with secondary color */
    filter: brightness(1.2);
    /* Stand out effect */
}

/* Navigation Link Improvements */
.nav-item a {
    display: block;
    padding: 4px 8px;
    /* Reduced padding for compactness */
    text-decoration: none;
    color: #e0e0e0;
    transition: background-color 0.2s, color 0.2s, padding-left 0.2s;
    border-radius: 4px;
}

.nav-item a:hover {
    background-color: var(--secondary);
    color: #e0e0e0;
    padding-left: 16px;
    /* Subtle slide effect */
}

/* Mobile Optimization */
@media (max-width: 767px) {
    body {
        font-size: 14px;
        /* Slightly smaller text for mobile */
    }

    .content-column {
        padding: 8px;
        /* Reduced padding */
        overflow-x: auto;
        /* Allow horizontal scroll for wide tables */
    }

    table {
        font-size: 0.9em;
        /* Smaller table text */
    }

    td,
    th {
        padding: 4px;
        /* Tighter table cells */
    }
}

/* Login Form Improvements */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
    background-color: var(--login-bg);
    /* Darker container */
    padding: 20px;
    border-radius: 8px;
}

.login-form input {
    width: 100%;
    box-sizing: border-box;
}

/* Header Link Improvements */
.header-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    /* CSS separation */
    margin-top: 5px;
}

.header-links a {
    position: relative;
}

.header-links a:not(:last-child)::after {
    content: "|";
    position: absolute;
    right: -10px;
    color: #555;
    pointer-events: none;
    opacity: 0.5;
}

.petition-count {
    font-size: 0.9em;
    color: #aaa;
    margin-top: 5px;
}

/* Custom Scrollbar Styling */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: lch(from var(--primary) calc(l + 20) c h) var(--primary);
}

/* WebKit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--primary);
}

::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 4px;
    border: 2px solid var(--primary);
    /* Creates padding effect */
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary);
}

/* Footer Styling */
.copyright {
    display: none;
    text-align: center;
    color: #555;
    /* Darker text */
    font-size: 0.85em;
    line-height: 2em;
    /* More spacing between lines */
    padding: 20px 0;
}

.copyright a {
    color: #666;
    text-decoration: none;
}

.copyright a:hover {
    color: #888;
    text-decoration: underline;
}

/* Settings Button */
.settings-btn {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary);
    /* Primary color for settings button */
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    transition: color 0.2s, box-shadow 0.2s, filter 0.2s;
    border-radius: 4px;
}

.settings-btn:hover {
    color: #fff;
    box-shadow: 0 0 8px var(--secondary);
    filter: brightness(1.2);
}

.settings-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

/* Settings Modal Specific Styles */
.settings-modal .modal-body {
    padding: 20px;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #fff;
}

.settings-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    background-color: var(--primary);
}

.settings-group select {
    width: 100%;
}

.settings-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.settings-actions button {
    padding: 8px 16px;
    border-radius: 4px;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary);
}

.btn-secondary {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-secondary:hover {
    background-color: var(--secondary);
}

/* Dyslexic Font */
body.dyslexic-font {
    font-family: 'Open-Dyslexic', sans-serif;
}