/* ============================================================
   Timeline — vis-timeline custom styles
   ============================================================ */

/* Tooltip + overflow + background panely — pointer-events none aby sa dalo kliknúť na skladateľov */
.vis-tooltip,
.vis-item-overflow,
.vis-panel.vis-background,
.vis-panel.vis-background.vis-vertical,
.vis-panel.vis-background.vis-horizontal,
.vis-time-axis.vis-background,
.vis-item.vis-background {
    pointer-events: none !important;
}

/* Kontajner */
#timeline-container {
    min-height: 500px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
}

/* vis-timeline items — osoby */
.vis-item.vis-range {
    border-radius: 3px;
    border-width: 1px;
    font-size: 11px;
    line-height: 1.3;
    min-height: 20px;
}

.vis-item.vis-range .vis-item-content {
    padding: 1px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vis-item.vis-point {
    font-size: 10px;
}
.vis-item.vis-point .vis-item-content {
    padding: 1px 4px;
    white-space: nowrap;
}
.vis-item.vis-point .vis-dot {
    width: 8px;
    height: 8px;
    border-width: 2px;
}

/* Hover efekt */
.vis-item:hover {
    z-index: 100 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    cursor: pointer;
}

/* Vybraný item */
.vis-item.vis-selected {
    box-shadow: 0 0 0 2px #0d6efd;
}

/* Background items (éry) */
.vis-item.vis-background {
    opacity: 0.3;
}

/* Éra label vo vnútri background itemu */
.vis-item.vis-background .vis-item-content {
    font-size: 13px;
    font-weight: 600;
    color: rgba(0,0,0,0.4);
    padding-top: 4px;
}

/* Farby podľa ér — priradené cez className */
.vis-item.era-renesancia { background-color: #E8D5B7; border-color: #C4A882; color: #5C4A2F; }
.vis-item.era-barok      { background-color: #D4C5A9; border-color: #A89A7C; color: #4A3F2E; }
.vis-item.era-klasicizmus { background-color: #C5D5E0; border-color: #8FAFC2; color: #2E4A5C; }
.vis-item.era-romantizmus { background-color: #E0C5C5; border-color: #C28F8F; color: #5C2E2E; }
.vis-item.era-moderna    { background-color: #C5E0C5; border-color: #8FC28F; color: #2E5C2E; }
.vis-item.era-sucastnost { background-color: #D5C5E0; border-color: #A88FC2; color: #3F2E5C; }

/* Default farba (ak nespadá do žiadnej éry) */
.vis-item.era-default    { background-color: #e9ecef; border-color: #adb5bd; color: #495057; }

/* Floruit bodky */
.vis-item.vis-point.floruit-point {
    border-color: #6c757d;
}
.vis-item.vis-point.floruit-point .vis-dot {
    border-color: #6c757d;
}

/* Timeline panel — axis labels */
.vis-time-axis .vis-text {
    font-size: 12px;
    color: #6c757d;
}

.vis-time-axis .vis-text.vis-major {
    font-weight: 600;
    color: #495057;
}

/* Legenda */
.timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.timeline-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.timeline-legend-swatch {
    display: inline-block;
    width: 20px;
    height: 12px;
    border-radius: 2px;
    opacity: 0.6;
}

/* Filtre */
.timeline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.timeline-filters select {
    max-width: 220px;
}

/* Searchable select dropdown */
.sf-select-search {
    position: relative;
    min-width: 200px;
}
.sf-select-search-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.3rem 0.75rem;
    font-size: 0.875rem;
    background: var(--sf-card-bg, rgba(0,0,0,0.03));
    border: 1px solid var(--sf-border, rgba(0,0,0,0.15));
    border-radius: 0.375rem;
    color: var(--sf-text, #1a1a1a);
    cursor: pointer;
    text-align: left;
}
.sf-select-search-btn:hover {
    border-color: var(--sf-accent, #c9a84c);
}
.sf-select-search-btn i {
    font-size: 0.7rem;
    opacity: 0.5;
}
.sf-select-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    margin-top: 2px;
    background: var(--sf-bg, #fff);
    border: 1px solid var(--sf-border, rgba(0,0,0,0.15));
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
}
.sf-select-search-input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--sf-border, rgba(0,0,0,0.1));
    font-size: 0.85rem;
    background: transparent;
    color: var(--sf-text, #1a1a1a);
    outline: none;
}
.sf-select-search-options {
    max-height: 250px;
    overflow-y: auto;
}
.sf-select-search-option {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--sf-text, #1a1a1a);
}
.sf-select-search-option:hover {
    background: rgba(201,168,76,0.1);
}
.sf-select-search-option.active {
    background: rgba(201,168,76,0.15);
    color: var(--sf-accent, #c9a84c);
    font-weight: 600;
}

/* Dark mode */
[data-bs-theme="dark"] .sf-select-search-btn {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.15);
    color: #e0e0e0;
}
[data-bs-theme="dark"] .sf-select-search-dropdown {
    background: #1e1e2e;
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
[data-bs-theme="dark"] .sf-select-search-input {
    border-bottom-color: rgba(255,255,255,0.1);
    color: #e0e0e0;
}
[data-bs-theme="dark"] .sf-select-search-option {
    color: #ccc;
}
[data-bs-theme="dark"] .sf-select-search-option:hover {
    background: rgba(255,255,255,0.06);
}

/* Info bar (počet zobrazených) */
.timeline-info {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Custom tooltip */
.timeline-tooltip {
    position: absolute;
    background: #212529;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
    max-width: 280px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.timeline-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #212529;
}

/* Loading */
.timeline-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #6c757d;
}

/* === DARK MODE === */

[data-bs-theme="dark"] #timeline-container {
    background: #212529;
    border-color: rgba(255,255,255,.1);
}

/* vis-timeline — len axis panely (nie center, ten blokuje klik!) */
[data-bs-theme="dark"] .vis-panel.vis-bottom,
[data-bs-theme="dark"] .vis-panel.vis-top {
    background: #2b3035;
    border-color: rgba(255,255,255,.1);
}

/* Grid čiary */
[data-bs-theme="dark"] .vis-grid.vis-minor {
    border-color: rgba(255,255,255,.06);
}
[data-bs-theme="dark"] .vis-grid.vis-major {
    border-color: rgba(255,255,255,.12);
}

/* Axis text */
[data-bs-theme="dark"] .vis-time-axis .vis-text {
    color: #adb5bd;
}
[data-bs-theme="dark"] .vis-time-axis .vis-text.vis-major {
    color: #dee2e6;
}

/* Items — éry (tmavšie odtiene pre dark) */
[data-bs-theme="dark"] .vis-item.era-renesancia { background-color: #5C4A2F; border-color: #8A7050; color: #E8D5B7; }
[data-bs-theme="dark"] .vis-item.era-barok      { background-color: #4A3F2E; border-color: #7A6E52; color: #D4C5A9; }
[data-bs-theme="dark"] .vis-item.era-klasicizmus { background-color: #2E4A5C; border-color: #4A7A96; color: #C5D5E0; }
[data-bs-theme="dark"] .vis-item.era-romantizmus { background-color: #5C2E2E; border-color: #964A4A; color: #E0C5C5; }
[data-bs-theme="dark"] .vis-item.era-moderna    { background-color: #2E5C2E; border-color: #4A964A; color: #C5E0C5; }
[data-bs-theme="dark"] .vis-item.era-sucastnost { background-color: #3F2E5C; border-color: #6A4A96; color: #D5C5E0; }
[data-bs-theme="dark"] .vis-item.era-default    { background-color: #343a40; border-color: #6c757d; color: #dee2e6; }

/* Background éry label — svetlejší text na tmavom pozadí */
[data-bs-theme="dark"] .vis-item.vis-background .vis-item-content {
    color: rgba(255,255,255,0.3);
}

/* Hover */
[data-bs-theme="dark"] .vis-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Vybraný item */
[data-bs-theme="dark"] .vis-item.vis-selected {
    box-shadow: 0 0 0 2px #6ea8fe;
}

/* Floruit bodky */
[data-bs-theme="dark"] .vis-item.vis-point.floruit-point {
    border-color: #adb5bd;
}
[data-bs-theme="dark"] .vis-item.vis-point.floruit-point .vis-dot {
    border-color: #adb5bd;
}

/* Legenda */
[data-bs-theme="dark"] .timeline-legend-item {
    color: #adb5bd;
}

/* Info */
[data-bs-theme="dark"] .timeline-info {
    color: #adb5bd;
}

/* Loading */
[data-bs-theme="dark"] .timeline-loading {
    color: #adb5bd;
}

/* Tooltip — už je tmavý, ale svetlý mód prevrátiť */
[data-bs-theme="dark"] .timeline-tooltip {
    background: #f8f9fa;
    color: #212529;
}
[data-bs-theme="dark"] .timeline-tooltip::after {
    border-top-color: #f8f9fa;
}

/* Responsive */
@media (max-width: 768px) {
    #timeline-container {
        min-height: 350px;
    }

    .vis-item.vis-range {
        font-size: 9px;
        min-height: 16px;
    }

    .vis-item.vis-range .vis-item-content {
        padding: 0 3px;
    }

    .timeline-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .timeline-filters select,
    .sf-select-search {
        max-width: 100%;
    }

    .timeline-legend {
        gap: 0.5rem;
    }
}
