/* ============================================
   JWT Debugger Visual — Styles
   Theme: Dark mode with Sunset Orange palette
   ============================================ */

:root {
    --primary: #E17055;
    --primary-rgb: 225, 112, 85;
    --secondary: #FAB1A0;
    --secondary-rgb: 250, 177, 160;
    --accent: #FFEAA7;
    --accent-rgb: 255, 234, 167;
    --background: #1A100E;
    --surface: #241816;
    --surface-hover: #2E201C;
    --border: rgba(225, 112, 85, 0.15);
    --border-hover: rgba(225, 112, 85, 0.3);
    --text-primary: #F5ECE8;
    --text-secondary: #C4A89A;
    --text-muted: #7A6258;
    --error: #E74C3C;
    --success: #2ECC71;
    --warning: #E67E22;
    --header-color: #E17055;
    --payload-color: #FFEAA7;
    --signature-color: #FAB1A0;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: 250ms ease;
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

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

body {
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.06) 0%, transparent 70%);
    pointer-events: none;
}

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

.app-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.glass-panel {
    background: rgba(36, 24, 22, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

/* Header */
.app-header {
    padding: 40px 0 32px;
    text-align: center;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon svg {
    filter: drop-shadow(0 0 8px rgba(var(--primary-rgb), 0.4));
}

.app-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Main */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.section-header h2,
.section-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--background);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.4);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-secondary:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--border-hover);
}

/* Inputs */
.token-inputs {
    display: flex;
    gap: 16px;
}

.token-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-field {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all var(--transition);
    outline: none;
    resize: vertical;
}

.input-field.mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

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

.token-textarea {
    min-height: 80px;
    line-height: 1.5;
    word-break: break-all;
}

.error-message {
    font-size: 0.78rem;
    color: var(--error);
    margin-top: 4px;
}

/* Token Visual */
.token-visual {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    flex-wrap: wrap;
}

.dot-separator {
    color: var(--text-muted);
    font-size: 1.5rem;
    font-weight: bold;
    padding-top: 24px;
}

.token-part {
    flex: 1;
    min-width: 200px;
}

.part-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 10px;
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    display: inline-block;
    margin-bottom: 0;
}

.header-part .part-label {
    background: rgba(225, 112, 85, 0.15);
    color: var(--header-color);
}

.payload-part .part-label {
    background: rgba(255, 234, 167, 0.15);
    color: var(--payload-color);
}

.signature-part .part-label {
    background: rgba(250, 177, 160, 0.15);
    color: var(--signature-color);
}

.part-content {
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0 var(--radius-xs) var(--radius-xs) var(--radius-xs);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
}

.header-part .part-content {
    border: 1px solid rgba(225, 112, 85, 0.15);
    color: var(--header-color);
}

.payload-part .part-content {
    border: 1px solid rgba(255, 234, 167, 0.15);
    color: var(--payload-color);
}

.signature-part .part-content {
    border: 1px solid rgba(250, 177, 160, 0.15);
    color: var(--signature-color);
}

/* Info Cards */
.info-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.info-card {
    text-align: center;
    padding: 16px;
}

.info-card-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-card-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.info-card-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.info-card-sub.expired {
    color: var(--error);
    font-weight: 600;
}

.info-card-sub.valid {
    color: var(--success);
}

/* Lifecycle Timeline */
.lifecycle-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.lifecycle-timeline {
    position: relative;
    height: 60px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.lifecycle-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: var(--radius-sm);
}

.lifecycle-bar.iat {
    background: rgba(var(--accent-rgb), 0.2);
    border-left: 2px solid var(--accent);
}

.lifecycle-bar.nbf {
    background: rgba(46, 204, 113, 0.1);
    border-left: 2px solid var(--success);
}

.lifecycle-bar.exp {
    background: rgba(231, 76, 60, 0.1);
    border-right: 2px solid var(--error);
}

.lifecycle-bar.now {
    width: 2px;
    background: var(--primary);
    z-index: 2;
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.6);
}

.lifecycle-label {
    position: absolute;
    bottom: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 3px;
}

.lifecycle-label.iat {
    color: var(--accent);
    left: 2%;
}

.lifecycle-label.exp {
    color: var(--error);
    right: 2%;
}

.lifecycle-label.now {
    color: var(--primary);
}

.lifecycle-top-label {
    position: absolute;
    top: 4px;
    font-size: 0.6rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Claims */
.claims-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.claim-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-xs);
    border: 1px solid transparent;
    transition: all var(--transition);
}

.claim-row:hover {
    border-color: var(--border);
}

.claim-key {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    min-width: 80px;
}

.claim-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-primary);
    flex: 1;
    word-break: break-all;
}

.claim-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 120px;
    text-align: right;
}

.claim-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.claim-badge.registered {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
}

.claim-badge.custom {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent);
}

/* Warnings */
.warnings-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.warning-item {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    animation: fadeIn 250ms ease;
}

.warning-item.danger {
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.2);
    color: var(--error);
}

.warning-item.caution {
    background: rgba(230, 126, 34, 0.08);
    border: 1px solid rgba(230, 126, 34, 0.2);
    color: var(--warning);
}

.warning-item.info {
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

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

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

/* Comparison */
.comparison-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.comparison-col h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.diff-highlight {
    background: rgba(var(--primary-rgb), 0.15);
    border-radius: 3px;
    padding: 0 4px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 300ms ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success {
    border-color: rgba(46, 204, 113, 0.3);
}

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

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

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 24px 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 0 16px;
    }

    .app-header h1 {
        font-size: 1.4rem;
    }

    .token-inputs {
        flex-direction: column;
    }

    .token-visual {
        flex-direction: column;
    }

    .dot-separator {
        display: none;
    }

    .token-part {
        min-width: 100%;
    }

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

    .glass-panel {
        padding: 16px;
    }

    .comparison-content {
        grid-template-columns: 1fr;
    }

    .claim-desc {
        display: none;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

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

    .header-actions {
        flex-wrap: wrap;
    }
}