/* ==========================================================================
   API Rate Limit Tester — Styles
   Theme: Dark, Indigo/Cyan, glassmorphism
   ========================================================================== */
:root {
    --c-primary: #6366F1;
    --c-primary-glow: rgba(99, 102, 241, .2);
    --c-accent: #22D3EE;
    --c-accent-glow: rgba(34, 211, 238, .15);
    --c-secondary: #94A3B8;
    --c-bg: #0F172A;
    --c-bg-card: rgba(30, 41, 59, .6);
    --c-bg-input: rgba(15, 23, 42, .8);
    --c-surface: rgba(51, 65, 85, .4);
    --c-border: rgba(148, 163, 184, .12);
    --c-text: #F1F5F9;
    --c-text-sec: #94A3B8;
    --c-text-muted: #64748B;
    --c-success: #10B981;
    --c-warning: #F59E0B;
    --c-danger: #EF4444;
    --c-limited: #8B5CF6;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 9999px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;
    --transition: 250ms ease
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased
}

body {
    font-family: var(--font);
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: .3
}

.bg-glow--1 {
    width: 500px;
    height: 500px;
    background: var(--c-primary-glow);
    top: -120px;
    right: -60px;
    animation: f 14s ease-in-out infinite
}

.bg-glow--2 {
    width: 400px;
    height: 400px;
    background: var(--c-accent-glow);
    bottom: -80px;
    left: -60px;
    animation: f 18s ease-in-out infinite reverse
}

@keyframes f {

    0%,
    100% {
        transform: translate(0, 0)
    }

    50% {
        transform: translate(25px, -20px)
    }
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1
}

.hidden {
    display: none !important
}

.header {
    padding: 28px 0 12px;
    text-align: center
}

.header__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px
}

.header__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    color: #fff
}

.header__title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.header__tagline {
    color: var(--c-text-sec);
    font-size: .88rem
}

.card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px)
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px
}

.card__title {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 14px
}

.card__actions {
    display: flex;
    gap: 8px;
    margin-top: 14px
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.form-group--full {
    grid-column: 1/-1
}

.form-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--c-text-sec)
}

.form-input {
    padding: 8px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg-input);
    color: var(--c-text);
    font-family: var(--font);
    font-size: .82rem;
    outline: none;
    transition: border-color var(--transition)
}

.form-input:focus {
    border-color: var(--c-primary)
}

.form-input--textarea {
    resize: vertical;
    min-height: 40px;
    font-family: var(--font-mono);
    font-size: .78rem
}

select.form-input {
    cursor: pointer
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    outline: none
}

.btn:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px
}

.btn--primary {
    background: var(--c-primary);
    color: #fff
}

.btn--primary:hover {
    background: #5558E6
}

.btn--danger {
    background: rgba(239, 68, 68, .12);
    color: var(--c-danger);
    border: 1px solid rgba(239, 68, 68, .2)
}

.btn--danger:hover {
    background: rgba(239, 68, 68, .2)
}

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

.btn--ghost:hover {
    background: var(--c-surface);
    color: var(--c-text)
}

.btn--sm {
    padding: 6px 14px;
    font-size: .75rem
}

.btn:disabled {
    opacity: .4;
    cursor: not-allowed
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px
}

.progress-track {
    flex: 1;
    height: 6px;
    background: #1E293B;
    border-radius: 3px;
    overflow: hidden
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
    border-radius: 3px;
    transition: width .3s ease;
    width: 0
}

.progress-label {
    font-size: .78rem;
    color: var(--c-text-muted);
    min-width: 60px;
    text-align: right
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px
}

.stat-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    backdrop-filter: blur(16px)
}

.stat-card__label {
    display: block;
    font-size: .7rem;
    color: var(--c-text-muted);
    margin-bottom: 4px;
    font-weight: 500
}

.stat-card__value {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--c-text)
}

.stat-card--success .stat-card__value {
    color: var(--c-success)
}

.stat-card--limited .stat-card__value {
    color: var(--c-limited)
}

.stat-card--error .stat-card__value {
    color: var(--c-danger)
}

.chart-area {
    width: 100%;
    overflow-x: auto
}

canvas {
    width: 100%;
    max-width: 100%
}

.timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 4px
}

.timeline__dot {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    transition: transform .2s ease;
    cursor: default;
    position: relative
}

.timeline__dot:hover {
    transform: scale(1.4);
    z-index: 2
}

.timeline__dot--2xx {
    background: var(--c-success)
}

.timeline__dot--429 {
    background: var(--c-limited)
}

.timeline__dot--4xx {
    background: var(--c-warning)
}

.timeline__dot--5xx {
    background: var(--c-danger)
}

.timeline__dot--err {
    background: #475569
}

.timeline__dot[title] {
    cursor: help
}

.headers-table {
    font-family: var(--font-mono);
    font-size: .78rem
}

.headers-table__row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(148, 163, 184, .06)
}

.headers-table__key {
    color: var(--c-accent);
    font-weight: 600
}

.headers-table__val {
    color: var(--c-text-sec)
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 10px 20px;
    background: var(--c-primary);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: .82rem;
    font-weight: 500;
    z-index: 1000;
    animation: ti .3s ease, to .3s ease 1.7s forwards
}

@keyframes ti {
    from {
        opacity: 0;
        transform: translateY(10px)
    }

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

@keyframes to {
    from {
        opacity: 1
    }

    to {
        opacity: 0;
        transform: translateY(10px)
    }
}

.footer {
    text-align: center;
    padding: 24px 0;
    border-top: 1px solid var(--c-border);
    color: var(--c-text-muted);
    font-size: .8rem;
    margin-top: 24px
}

@media(max-width:768px) {
    .form-grid {
        grid-template-columns: 1fr
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr)
    }
}