/* Consolidated CSS for DataTables with Filter Panels */
/* Used by monsters, spells, and magic items indexes */

/* Base page styling */
body {
    max-width: 800px;
    margin: auto;
    font-size: 18px;
    font-family: sans-serif;
    padding: 10px;
}

p, li {
    line-height: 1.5em;
}

/* Mobile-friendly font sizes */
input, button, select, label {
    font-size: 16px !important;
}

/* Filter panel styling */
.filter-panel {
    background: #f5f5f5;
    border: 1px solid #ccc;
    margin: 10px 0;
    border-radius: 4px;
}

.filter-header {
    padding: 10px 15px;
    cursor: pointer;
    background: #e8e8e8;
    border-bottom: 1px solid #ccc;
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-header:hover {
    background: #ddd;
}

.filter-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.filter-toggle {
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

.filter-content {
    padding: 15px;
    display: block;
}

.filter-content.collapsed {
    display: none;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.filter-column {
    flex: 1;
    min-width: 200px;
}

.filter-column h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

.filter-options {
    border: 1px solid #ddd;
    background: white;
    padding: 8px;
    border-radius: 3px;
}

/* Scrollable filter options for categories with many items */
.filter-options#crFilters,
.filter-options#sourceFilters,
.filter-options#rarityFilters,
.filter-options#typeFilters,
.filter-options#levelFilters,
.filter-options#classFilters {
    max-height: 200px;
    overflow-y: auto;
}

.filter-option {
    display: flex;
    align-items: center;
    margin: 4px 0;
}

.filter-option input[type="checkbox"] {
    margin-right: 8px;
}

.filter-option label {
    cursor: pointer;
    font-size: 14px;
}

.filter-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
}

.filter-actions button.primary {
    background: #007cba;
    color: white;
}

.filter-actions button.primary:hover {
    background: #005a87;
}

.filter-actions button:not(.primary) {
    background: #f1f1f1;
    color: #333;
}

.filter-actions button:not(.primary):hover {
    background: #e1e1e1;
}

.filter-summary {
    font-size: 12px;
    color: #666;
    margin-left: auto;
}

/* Spell-specific level comparison styling */
.level-comparison {
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.level-comparison h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #555;
}

.level-comparison-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.level-comparison-row input[type="checkbox"] {
    margin-right: 8px;
}

.level-comparison-row select,
.level-comparison-row input[type="number"] {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
}

/* DataTables styling */
.dataTables_wrapper {
    margin-top: 20px;
}

.dataTables_length,
.dataTables_filter {
    margin-bottom: 10px;
}

.dataTables_info,
.dataTables_paginate {
    margin-top: 10px;
}

/* Responsive styling */
@media (max-width: 600px) {
    .filter-row {
        flex-direction: column;
    }

    .filter-column {
        min-width: 0;
    }

    .level-comparison-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #000;
        color: #e0e0e0;
    }

    /* Filter panel */
    .filter-panel {
        background: #000;
        border-color: #555;
    }

    .filter-header {
        background: #111;
        border-bottom-color: #555;
    }

    .filter-header:hover {
        background: #222;
    }

    .filter-header h3 {
        color: #e0e0e0;
    }

    .filter-toggle {
        color: #999;
    }

    /* Filter content */
    .filter-column h4 {
        color: #e0e0e0;
    }

    .filter-options {
        background: #000;
        border-color: #555;
    }

    .filter-option label {
        color: #e0e0e0;
    }

    /* Filter actions */
    .filter-actions button.primary {
        background: #007cba;
        color: white;
    }

    .filter-actions button.primary:hover {
        background: #005a87;
    }

    .filter-actions button:not(.primary) {
        background: #222;
        color: #e0e0e0;
        border: 1px solid #555;
    }

    .filter-actions button:not(.primary):hover {
        background: #333;
    }

    .filter-summary {
        color: #999;
    }

    /* Level comparison */
    .level-comparison {
        background: #000;
    }

    .level-comparison h5 {
        color: #e0e0e0;
    }

    .level-comparison-row select,
    .level-comparison-row input[type="number"] {
        background-color: #333;
        border-color: #555;
        color: #e0e0e0;
    }

    /* Input elements */
    input[type="text"],
    input[type="number"],
    input[type="search"] {
        background-color: #333;
        border-color: #555;
        color: #e0e0e0;
    }

    /* Make number input spinners visible */
    input[type="number"]::-webkit-inner-spin-button,
    input[type="number"]::-webkit-outer-spin-button {
        opacity: 1;
        filter: invert(1);
    }

    input[type="checkbox"] {
        background-color: transparent;
        border-color: #555;
        cursor: pointer;
    }

    input::placeholder {
        color: #888;
    }

    /* Select elements */
    select {
        background-color: #333;
        border-color: #555;
        color: #e0e0e0;
    }

    /* Links */
    a {
        color: #6db3f2;
    }

    a:visited {
        color: #b4a7d6;
    }
}