:root {
    color-scheme: light;
}

/* === Layout base === */
body.changelog-page {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(155deg, #0f172a 0%, #1e293b 45%, #334155 100%);
    color: #0f172a;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sfondo animato */
.animated-background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.animated-background .cube {
    position: absolute;
    width: 140px;
    height: 140px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 28px;
    transform: rotate(45deg);
    animation: float 18s ease-in-out infinite;
    opacity: 0.12;
    backdrop-filter: blur(2px);
}

.animated-background .cube:nth-child(1) { top: 5%; left: 10%; animation-delay: 0s; }
.animated-background .cube:nth-child(2) { top: 35%; right: 15%; animation-delay: 5s; }
.animated-background .cube:nth-child(3) { bottom: 20%; left: 25%; animation-delay: 9s; }
.animated-background .cube:nth-child(4) { top: 55%; right: 35%; animation-delay: 13s; }
.animated-background .cube:nth-child(5) { bottom: 8%; right: 8%; animation-delay: 2s; }

@keyframes float {
    0%   { transform: translateY(0) rotate(45deg); }
    50%  { transform: translateY(-40px) rotate(55deg); }
    100% { transform: translateY(0) rotate(45deg); }
}

/* === Container principale === */
.changelog-container {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px clamp(16px, 5vw, 60px) 90px;
}

/* === Header === */
.changelog-header {
    background: rgba(255,255,255,0.92);
    border-radius: 28px;
    padding: clamp(24px, 4vw, 48px);
    margin-bottom: 40px;
    box-shadow: 0 30px 60px rgba(15,23,42,0.18);
    position: relative;
    overflow: hidden;
}

.changelog-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(99,102,241,0.18), transparent 62%),
                radial-gradient(circle at bottom left, rgba(56,189,248,0.16), transparent 55%);
    pointer-events: none;
}

.back-button {
    margin-bottom: 20px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(99,102,241,0.14);
    color: #1f2937;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-back i {
    font-size: 0.95rem;
}

.btn-back:hover {
    transform: translateX(-4px);
    background: rgba(99,102,241,0.22);
}

.changelog-header h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 3.1rem);
    font-weight: 700;
    color: #0f172a;
}

.changelog-header .subtitle {
    margin: 14px 0 0;
    font-size: 1.05rem;
    color: #475569;
}

/* === Selettore versioni === */
.version-selector {
    text-align: center;
    margin-bottom: 36px;
}

.version-selector select {
    padding: 11px 26px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,0.12);
    background: rgba(255,255,255,0.95);
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    box-shadow: 0 18px 32px rgba(15,23,42,0.12);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.version-selector select:focus {
    outline: none;
    border-color: rgba(99,102,241,0.7);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.18);
}

/* === Timeline === */
.changelog-wrapper {
    position: relative;
    padding-left: 160px;
}

.changelog-wrapper::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: 0;
    left: 120px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(99,102,241,0.65) 0%, rgba(59,130,246,0.2) 100%);
}

.changelog-item {
    display: flex;
    gap: 34px;
    margin-bottom: 52px;
    position: relative;
}

/* === Version tag === */
.version-tag {
    width: 120px;
    text-align: right;
    padding-right: 32px;
    color: #0f172a;
    position: relative;
}

.version-tag::after {
    content: '';
    position: absolute;
    right: -11px;
    top: 11px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #38bdf8);
    box-shadow: 0 0 0 6px rgba(99,102,241,0.2);
}

.version-tag .version {
    display: block;
    font-size: 1.08rem;
    font-weight: 700;
    color: #0f172a;
}

.version-tag .date,
.version-tag .tag {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: rgba(15,23,42,0.65);
}

.version-tag .tag {
    width: max-content;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(99,102,241,0.15);
    color: #6366f1;
    font-weight: 600;
}

/* === Card changelog === */
.changelog-content {
    flex: 1;
    background: rgba(255,255,255,0.96);
    border-radius: 26px;
    padding: clamp(22px, 3vw, 36px);
    box-shadow: 0 42px 60px rgba(15,23,42,0.2);
    border: 1px solid rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.changelog-item:hover .changelog-content {
    transform: translateY(-6px);
    box-shadow: 0 52px 70px rgba(15,23,42,0.24);
}

.release-title {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 18px;
    margin-bottom: 22px;
    border-bottom: 1px solid rgba(148,163,184,0.2);
}

.release-title h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    font-weight: 700;
    color: #0f172a;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #fff;
}

.badge.feature { background: linear-gradient(135deg, #22c55e, #16a34a); }
.badge.major   { background: linear-gradient(135deg, #f97316, #ea580c); }
.badge.beta    { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.badge.alpha   { background: linear-gradient(135deg, #f59e0b, #d97706); }

.release-notes {
    margin: 0 0 26px;
    font-style: italic;
    color: rgba(15,23,42,0.72);
}

/* === Categorie === */
.change-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(18px, 2vw, 28px);
}

.change-category h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.change-category h3 i {
    font-size: 1.05rem;
    color: #2563eb;
}

.change-category ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.change-category li {
    position: relative;
    padding: 6px 0 6px 20px;
    font-size: 0.95rem;
    color: rgba(15,23,42,0.88);
    line-height: 1.55;
}

.change-category li::before {
    content: '•';
    position: absolute;
    left: 4px;
    color: #2563eb;
}

/* === Footer === */
.changelog-footer {
    text-align: center;
    padding: 48px 0 72px;
    color: rgba(226,232,240,0.85);
    font-size: 0.9rem;
}

/* === Responsive === */
@media (max-width: 992px) {
    .changelog-wrapper {
        padding-left: 130px;
    }
    .changelog-wrapper::before {
        left: 92px;
    }
    .version-tag {
        width: 100px;
        padding-right: 22px;
    }
}

@media (max-width: 768px) {
    .changelog-container {
        padding: 36px 18px 72px;
    }
    .changelog-header {
        padding: 28px 22px;
    }
    .changelog-header h1 {
        font-size: 2.4rem;
    }
    .changelog-header .subtitle {
        font-size: 1rem;
    }
    .version-selector select {
        width: 100%;
        max-width: 360px;
    }
}

@media (max-width: 560px) {
    .animated-background .cube {
        opacity: 0.08;
        width: 110px;
        height: 110px;
    }
    .changelog-container {
        padding: 28px 16px 64px;
    }
    .changelog-header {
        text-align: center;
        padding: 24px 18px;
        border-radius: 22px;
    }
    .back-button {
        display: flex;
        justify-content: center;
        margin-bottom: 14px;
    }
    .btn-back {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    .changelog-header h1 {
        font-size: 2.1rem;
    }
    .changelog-header .subtitle {
        font-size: 0.94rem;
        line-height: 1.4;
    }
    .version-selector {
        margin-bottom: 28px;
    }
    .version-selector select {
        width: 100%;
        max-width: none;
    }
    .changelog-wrapper {
        padding-left: 0;
    }
    .changelog-wrapper::before {
        display: none;
    }
    .changelog-item {
        flex-direction: column;
        gap: 16px;
        background: rgba(255,255,255,0.9);
        border-radius: 20px;
        padding: 18px 16px;
        box-shadow: 0 20px 36px rgba(15,23,42,0.18);
    }
    .version-tag {
        width: auto;
        padding: 0 0 6px;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .version-tag::after {
        position: static;
        margin: 0;
    }
    .version-tag .version {
        font-size: 1rem;
    }
    .version-tag .date,
    .version-tag .tag {
        font-size: 0.8rem;
    }
    .changelog-content {
        padding: 18px;
        border-radius: 18px;
        box-shadow: none;
        background: transparent;
    }
    .release-title {
        align-items: flex-start;
        gap: 10px;
    }
    .release-title h2 {
        font-size: 1.35rem;
    }
    .badge {
        font-size: 0.68rem;
        padding: 5px 12px;
    }
    .change-categories {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .change-category li {
        font-size: 0.92rem;
    }
}

@media (max-width: 420px) {
    .changelog-header h1 {
        font-size: 1.9rem;
    }
    .release-title h2 {
        font-size: 1.28rem;
    }
    .changelog-item {
        padding: 16px 14px;
    }
    .changelog-content {
        padding: 16px;
    }
    .change-category li {
        padding-left: 16px;
    }
}

/* === Accessibilità === */
.changelog-item:focus-within .changelog-content,
.version-selector select:focus-visible,
.btn-back:focus-visible {
    outline: 3px solid rgba(59,130,246,0.35);
    outline-offset: 4px;
}