/* Lore Infobox Sidebar */
.lore-infobox {
    float: right;
    width: 300px;
    margin: 0 0 1rem 1.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    background: #fff;
}

.lore-infobox .card-header {
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.lore-infobox .infobox-image {
    width: 100%;
    display: block;
}

.lore-infobox .infobox-section {
    border-top: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

.lore-infobox .infobox-section-header {
    font-weight: bold;
    font-size: 0.85rem;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
}

.lore-infobox .infobox-row {
    display: flex;
    justify-content: space-between;
    padding: 0.15rem 0;
}

.lore-infobox .infobox-label {
    font-weight: bold;
    font-size: 0.85rem;
    color: #495057;
}

.lore-infobox .infobox-value {
    font-size: 0.9rem;
    text-align: right;
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
    .lore-infobox {
        float: none;
        width: 100%;
        margin: 0 0 1rem 0;
    }
}

/* Lore entry image on listing cards */
.world-entry .world-entry-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.world-entry .world-entry-image a {
    display: block;
    width: 100%;
}

.world-entry .world-entry-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

/* Lore content clearfix */
.lore-content::after {
    content: "";
    display: table;
    clear: both;
}

/* Template body sections */
.lore-body-section {
    margin-top: 1.5rem;
    clear: both;
}

.lore-body-section h4 {
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.25rem;
}

/* Timeline styling */
.timeline-chronology {
    margin-bottom: 2rem;
}

.timeline-chronology-header {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-left: 4px solid #007bff;
    margin-bottom: 1rem;
}

.timeline-event {
    padding: 0.5rem 0 0.5rem 1.5rem;
    border-left: 2px solid #dee2e6;
    margin-left: 0.5rem;
}

.timeline-event-date {
    font-weight: bold;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Related sections on detail pages */
.lore-related-section {
    clear: both;
    margin-top: 2rem;
}

.lore-related-section h4 {
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.25rem;
}

/* Collapsible section chevron rotation */
.lore-related-section h4 a[aria-expanded="true"] .fa-chevron-down {
    transition: transform 0.2s;
    transform: rotate(0deg);
}

.lore-related-section h4 a[aria-expanded="false"] .fa-chevron-down {
    transition: transform 0.2s;
    transform: rotate(-90deg);
}

/* Template builder sortable placeholder */
.sortable-placeholder {
    border: 2px dashed #ccc;
    margin-bottom: 1rem;
    min-height: 60px;
    border-radius: 0.25rem;
}

/* Sidebar category sub-items */
.sidebar-subitem a {
    font-size: 0.85em;
    padding-left: 2em !important;
    text-transform: none !important;
    color: rgba(0,0,0,0.35);
}

.sidebar-subitem a:hover {
    color: #16181b;
}

.sidebar-subitem a.active,
.sidebar-subitem a.active:hover {
    color: white;
    background-color: #343a40;
}

/* Sidebar toggle chevron */
.sidebar-toggle {
    padding: 0.1em 0.5em;
    color: rgba(0,0,0,0.3);
    text-decoration: none;
}

.sidebar-toggle:hover {
    color: rgba(0,0,0,0.6);
    text-decoration: none;
}

.sidebar-toggle[aria-expanded="true"] .fa-chevron-down {
    transition: transform 0.2s;
    transform: rotate(180deg);
}

.sidebar-toggle[aria-expanded="false"] .fa-chevron-down,
.sidebar-toggle.collapsed .fa-chevron-down {
    transition: transform 0.2s;
    transform: rotate(0deg);
}
