/* ============================================
   OpenAPI Changelog — Red-Amber Dark Theme
   ============================================ */

:root {
    --primary: #EF4444;
    --primary-hover: #DC2626;
    --primary-glow: rgba(239, 68, 68, 0.25);
    --accent: #F59E0B;
    --accent-glow: rgba(245, 158, 11, 0.2);
    --success: #10B981;
    --info: #3B82F6;
    --bg: #0F172A;
    --bg-card: rgba(15, 23, 42, 0.85);
    --bg-elevated: rgba(30, 41, 59, 0.9);
    --bg-hover: rgba(239, 68, 68, 0.06);
    --border: rgba(239, 68, 68, 0.12);
    --border-hover: rgba(239, 68, 68, 0.25);
    --text: #E2E8F0;
    --text-muted: #94A3B8;
    --text-dim: #475569;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass: blur(20px);
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
    --sans: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(239, 68, 68, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(245, 158, 11, 0.05), transparent);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* --- Header --- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    color: var(--primary);
    display: flex;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}

/* --- Main --- */
.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 30px var(--primary-glow), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-lg {
    padding: 0.65rem 1.5rem;
    font-size: 0.92rem;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
}

/* --- Spec Panels --- */
.spec-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.spec-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    backdrop-filter: var(--glass);
}

.spec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.spec-title {
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spec-actions {
    display: flex;
    gap: 0.35rem;
}

.version-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.version-badge.old {
    background: rgba(239, 68, 68, 0.15);
    color: var(--primary);
}

.version-badge.new {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.spec-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.78rem;
    resize: vertical;
    outline: none;
    transition: all var(--transition);
}

.spec-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.spec-input::placeholder {
    color: var(--text-dim);
}

.mono {
    font-family: var(--mono);
}

.compare-actions {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
}

/* --- Results --- */
.results-section.hidden {
    display: none;
}

.summary-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    animation: fadeIn 400ms ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.summary-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    backdrop-filter: var(--glass);
}

.summary-stat.breaking {
    border-left: 3px solid var(--primary);
}

.summary-stat.deprecation {
    border-left: 3px solid var(--accent);
}

.summary-stat.addition {
    border-left: 3px solid var(--success);
}

.summary-stat.info {
    border-left: 3px solid var(--info);
}

.stat-count {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.breaking .stat-count {
    color: var(--primary);
}

.deprecation .stat-count {
    color: var(--accent);
}

.addition .stat-count {
    color: var(--success);
}

.info .stat-count {
    color: var(--info);
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Toolbar --- */
.results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-group {
    display: flex;
    gap: 0.25rem;
}

.filter-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

.filter-btn.active {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
}

.toolbar-actions {
    display: flex;
    gap: 0.35rem;
}

/* --- Changes List --- */
.changes-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.change-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    animation: fadeIn 300ms ease-out;
    backdrop-filter: var(--glass);
}

.change-card.hidden {
    display: none;
}

.change-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.severity-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.severity-breaking {
    background: rgba(239, 68, 68, 0.15);
    color: var(--primary);
}

.severity-deprecation {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent);
}

.severity-addition {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.severity-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.method-badge {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.method-GET {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.method-POST {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}

.method-PUT {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
}

.method-PATCH {
    background: rgba(168, 85, 247, 0.15);
    color: #A855F7;
}

.method-DELETE {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

.change-path {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
}

.change-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.diff-block {
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-xs);
    padding: 0.5rem 0.75rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
}

.diff-removed {
    color: var(--primary);
}

.diff-added {
    color: var(--success);
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
    color: var(--text);
    box-shadow: var(--shadow);
    animation: toastIn 300ms ease-out;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--primary);
}

.toast.info {
    border-left: 3px solid var(--info);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .spec-panels {
        grid-template-columns: 1fr;
    }

    .summary-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .main {
        padding: 1rem;
    }

    .results-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .summary-bar {
        grid-template-columns: 1fr 1fr;
    }

    .stat-count {
        font-size: 1.4rem;
    }
}