:root {
    --primary: #0984E3;
    --secondary: #74B9FF;
    --accent: #E17055;
    --bg-color: #0D1B2A;
    --panel-bg: rgba(13, 27, 42, 0.7);
    --panel-border: rgba(116, 185, 255, 0.2);
    --text-main: #FDFBFB;
    --text-muted: #A0B2C6;
    --radius: 12px;
    --transition: all 0.25s ease;

    --color-header: #E84393;
    --color-payload: #00CEC9;
    --color-signature: #6C5CE7;

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, monospace;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(9, 132, 227, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(116, 185, 255, 0.08) 0%, transparent 40%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.line-bottom {
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 2rem;
}

.input-section label {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--secondary);
}

.token-editor {
    position: relative;
    min-height: 400px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* We use a div to show colors underneath the textarea */
.jwt-overlay,
#jwt-input {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    margin: 0;
}

.jwt-overlay {
    color: transparent;
    /* Text is transparent, just want the colors */
    pointer-events: none;
}

#jwt-input {
    background: transparent;
    color: var(--text-main);
    border: none;
    resize: none;
    width: 100%;
    height: 100%;
}

#jwt-input:focus {
    outline: none;
}

.token-part-1 {
    color: var(--color-header);
}

.token-part-2 {
    color: var(--color-payload);
}

.token-part-3 {
    color: var(--color-signature);
}

.token-dot {
    color: var(--text-main);
}

#jwt-input:focus~.jwt-overlay {
    opacity: 0.4;
}

/* Dim overlay on edit */

.btn {
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.primary-btn {
    background: var(--primary);
    color: white;
}

.primary-btn:hover {
    background: #0070c9;
    box-shadow: 0 4px 12px rgba(9, 132, 227, 0.3);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.icon-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

/* Output Section */
.output-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.token-part-card h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.text-header-part {
    color: var(--color-header);
}

.text-payload-part {
    color: var(--color-payload);
}

.text-signature-part {
    color: var(--color-signature);
}

.code-block {
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #E2E8F0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block .string {
    color: #A3BE8C;
}

.code-block .number {
    color: #D08770;
}

.code-block .boolean {
    color: #B48EAD;
}

.code-block .null {
    color: #BF616A;
}

.code-block .key {
    color: #88C0D0;
}

/* Expiration Warning */
.expiration-warning {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.expiration-warning.valid {
    background: rgba(0, 206, 201, 0.1);
    border: 1px solid rgba(0, 206, 201, 0.3);
    color: #00CEC9;
}

.expiration-warning.expired {
    background: rgba(225, 112, 85, 0.1);
    border: 1px solid rgba(225, 112, 85, 0.3);
    color: var(--accent);
}

/* Claims List Visualizer */
.claims-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.claim-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.claim-key {
    color: var(--secondary);
    font-weight: bold;
}

.claim-val {
    color: var(--text-main);
    word-break: break-all;
}

.claim-desc {
    font-family: var(--font-sans);
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2px;
}

/* Signature */
.signature-display {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    color: var(--text-muted);
}

.signature-algorithm {
    color: var(--color-signature);
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.signature-data {
    padding-left: 1rem;
    color: #E2E8F0;
}

.secret-input-wrapper {
    display: flex;
    align-items: center;
    padding-left: 1rem;
    margin-top: 0.25rem;
}

.secret-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    width: 100%;
    max-width: 250px;
    margin-left: 0.5rem;
    transition: var(--transition);
}

.secret-input:focus {
    outline: none;
    border-color: var(--primary);
}

.crypto-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
    text-align: center;
}