/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    line-height: 1.6;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: #2a2a2a;
    border-bottom: 3px solid #8B5A2B;
    padding: 20px 0;
    margin-bottom: 30px;
}

header h1 {
    color: #FFD700;
    margin-bottom: 15px;
    font-size: 2.5em;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

header nav a {
    color: #FFD700;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 15px;
    border-radius: 4px;
    transition: all 0.3s;
}

header nav a:hover {
    background-color: #8B5A2B;
    color: #fff;
}

.mod-badge {
    background-color: #8B5A2B;
    padding: 10px 15px;
    border-radius: 4px;
    color: #FFD700;
    font-weight: bold;
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    padding-bottom: 30px;
}

h2 {
    color: #FFD700;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 2px solid #8B5A2B;
    padding-bottom: 10px;
}

h3 {
    color: #FFD700;
    margin-top: 20px;
    margin-bottom: 15px;
}

.page-actions {
    margin-top: 0;
    margin-bottom: 16px;
}

.page-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.page-toolbar-left {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 0;
}

.page-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.page-toolbar-label {
    margin: 0;
    color: #e0e0e0;
    white-space: nowrap;
}

.toolbar-field-compact {
    margin-bottom: 0;
}

.toolbar-select-wide {
    min-width: 220px;
    margin: 0;
}

.toolbar-field-160 {
    max-width: 160px;
}

.toolbar-field-220 {
    max-width: 220px;
}

.toolbar-field-260 {
    max-width: 260px;
}

.cell-center {
    text-align: center;
}

.modal-content-wide {
    max-width: 700px;
}

.modal-title-compact,
.modal-title-accent {
    margin-top: 0;
}

.modal-title-accent {
    color: #FFD700;
}

.form-plain {
    background: none;
    border: none;
    padding: 0;
}

.form-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.field-label {
    display: block;
    margin-bottom: 4px;
}

.form-actions {
    margin-top: 20px;
}

.form-actions-inline {
    flex: 1 1 100%;
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-field-full {
    flex: 1 1 100%;
}

.button-gap-left {
    margin-left: 10px;
}

.button-gap-right {
    margin-right: 10px;
}

.textarea-unbounded {
    max-width: none;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-5 {
    margin-top: 5px;
}

.text-muted-accent {
    color: #8B5A2B;
}

.small-block {
    display: block;
}

.action-row {
    display: flex;
    gap: 10px;
}

.is-hidden {
    display: none;
}

.empty-list-hint {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

.mb-10 {
    margin-bottom: 10px;
}

.page-summary-grid {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.summary-card {
    background: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #8B5A2B;
    flex: 1;
    min-width: 160px;
}

.summary-card-title {
    margin-top: 0;
    color: #FFD700;
}

.summary-line {
    margin: 4px 0;
}

.table-mb-24 {
    margin-bottom: 24px;
}

.table-mb-12 {
    margin-bottom: 12px;
}

.modal-content-760 {
    max-width: 760px;
}

.modal-content-980 {
    max-width: 980px;
}

.text-muted {
    color: #999;
}

.history-grid-form {
    display: grid;
    grid-template-columns: 160px 160px 160px 1fr;
    gap: 8px;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
}

.field-compact {
    margin-bottom: 0;
}

.input-unbounded {
    max-width: none;
}

.inline-actions-left {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.button-danger {
    background: #6b2020;
}

.th-w-90 {
    width: 90px;
}

.th-w-120 {
    width: 120px;
}

.th-w-130 {
    width: 130px;
}

.th-w-160 {
    width: 160px;
}

.summary-grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.panel-compact {
    margin: 0;
    padding: 14px;
}

.panel-title {
    margin: 0 0 8px 0;
    color: #FFD700;
}

.py-compact {
    padding: 6px 10px;
}

.fw-700 {
    font-weight: 700;
}

.text-muted-italic {
    color: #999;
    font-style: italic;
}

.text-muted-sep {
    color: #888;
}

.th-action {
    width: 80px;
    text-align: center;
}

.table-mb-16 {
    margin-bottom: 16px;
}

.form-inline-reset {
    display: inline;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    min-width: 0;
}

.button-danger-compact {
    padding: 4px 8px;
    background-color: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.bis-editor {
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 20px;
}

.field-label-strong {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.select-min-180 {
    min-width: 180px;
}

.input-min-300 {
    min-width: 300px;
}

.flex-wrap-row {
    display: flex;
    flex-wrap: wrap;
}

.button-compact {
    padding: 8px 16px;
}

.bis-spec-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 14px 6px 0;
    cursor: pointer;
}

/* BIS Tooltip */
.bis-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 2px 9px;
    background-color: #5a3a1a;
    color: #FFD700;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: default;
    border: 1px solid #8B5A2B;
    position: relative;
    vertical-align: middle;
}
.bis-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1c1c1c;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.88em;
    font-weight: normal;
    white-space: normal;
    max-width: none;
    word-break: normal;
    z-index: 1000;
    pointer-events: none;
    display: none;
    text-align: left;
    min-width: 260px;
    width: max-content;
    white-space: nowrap;
}
.bis-count-badge:hover .bis-tooltip {
    display: block;
}
.bis-tooltip-table {
    width: auto;
    border-collapse: collapse;
    background: transparent;
    border: none;
    margin-bottom: 0;
}
.bis-tooltip-table tbody,
.bis-tooltip-table tr {
    background: transparent;
    border: none;
}
.bis-tooltip-table td {
    padding: 2px 4px;
    border: none;
    vertical-align: top;
    text-align: left;
    background: transparent;
    white-space: nowrap;
}
.bis-tooltip-table td:first-child {
    padding-right: 14px;
}
.bis-tooltip-class {
    font-weight: 700;
}
.bis-tooltip-note {
    color: #cfcfcf;
    font-style: italic;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #2a2a2a;
    border: 1px solid #8B5A2B;
    margin-bottom: 30px;
}

table thead {
    background-color: #1a1a1a;
    border-bottom: 2px solid #8B5A2B;
}

table th {
    color: #FFD700;
    padding: 15px;
    text-align: left;
    font-weight: bold;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #8B5A2B;
}

table tbody tr:hover {
    background-color: #3a3a3a;
}

table a {
    color: #FFD700;
    text-decoration: none;
    font-weight: 500;
}

table a:hover {
    text-decoration: underline;
}

.character-name {
    font-weight: 600;
}

.member-name-former .character-name {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    opacity: 0.9;
}

.member-status-inline {
    color: #d87d7d;
    font-weight: 600;
}

.loot-link {
    font-weight: 600;
    text-decoration: none;
}

.loot-link:hover {
    text-decoration: underline;
}

.loot-item-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loot-item-icon {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid #8B5A2B;
    background: #1a1a1a;
    flex: 0 0 auto;
}

.accent-link {
    color: #f4b860;
    text-decoration: none;
    font-weight: 600;
}

.accent-link:hover {
    color: #ffd27a;
    text-decoration: underline;
}

.text-danger-link {
    color: #d87d7d;
}

.compact-table {
    table-layout: fixed;
}

.compact-table th,
.compact-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.compact-table th:first-child,
.compact-table td:first-child {
    width: 120px;
}

.clickable-rows tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clickable-rows tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.members-table tbody tr.member-row-former {
    background-color: rgba(130, 40, 40, 0.28);
}

.members-table tbody tr.member-row-former:hover {
    background-color: rgba(150, 55, 55, 0.35);
}

.members-table tbody tr.member-row-nonraider {
    background-color: rgba(120, 80, 30, 0.20);
}

.members-table tbody tr.member-row-nonraider:hover {
    background-color: rgba(145, 98, 38, 0.28);
}

.clickable-rows tbody td:last-child {
    overflow: visible;
    text-overflow: clip;
}

.member-dynamic-table {
    table-layout: auto;
}

.member-dynamic-table th,
.member-dynamic-table td {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* Status Badges */
.status-badge {
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    display: inline-block;
}

.status-raider {
    background-color: #2d5f2d;
    color: #7dd87d;
}

.status-former {
    background-color: #5f2d2d;
    color: #d87d7d;
}

.status-social,
.status-pug {
    background-color: #5f4b2d;
    color: #f0c979;
}

/* Mod Section */
.mod-section {
    background-color: #2a2a2a;
    border: 2px solid #8B5A2B;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 8px;
}

.mod-section button {
    background-color: #8B5A2B;
    color: #FFD700;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-right: 10px;
    transition: all 0.3s;
}

.mod-section button:hover {
    background-color: #a86a3a;
}

/* Forms */
form {
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #8B5A2B;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    margin-bottom: 15px;
    background-color: #1a1a1a;
    border: 1px solid #8B5A2B;
    color: #e0e0e0;
    border-radius: 4px;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #FFD700;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

input[type="date"],
input[type="datetime-local"] {
    min-height: 41px;
    color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(80%) sepia(52%) saturate(455%) hue-rotate(3deg) brightness(102%) contrast(102%);
}

button[type="submit"],
button[type="button"] {
    background-color: #8B5A2B;
    color: #FFD700;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

button[type="submit"]:hover,
button[type="button"]:hover {
    background-color: #a86a3a;
}

textarea {
    min-height: 200px;
    max-width: 100%;
    resize: vertical;
}

/* Import Preview */
.import-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.preview-section {
    background-color: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #8B5A2B;
}

.preview-section h4 {
    margin-top: 0;
    color: #FFD700;
}

.preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.preview-list li {
    padding: 5px 0;
    border-bottom: 1px solid #444;
    font-size: 0.9em;
}

.preview-list li.valid {
    color: #7dd87d;
}

.preview-list li.invalid {
    color: #d87d7d;
}

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

.modal-content {
    background-color: #2a2a2a;
    margin: 5% auto;
    padding: 30px;
    border: 2px solid #8B5A2B;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
}

.close {
    color: #FFD700;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #fff;
}

/* Footer */
footer {
    background-color: #2a2a2a;
    border-top: 3px solid #8B5A2B;
    padding: 20px 0;
    text-align: center;
    color: #FFD700;
    margin-top: 50px;
}

/* Error and Success Messages */
.error {
    background-color: #5f2d2d;
    color: #d87d7d;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid #d87d7d;
}

.success {
    background-color: #2d5f2d;
    color: #7dd87d;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid #7dd87d;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    header nav ul {
        gap: 10px;
    }

    table {
        font-size: 0.9em;
    }

    table th,
    table td {
        padding: 8px;
    }

    .modal-content {
        width: 95%;
        margin: 20% auto;
    }
}

    /* Table filters bar */
    .table-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
        align-items: center;
    }

    .table-filters select,
    .table-filters input[type="text"],
    .table-filters input[type="date"],
    .table-filters input[type="datetime-local"] {
        width: auto;
        max-width: none;
        min-width: 130px;
        margin-bottom: 0;
        padding: 7px 10px;
    }

    /* Sortable column headers */
    th.sortable:hover {
        background-color: rgba(255, 215, 0, 0.06);
        cursor: pointer;
    }

    .sort-icon {
        font-size: 0.75em;
        opacity: 0.55;
        margin-left: 4px;
    }

    /* Inline moderator edit link in tables */
    .mod-edit-link {
        color: #FFD700;
        text-decoration: none;
        font-weight: bold;
        white-space: nowrap;
    }

    .mod-edit-link:hover {
        text-decoration: underline;
    }

    /* Admin page form alignment helpers */
    .admin-inline-form {
        background: none;
        border: none;
        padding: 0;
        display: flex;
        gap: 10px;
        align-items: flex-end;
        flex-wrap: wrap;
    }

    .admin-inline-form input,
    .admin-inline-form select {
        margin-bottom: 0;
    }

    /* Collapsible admin sections */
    details.mod-section > summary {
        cursor: pointer;
        list-style: none;
        font-weight: bold;
        color: #FFD700;
    }

    details.mod-section > summary::-webkit-details-marker {
        display: none;
    }

    details.mod-section > summary::after {
        content: '▾';
        float: right;
        color: #FFD700;
    }

    details.mod-section:not([open]) > summary::after {
        content: '▸';
    }

    details.mod-section > .section-body {
        margin-top: 14px;
    }
