/* ============================================================================
   Timeline / History page styles
   Reuses the site's existing CSS variables (--accent-color, --card-bg,
   --border-color, --text-muted) defined in styles.css, so it stays visually
   consistent with the rest of EPFR. Only adds the few variables that are
   specific to this feature (status colors).
   ============================================================================ */

:root {
    --tl-status-active: #22c55e;
    --tl-status-inactive: #ef4444;
    --tl-status-planning: #f59e0b;
}

/* --- Sidebar filter controls --- */

.tl-filter-block {
    margin-top: 20px;
}

.filter-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.filter-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-btn-group .tl-filter {
    font-size: 0.7rem;
    padding: 5px 10px;
    width: auto;
}

.tl-text-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    color: inherit;
    font-size: 0.8rem;
    box-sizing: border-box;
}

/* Native <select> only takes background/color on the closed box reliably across
   browsers — the open option list is OS-rendered. color-scheme: dark tells the
   browser to render that native popup in dark mode too, instead of defaulting
   to a barely-readable light system popup on a dark page. */
select.tl-text-input {
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%2394a3b8'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

select.tl-text-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* --- Timeline structure --- */

.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    min-height: 80px;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background: var(--accent-color);
    opacity: 0.4;
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
}

.tl-item {
    position: relative;
    width: 50%;
    padding: 8px 40px;
    box-sizing: border-box;
    margin-bottom: 16px;
    z-index: 2;
}

.tl-item.left { left: 0; text-align: right; }
.tl-item.right { left: 50%; text-align: left; }

/* Connector dot on real entries (not milestones) */
.tl-item:not(.tl-milestone)::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--card-bg);
    border: 3px solid var(--border-color);
    top: 22px;
    border-radius: 50%;
    z-index: 5;
    transition: all 0.25s ease;
}
.tl-item.left:not(.tl-milestone)::after { right: -9px; }
.tl-item.right:not(.tl-milestone)::after { left: -9px; }
.tl-item:not(.tl-milestone):hover::after {
    background: var(--accent-color);
    transform: scale(1.3);
}

/* --- Milestone styling (small connector lines, no card) --- */

.tl-item.tl-milestone {
    padding: 4px 40px;
    margin-bottom: 8px;
}

.tl-item.tl-milestone::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 20px;
    height: 2px;
    background: var(--border-color);
    opacity: 0.6;
}
.tl-item.tl-milestone.left::before { right: 0; }
.tl-item.tl-milestone.right::before { left: 0; }

.tl-milestone-content {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 700;
    text-transform: uppercase;
}

.tl-milestone-desc {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* --- Card styling (leagues / tournaments / alliances) --- */

.tl-content {
    padding: 18px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.tl-content:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.tl-badge-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    justify-content: space-between;
    align-items: center;
}
.tl-item.left .tl-badge-row { flex-direction: row-reverse; }
.tl-tag-group { display: flex; gap: 6px; }

.tl-year {
    background: var(--accent-color);
    color: #0f172a;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.7rem;
    white-space: nowrap;
}

.tl-status {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
}
.tl-status-active { background: var(--tl-status-active); }
.tl-status-inactive { background: var(--tl-status-inactive); }
.tl-status-planning { background: var(--tl-status-planning); }

.tl-type-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.tl-content h3 {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
}

.tl-country {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.tl-info-text {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: max-height 0.35s ease, opacity 0.35s ease, margin-top 0.35s ease;
}

.tl-content.expanded .tl-info-text {
    max-height: 400px;
    opacity: 1;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* --- Mobile layout (single column, like the original) --- */

@media screen and (max-width: 700px) {
    .timeline::after { left: 31px; }
    .tl-item { width: 100%; padding-left: 60px; padding-right: 10px; text-align: left !important; }
    .tl-item:not(.tl-milestone)::after { left: 22px; right: auto; }
    .tl-item.tl-milestone::before { left: 31px; width: 15px; right: auto; }
    .tl-item.right { left: 0; }
    .tl-badge-row, .tl-item.left .tl-badge-row { flex-direction: row; justify-content: space-between; }
}
