/* JWT Decoder — professional dashboard UI */
.tool-widget:has(.jwt-app) {
    padding: 0;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}

.jwt-app {
    --jwt-accent: #00aeef;
    --jwt-accent-2: #38bdf8;
    --jwt-ok: #34d399;
    --jwt-err: #f87171;
    --jwt-card: rgba(15, 23, 42, 0.82);
    --jwt-border: rgba(148, 163, 184, 0.16);
    --jwt-muted: #94a3b8;
    width: 100%;
}

.jwt-app [hidden] {
    display: none !important;
}

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

.jwt-shell {
    border: 1px solid var(--jwt-border);
    border-radius: 20px;
    background:
        radial-gradient(ellipse 70% 45% at 0% 0%, rgba(0, 174, 239, .14), transparent 50%),
        radial-gradient(ellipse 50% 35% at 100% 0%, rgba(167, 139, 250, .08), transparent 45%),
        linear-gradient(180deg, #111827 0%, #0b1220 100%);
    padding: 1.15rem 1.2rem 1.35rem;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

.jwt-trust {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .95rem;
}

.jwt-trust-item {
    padding: .35rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--jwt-border);
    background: rgba(2, 8, 20, .45);
    font-size: .72rem;
    font-weight: 700;
    color: #e2e8f0;
}

.jwt-layout {
    display: grid;
    grid-template-columns: minmax(220px, 270px) 1fr;
    gap: 1.1rem;
    align-items: start;
}

.jwt-intro {
    position: sticky;
    top: 1rem;
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid var(--jwt-border);
    background:
        radial-gradient(circle at top left, rgba(0, 174, 239, .18), transparent 55%),
        linear-gradient(165deg, #111827, #0b1220 70%);
}

.jwt-kicker {
    margin: 0 0 .45rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--jwt-accent-2);
}

.jwt-intro-title {
    margin: 0 0 .7rem;
    font-size: 1.45rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #e0f2fe, #7dd3fc 45%, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.jwt-intro-text {
    margin: 0 0 1rem;
    color: var(--jwt-muted);
    font-size: .9rem;
    line-height: 1.6;
}

.jwt-cta {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    margin-bottom: 1rem;
    min-height: 46px;
    font-weight: 800;
}

.jwt-why {
    padding: 1rem;
    border-radius: 14px;
    background: rgba(0, 174, 239, .07);
    border: 1px solid rgba(0, 174, 239, .18);
    margin-bottom: .85rem;
}

.jwt-why h3 {
    margin: 0 0 .55rem;
    font-size: .9rem;
    color: #e2e8f0;
}

.jwt-why ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--jwt-muted);
    font-size: .84rem;
    line-height: 1.55;
}

.jwt-why li + li {
    margin-top: .28rem;
}

.jwt-warn {
    margin: 0;
    font-size: .78rem;
    color: #fbbf24;
    line-height: 1.45;
}

.jwt-workspace {
    min-width: 0;
}

.jwt-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(180px, .55fr);
    gap: 1rem;
    align-items: stretch;
}

.jwt-card {
    padding: 1rem 1.1rem;
    border-radius: 16px;
    border: 1px solid var(--jwt-border);
    background: var(--jwt-card);
}

.jwt-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .7rem;
}

.jwt-card-head h3 {
    margin: 0;
    font-size: .92rem;
    font-weight: 800;
    color: #e2e8f0;
}

.jwt-link-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--jwt-accent-2);
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.jwt-link-btn:hover {
    color: #e0f2fe;
}

.jwt-textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid var(--jwt-border);
    background: rgba(2, 8, 20, .55);
    color: #e2e8f0;
    padding: .85rem 1rem;
    font-size: .86rem;
    line-height: 1.5;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    word-break: break-all;
}

.jwt-textarea:focus {
    outline: none;
    border-color: rgba(56, 189, 248, .55);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}

.jwt-decode-btn {
    width: 100%;
    margin-top: .85rem;
    min-height: 46px;
    font-weight: 800;
}

.jwt-status-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .4rem;
    padding: 1.2rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--jwt-border);
    background: rgba(15, 23, 42, .72);
}

.jwt-status-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0b1220;
    background: rgba(148, 163, 184, .45);
    margin-bottom: .25rem;
}

.jwt-status-card strong {
    font-size: 1rem;
    color: #e2e8f0;
}

.jwt-status-card p {
    margin: 0;
    font-size: .82rem;
    color: var(--jwt-muted);
    line-height: 1.4;
}

.jwt-status-card[data-state="ok"] {
    border-color: rgba(52, 211, 153, .35);
    background: rgba(6, 78, 59, .28);
}

.jwt-status-card[data-state="ok"] .jwt-status-icon {
    background: var(--jwt-ok);
}

.jwt-status-card[data-state="error"] {
    border-color: rgba(248, 113, 113, .35);
    background: rgba(127, 29, 29, .25);
}

.jwt-status-card[data-state="error"] .jwt-status-icon {
    background: var(--jwt-err);
}

.jwt-status-card[data-state="warn"] {
    border-color: rgba(251, 191, 36, .35);
    background: rgba(120, 53, 15, .28);
}

.jwt-status-card[data-state="warn"] .jwt-status-icon {
    background: #fbbf24;
}

.jwt-error {
    margin-top: .85rem;
    padding: .75rem .9rem;
    border-radius: 12px;
    border: 1px solid rgba(248, 113, 113, .35);
    background: rgba(127, 29, 29, .25);
    color: #fecaca;
    font-size: .86rem;
}

.jwt-results {
    margin-top: 1rem;
}

.jwt-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.jwt-code {
    margin: 0;
    min-height: 140px;
    max-height: 280px;
    overflow: auto;
    padding: .85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--jwt-border);
    background: rgba(2, 8, 20, .65);
    color: #e2e8f0;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .8rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.jwt-code--sig {
    min-height: 72px;
    max-height: 120px;
    word-break: break-all;
}

.jwt-meta {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.jwt-meta > div {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: .5rem;
    align-items: center;
    padding: .55rem .65rem;
    border-radius: 10px;
    background: rgba(2, 8, 20, .4);
    border: 1px solid rgba(148, 163, 184, .1);
}

.jwt-meta dt {
    margin: 0;
    font-size: .78rem;
    font-weight: 700;
    color: var(--jwt-muted);
}

.jwt-meta dd {
    margin: 0;
    font-size: .84rem;
    font-weight: 700;
    color: #e2e8f0;
    word-break: break-word;
}

.jwt-badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, .15);
    border: 1px solid rgba(56, 189, 248, .35);
    color: #7dd3fc;
    font-size: .78rem;
    font-weight: 800;
}

.jwt-badge--ok {
    background: rgba(52, 211, 153, .15);
    border-color: rgba(52, 211, 153, .4);
    color: #6ee7b7;
}

.jwt-badge--err {
    background: rgba(248, 113, 113, .15);
    border-color: rgba(248, 113, 113, .4);
    color: #fca5a5;
}

.jwt-badge--warn {
    background: rgba(251, 191, 36, .15);
    border-color: rgba(251, 191, 36, .4);
    color: #fcd34d;
}

.jwt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: 1rem;
}

.jwt-actions .btn {
    min-height: 42px;
    font-weight: 700;
}

.jwt-danger {
    border-color: rgba(248, 113, 113, .45) !important;
    color: #fca5a5 !important;
}

.jwt-danger:hover {
    background: rgba(127, 29, 29, .25) !important;
}

.jwt-features {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
    margin-top: 1.1rem;
}

.jwt-feature {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: .85rem .75rem;
    border-radius: 14px;
    border: 1px solid var(--jwt-border);
    background: rgba(15, 23, 42, .55);
}

.jwt-feature strong {
    font-size: .8rem;
    color: #e2e8f0;
}

.jwt-feature span {
    font-size: .72rem;
    color: var(--jwt-muted);
    line-height: 1.4;
}

@media (max-width: 960px) {
    .jwt-layout {
        grid-template-columns: 1fr;
    }

    .jwt-intro {
        position: static;
    }

    .jwt-input-row,
    .jwt-grid,
    .jwt-features {
        grid-template-columns: 1fr;
    }

    .jwt-meta > div {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .jwt-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        width: 100%;
    }

    .jwt-actions .btn {
        flex: none;
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }
}
