/**
 * Rules Reference Index Styles
 * Enhanced UI for Desert of Shadows V2
 */

/* Index Layout */
.index-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
    margin-top: 30px;
}

/* Index Sidebar */
.index-sidebar {
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.index-sidebar h3 {
    color: #c00000;
    font-size: 1.3em;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #8b0000;
}

.index-sidebar h4 {
    color: #888;
    font-size: 0.9em;
    margin: 20px 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Category Filters */
.filter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #1a1a1a;
    border-radius: 5px;
    transition: all 0.2s;
}

.filter-item:hover {
    background: #222;
}

.filter-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #c00000;
}

.filter-label {
    flex: 1;
    cursor: pointer;
    color: #e0e0e0;
    font-size: 0.95em;
}

.filter-count {
    background: #8b0000;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
}

/* Sort Options */
.sort-options {
    margin-top: 20px;
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 5px;
}

.sort-option input[type="radio"] {
    cursor: pointer;
    accent-color: #c00000;
}

.sort-option label {
    cursor: pointer;
    color: #e0e0e0;
    font-size: 0.9em;
}

/* Index Stats */
.index-stats {
    margin-top: 20px;
    padding: 15px;
    background: #1a1a1a;
    border-radius: 5px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 10px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #c00000;
}

.stat-label {
    font-size: 0.85em;
    color: #888;
    margin-top: 5px;
}

/* Index List */
.index-list {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.index-list::-webkit-scrollbar {
    width: 8px;
}

.index-list::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.index-list::-webkit-scrollbar-thumb {
    background: #8b0000;
    border-radius: 4px;
}

.index-list::-webkit-scrollbar-thumb:hover {
    background: #c00000;
}

.index-item {
    background: #1a1a1a;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid #555;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.index-item:hover {
    background: #222;
    border-left-color: #c00000;
    transform: translateX(3px);
}

.index-item.bookmarked {
    border-left-color: #ffd700;
}

.index-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.index-item-ref {
    font-size: 0.75em;
    color: #888;
    font-family: monospace;
    background: #0d0d0d;
    padding: 2px 6px;
    border-radius: 3px;
}

.bookmark-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1.2em;
    padding: 2px 6px;
    transition: all 0.2s;
}

.bookmark-btn:hover {
    color: #ffd700;
    transform: scale(1.2);
}

.bookmark-btn.active {
    color: #ffd700;
}

.index-item-name {
    font-size: 1em;
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 4px;
}

.index-item-type {
    font-size: 0.85em;
    color: #888;
}

.index-loading,
.index-empty {
    text-align: center;
    padding: 20px;
    color: #888;
    font-style: italic;
}

/* Export Button */
.index-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.export-btn {
    width: 100%;
    padding: 10px;
    background: #8b0000;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.export-btn:hover {
    background: #a00000;
    transform: translateY(-2px);
}

/* Search Enhancements */
.index-search-container {
    margin-bottom: 30px;
}

.search-wrapper {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.search-box {
    flex: 1;
}

.search-clear-btn {
    padding: 12px 20px;
    background: #444;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.search-clear-btn:hover {
    background: #555;
}

.search-count {
    text-align: center;
    color: #888;
    font-size: 0.9em;
    margin-top: 10px;
    display: none;
}

.search-shortcuts {
    text-align: center;
    color: #666;
    font-size: 0.85em;
    margin-top: 10px;
}

.search-shortcuts kbd {
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    color: #c00000;
}

/* A-Z Navigation */
.az-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
    padding: 15px;
    background: #1a1a1a;
    border-radius: 5px;
    border: 1px solid #333;
}

.az-nav-btn {
    width: 36px;
    height: 36px;
    background: #0d0d0d;
    color: #888;
    border: 1px solid #444;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.az-nav-btn:hover {
    background: #8b0000;
    color: white;
    border-color: #c00000;
    transform: translateY(-2px);
}

/* Main Content Area */
.index-content {
    min-width: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .index-layout {
        grid-template-columns: 280px 1fr;
        gap: 20px;
    }
    
    .index-sidebar {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .index-layout {
        grid-template-columns: 1fr;
    }
    
    .index-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 30px;
    }
    
    .index-list {
        max-height: 300px;
    }
    
    .az-navigation {
        gap: 5px;
    }
    
    .az-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9em;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Loading States */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Accessibility */
.filter-checkbox:focus,
.sort-option input:focus,
.bookmark-btn:focus {
    outline: 2px solid #c00000;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .index-sidebar,
    .search-wrapper,
    .az-navigation,
    .rules-nav {
        display: none;
    }
    
    .index-layout {
        grid-template-columns: 1fr;
    }
    
    .rules-section {
        display: block !important;
    }
}
/* Character Sheet Dot Styles - CRITICAL FOR RENDERING */

/* Attribute Dots (.attr-dot) */
.attr-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #666;
    background: transparent;
    cursor: pointer;
    display: inline-block;
    margin: 0 3px;
    transition: all 0.2s;
}

.attr-dot.filled {
    background: #fff;
    border-color: #fff;
}

.attr-dot.filled.free {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.attr-dot.filled.spent {
    background: #fff;
    border-color: #fff;
}

.attr-dot.unaffordable {
    border-color: #333;
    cursor: not-allowed;
    opacity: 0.3;
}

.attr-dot:not(.filled):not(.unaffordable):hover {
    border-color: #999;
    background: rgba(255, 255, 255, 0.1);
}

/* Skill Dots (.skill-dot) */
.skill-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #666;
    background: transparent;
    cursor: pointer;
    display: inline-block;
    margin: 0 3px;
    transition: all 0.2s;
}

.skill-dot.filled {
    background: #fff;
    border-color: #fff;
}

.skill-dot.filled.granted {
    background: #e53935;
    border-color: #e53935;
}

.skill-dot.filled.merit {
    background: #f59e0b;
    border-color: #f59e0b;
}

.skill-dot.filled.free {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.skill-dot.filled.spent {
    background: #fff;
    border-color: #fff;
}

.skill-dot.unaffordable {
    border-color: #333;
    cursor: not-allowed;
    opacity: 0.3;
}

.skill-dot:not(.filled):not(.unaffordable):hover {
    border-color: #999;
    background: rgba(255, 255, 255, 0.1);
}

/* Discipline Dots (if needed) */
.disc-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #666;
    background: transparent;
    cursor: pointer;
    display: inline-block;
    margin: 0 3px;
    transition: all 0.2s;
}

.disc-dot.filled {
    background: #fff;
    border-color: #fff;
}

.disc-dot.filled.clan {
    background: #8b0000;
    border-color: #8b0000;
}

.disc-dot.filled.common {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.disc-dot.filled.spent {
    background: #fff;
    border-color: #fff;
}

.disc-dot.unaffordable {
    border-color: #333;
    cursor: not-allowed;
    opacity: 0.3;
}

.disc-dot:not(.filled):not(.unaffordable):hover {
    border-color: #999;
    background: rgba(255, 255, 255, 0.1);
}

/* Generic .dot class - used by Disciplines and Backgrounds */
.dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #666;
    background: transparent;
    cursor: pointer;
    display: inline-block;
    margin: 0 3px;
    transition: all 0.2s;
}

.dot.filled {
    background: #fff;
    border-color: #fff;
}

.dot.filled.granted {
    background: #e53935;
    border-color: #e53935;
}

.dot.filled.free {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.dot.filled.merit {
    background: #f59e0b;
    border-color: #f59e0b;
}

.dot.filled.spent,
.dot.spent {
    background: #fff;
    border-color: #fff;
}

.dot.empty {
    background: transparent;
    border-color: #666;
}

.dot.locked {
    cursor: not-allowed;
    opacity: 0.5;
}

.dot.unaffordable {
    border-color: #333;
    cursor: not-allowed;
    opacity: 0.3;
}

.dot.restricted {
    border-color: #8b0000;
    opacity: 0.6;
}

.dot.restricted.capped {
    border-color: #444;
    background: #222;
    cursor: not-allowed;
}

.dot:not(.filled):not(.unaffordable):not(.locked):not(.restricted):hover {
    border-color: #999;
    background: rgba(255, 255, 255, 0.1);
}

/* Read-only dots container */
.dots-container.read-only .dot {
    cursor: not-allowed;
    opacity: 0.6;
}
