/**
 * Changelog Styles for Swagger UI
 */

.x-changelog {
    --x-changelog-accent: #89bf04; /* default accent */
    font-size: 13px;
    color: #41444e;
    font-style: italic;
    border-left: 4px solid var(--x-changelog-accent);
    padding: 10px 12px;
    margin: 12px 0; /* align with opblock body padding */
    display: block;
    background: rgba(137, 191, 4, 0.08);
    border-radius: 6px;
    position: relative;
    box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
}

/* Slight inward alignment inside operation blocks to match GET background */
.opblock .x-changelog-operation {
    margin-left: 5px;
    margin-right: 5px;
}

.x-changelog::before {
    content: "";
    margin-right: 4px;
}

.x-changelog-tag { /* when hidden: no spacing or background */
    display: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border-left: 0;
    box-shadow: none;
}

.x-changelog-tag.is-open {
    display: block;
    margin: 8px 8px; /* add side margin so it doesn't touch outer border */
    padding: 10px 10px; /* tighter vertical space */
    border-left: 4px solid #c9d3e1; /* neutral accent */
    background: #f4f6f9; /* neutral single-level background */
    box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
    --x-changelog-content-bg: transparent; /* disable inner background */
    border-radius: 6px;
}

/* Single-level background for tag-level changelog: remove inner panel visuals */
.x-changelog-tag .x-changelog-content {
    background: transparent !important;
    border-left: 0 !important;
    padding: 0 !important;
    margin-top: 0 !important;
}

/* Trim first and last element margins inside tag-level content */
.x-changelog-tag .x-changelog-content > :first-child { margin-top: 0 !important; }
.x-changelog-tag .x-changelog-content > :last-child { margin-bottom: 0 !important; }

/* Reduce heading and list spacing for tag-level content */
.x-changelog-tag .x-changelog-content .x-changelog-heading { margin: 4px 0 4px 0; }
.x-changelog-tag .x-changelog-content ul,
.x-changelog-tag .x-changelog-content ol { margin: 4px 0; }

.x-changelog-operation {
    /* hidden by default until toggled open */
    display: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border-left: 0;
    box-shadow: none;
}

.x-changelog-toggle {
    cursor: pointer;
    color: var(--x-changelog-accent);
    font-weight: 600;
    text-decoration: underline;
    margin-left: 0;
    transition: color 0.2s ease;
}

.x-changelog-toggle--header {
    margin-left: 8px; /* spacing from badge or title */
    padding: 2px 8px;
    border-radius: 9999px;
    border: 1px solid rgba(120,130,140,0.45); /* neutral gray */
    background: rgba(120,130,140,0.10);
    color: #4a5568; /* gray-700 */
    text-decoration: none;
    user-select: none;
    font-size: 12px;
    line-height: 1.6;
}

.x-changelog-toggle--header:hover {
    background: rgba(120,130,140,0.18);
}

.x-changelog-toggle--header[aria-expanded="true"] {
    background: rgba(120,130,140,0.24);
    border-color: #6b7280; /* gray-600 */
    color: #2d3748; /* gray-800 */
}

/* Operation header toggle */
.x-changelog-toggle--opheader {
    margin-left: 8px; /* sit next to description */
    margin-right: 0;
    padding: 2px 8px;
    border-radius: 9999px;
    border: 1px solid rgba(97,175,254,0.5);
    background: rgba(97,175,254,0.08);
    color: #2f6fda;
    font-size: 12px;
    line-height: 1.6;
    text-decoration: none;
    user-select: none;
}
.x-changelog-toggle--opheader:hover { background: rgba(97,175,254,0.14); }
.x-changelog-toggle--opheader[aria-expanded="true"] { background: rgba(97,175,254,0.22); border-color: #2f6fda; color: #1b54d2; }

/* Method-colored header toggle pill */
.x-changelog-toggle--opheader.xm-get { border-color: rgba(97,175,254,0.5); background: rgba(97,175,254,0.08); color: #0d4f8b; }
.x-changelog-toggle--opheader.xm-get:hover { background: rgba(97,175,254,0.14); }
.x-changelog-toggle--opheader.xm-get[aria-expanded="true"] { background: rgba(97,175,254,0.22); border-color: #2f6fda; color: #1b54d2; }

.x-changelog-toggle--opheader.xm-post { border-color: rgba(73,204,144,0.5); background: rgba(73,204,144,0.08); color: #186a4a; }
.x-changelog-toggle--opheader.xm-post:hover { background: rgba(73,204,144,0.14); }
.x-changelog-toggle--opheader.xm-post[aria-expanded="true"] { background: rgba(73,204,144,0.22); border-color: #2c9f74; color: #186a4a; }

.x-changelog-toggle--opheader.xm-put { border-color: rgba(252,161,48,0.5); background: rgba(252,161,48,0.08); color: #a05e12; }
.x-changelog-toggle--opheader.xm-put:hover { background: rgba(252,161,48,0.14); }
.x-changelog-toggle--opheader.xm-put[aria-expanded="true"] { background: rgba(252,161,48,0.22); border-color: #f08b16; color: #7a450d; }

.x-changelog-toggle--opheader.xm-delete { border-color: rgba(249,62,62,0.5); background: rgba(249,62,62,0.08); color: #a22222; }
.x-changelog-toggle--opheader.xm-delete:hover { background: rgba(249,62,62,0.14); }
.x-changelog-toggle--opheader.xm-delete[aria-expanded="true"] { background: rgba(249,62,62,0.22); border-color: #d83a3a; color: #7c1a1a; }

.x-changelog-toggle--opheader.xm-patch { border-color: rgba(80,227,194,0.5); background: rgba(80,227,194,0.08); color: #1b7a68; }
.x-changelog-toggle--opheader.xm-patch:hover { background: rgba(80,227,194,0.14); }
.x-changelog-toggle--opheader.xm-patch[aria-expanded="true"] { background: rgba(80,227,194,0.22); border-color: #27c8a8; color: #136154; }

.x-changelog-toggle--opheader.xm-options { border-color: rgba(13,90,167,0.5); background: rgba(13,90,167,0.08); color: #0d4f8b; }
.x-changelog-toggle--opheader.xm-options:hover { background: rgba(13,90,167,0.14); }
.x-changelog-toggle--opheader.xm-options[aria-expanded="true"] { background: rgba(13,90,167,0.22); border-color: #0d5aa7; color: #0a3f6e; }

.x-changelog-toggle:hover {
    color: var(--x-changelog-accent);
    filter: brightness(0.85);
}

.x-changelog-content {
    display: none;
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--x-changelog-content-bg, rgba(137, 191, 4, 0.12));
    border-radius: 6px;
    border-left: 3px solid var(--x-changelog-accent);
    animation: fadeIn 0.3s ease-in;
}

.x-changelog-content.show {
    display: block;
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark mode styles */
#dark-mode .x-changelog {
    color: #e7e7e7;
    background: rgba(137, 191, 4, 0.16);
    border-left-color: var(--x-changelog-accent);
}

#dark-mode .x-changelog-content {
    background: rgba(137, 191, 4, 0.22);
    border-left-color: var(--x-changelog-accent);
}

#dark-mode .x-changelog-toggle {
    color: var(--x-changelog-accent);
}

#dark-mode .x-changelog-toggle:hover {
    color: #a8d44a;
}

/* Responsive design */
@media (max-width: 768px) {
    .x-changelog {
        font-size: 12px;
        padding: 6px 10px;
        margin-left: 8px;
    }

    .x-changelog-tag { margin-left: 0; }

    .x-changelog-toggle {
        margin-left: 4px;
    }
}

.x-changelog-content p {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.x-changelog-content p:last-child {
    margin-bottom: 0;
}

/* Headings inside changelog */
.x-changelog-content .x-changelog-heading {
    margin: 8px 0 4px 0;
    font-weight: 600;
}
.x-changelog-content .x-h1 { font-size: 14px; }
.x-changelog-content .x-h2 { font-size: 13px; }
.x-changelog-content .x-h3 { font-size: 12px; }

/* List styling within changelog content */
.x-changelog-content ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style: none;
}

.x-changelog-content ul li {
    position: relative;
    margin-bottom: 6px;
    line-height: 1.4;
    padding: 0 0 0 22px;
}

.x-changelog-content ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--x-changelog-accent);
    font-weight: bold;
    font-size: 14px;
}

.x-changelog-content ul li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.x-changelog-content ul ul {
    margin: 4px 0;
    padding-left: 16px;
}

.x-changelog-content ul ul li:before {
    content: "◦";
    color: #a8d44a;
}

.x-changelog-content ul ul ul li:before {
    content: "▪";
    color: #c4e07a;
}

/* Ordered lists */
.x-changelog-content ol {
    margin: 8px 0;
    padding-left: 20px;
    counter-reset: changelog-counter;
}

.x-changelog-content ol li {
    position: relative;
    margin-bottom: 6px;
    line-height: 1.4;
    padding: 0 0 0 26px;
    counter-increment: changelog-counter;
}

.x-changelog-content ol li:before {
    content: counter(changelog-counter) ".";
    position: absolute;
    left: 0;
    color: var(--x-changelog-accent);
    font-weight: bold;
    font-size: 12px;
}

.x-changelog-content ol li:last-child {
    margin-bottom: 0;
}

/* Dark mode list styling */
#dark-mode .x-changelog-content ul li:before { color: var(--x-changelog-accent); }

#dark-mode .x-changelog-content ul ul li:before {
    color: #a8d44a;
}

#dark-mode .x-changelog-content ul ul ul li:before {
    color: #c4e07a;
}

#dark-mode .x-changelog-content ol li:before { color: var(--x-changelog-accent); }

/* Method accent themes */
.x-changelog.xm-get { --x-changelog-accent: #61affe; background: rgba(97,175,254,0.10); --x-changelog-content-bg: rgba(97,175,254,0.12); }
.x-changelog.xm-post { --x-changelog-accent: #49cc90; background: rgba(73,204,144,0.10); --x-changelog-content-bg: rgba(73,204,144,0.12); }
.x-changelog.xm-put { --x-changelog-accent: #fca130; background: rgba(252,161,48,0.10); --x-changelog-content-bg: rgba(252,161,48,0.12); }
.x-changelog.xm-delete { --x-changelog-accent: #f93e3e; background: rgba(249,62,62,0.10); --x-changelog-content-bg: rgba(249,62,62,0.12); }
.x-changelog.xm-patch { --x-changelog-accent: #50e3c2; background: rgba(80,227,194,0.10); --x-changelog-content-bg: rgba(80,227,194,0.12); }
.x-changelog.xm-options { --x-changelog-accent: #0d5aa7; background: rgba(13,90,167,0.10); --x-changelog-content-bg: rgba(13,90,167,0.12); }

#dark-mode .x-changelog.xm-get { background: rgba(97,175,254,0.18); }
#dark-mode .x-changelog.xm-post { background: rgba(73,204,144,0.18); }
#dark-mode .x-changelog.xm-put { background: rgba(252,161,48,0.18); }
#dark-mode .x-changelog.xm-delete { background: rgba(249,62,62,0.18); }
#dark-mode .x-changelog.xm-patch { background: rgba(80,227,194,0.18); }
#dark-mode .x-changelog.xm-options { background: rgba(13,90,167,0.18); }

.x-changelog-content code {
    background: rgba(0,0,0,0.06);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
}

/* Single-level background for operation-level changelog (match tag-level) */
.x-changelog-operation.is-open {
    display: block;
    margin: 5px 5px; /* add side margin so it doesn't touch outer border */
    padding: 10px 12px;
    border-left: 4px solid #c9d3e1;
    background: #f4f6f9 !important;
    box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset;
    border-radius: 6px;
}
.x-changelog-operation .x-changelog-content {
    background: transparent !important;
    border-left: 0 !important;
    padding: 0 !important;
    margin-top: 0 !important;
}
.x-changelog-operation .x-changelog-content > :first-child { margin-top: 0 !important; }
.x-changelog-operation .x-changelog-content > :last-child { margin-bottom: 0 !important; }
.x-changelog-operation .x-changelog-content .x-changelog-heading { margin: 4px 0; }
.x-changelog-operation .x-changelog-content ul,
.x-changelog-operation .x-changelog-content ol { margin: 4px 0; }

/* Method-tinted list item backgrounds only for operation level */
.x-changelog-operation .x-changelog-content ul li {
    background: transparent !important;
    border-radius: 0;
    padding: 0 0 0 22px; /* default left indent for bullets */
}
.x-changelog-operation .x-changelog-content ol li {
    background: transparent !important;
    border-radius: 0;
    padding: 0 0 0 26px; /* default left indent for numbers */
}

/* Tag badges (e.g., renamed notice) */
.x-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px; /* sit right after tag name */
    margin-right: 6px; /* spacing before expand icon */
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    background: rgba(97,175,254,0.15);
    color: #0d4f8b;
    border: 1px solid rgba(97,175,254,0.35);
}

#dark-mode .x-badge {
    background: rgba(97,175,254,0.25);
    color: #cfe6ff;
    border-color: rgba(97,175,254,0.45);
}

.x-changelog-content a {
    color: #2f6fda;
    text-decoration: underline;
}

#dark-mode .x-changelog-content code {
    background: rgba(255,255,255,0.12);
}

/* Responsive list styling */
@media (max-width: 768px) {
    .x-changelog-content ul {
        padding-left: 16px;
    }

    .x-changelog-content ul li {
        padding-left: 14px;
        margin-bottom: 4px;
    }

    .x-changelog-content ol {
        padding-left: 16px;
    }

    .x-changelog-content ol li {
        padding-left: 18px;
        margin-bottom: 4px;
    }
}
