/* 
   JWT DECODER - EXPERT WEB TOOLS
   Theme: 2025 Glassmorphism
*/

/* --- Fonts --- */
@font-face { font-family: 'Inter'; src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Orbitron'; src: url('/fonts/orbitron-v35-latin-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Roboto Mono'; src: url('/fonts/roboto-mono-v31-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
    --bg-dark: #0a0a0f;
    --primary-accent: #3b82f6;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --card-bg: rgba(25, 25, 35, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --editor-bg: #0d0d12;
    
    /* JWT Section Colors */
    --color-header: #ef4444;   /* Red */
    --color-payload: #8b5cf6;  /* Violet */
    --color-signature: #06b6d4; /* Cyan */
    
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-code: 'Roboto Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.08) 0%, rgba(10, 10, 15, 0) 50%);
    z-index: -1;
    pointer-events: none;
}

/* --- Header --- */
.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.back-btn {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s;
}
.back-btn:hover { color: var(--primary-accent); }
.logo { font-family: var(--font-heading); font-size: 1.2rem; }
.logo span { color: var(--color-payload); }

/* --- Main Layout --- */
.main-content {
    flex-grow: 1;
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.tool-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tool-intro { text-align: center; margin-bottom: 2rem; }
.tool-intro h1 { font-family: var(--font-heading); margin-bottom: 0.5rem; font-size: 2rem; }
.tool-intro p { color: var(--text-muted); }

/* --- JWT Split Layout --- */
.jwt-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Left: Input */
.input-section { display: flex; flex-direction: column; height: 100%; }
.input-section label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#jwt-input {
    width: 100%;
    height: 400px;
    background: var(--editor-bg);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 1rem;
    border-radius: 8px;
    font-family: var(--font-code);
    font-size: 1rem;
    resize: vertical;
    outline: none;
    line-height: 1.5;
    word-break: break-all;
}
#jwt-input:focus { border-color: var(--primary-accent); }

.status-box {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#error-message {
    display: none;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Right: Output Groups */
.output-section { display: flex; flex-direction: column; gap: 1.5rem; }

.output-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
    transition: transform 0.2s;
}

.output-group:hover { transform: translateX(5px); }

/* Colored Borders for sections */
.header-group { border-left: 4px solid var(--color-header); }
.payload-group { border-left: 4px solid var(--color-payload); }
.signature-group { border-left: 4px solid var(--color-signature); }

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.group-header h3 { font-size: 1rem; font-weight: 600; font-family: var(--font-heading); }

.badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}
.badge.red { background: rgba(239, 68, 68, 0.2); color: var(--color-header); }
.badge.violet { background: rgba(139, 92, 246, 0.2); color: var(--color-payload); }
.badge.blue { background: rgba(6, 182, 212, 0.2); color: var(--color-signature); }

.output-box {
    font-family: var(--font-code);
    font-size: 0.9rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Syntax Highlighting */
.json-key { color: #60a5fa; }
.json-string { color: #fb923c; }
.json-number { color: #4ade80; }
.json-boolean { color: #c084fc; }
.json-null { color: #f472b6; }

/* Info Section */
.info-section { margin-top: 4rem; padding: 0 1rem; }
.info-section h2 { font-family: var(--font-heading); margin-bottom: 2rem; color: var(--text-main); font-size: 1.5rem; text-align: center; }
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}
.info-grid h3 { color: var(--primary-accent); margin-bottom: 0.5rem; font-family: var(--font-heading); font-size: 1rem; }
.info-grid p { color: var(--text-muted); font-size: 0.9rem; }

footer { text-align: center; padding: 3rem 0; color: var(--text-muted); font-size: 0.9rem; border-top: 1px solid var(--card-border); margin-top: 3rem; }
footer a { color: #fff; text-decoration: none; }

@media (max-width: 900px) {
    .jwt-layout { grid-template-columns: 1fr; }
    #jwt-input { height: 150px; }
}