/* JWT Debugger & Decoder Styling */

.jwt-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

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

.jwt-card {
    background-color: var(--bg-card, #151d30);
    border: 1px solid var(--border, #1e293b);
    border-radius: var(--radius-lg, 16px);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.15));
    transition: var(--transition);
}

.jwt-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border, #1e293b);
}

.jwt-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary, #f8fafc);
}

/* Badge System */
.jwt-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-idle {
    background-color: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}
.status-idle .status-dot { background-color: #94a3b8; }

.status-valid {
    background-color: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.status-valid .status-dot { background-color: #22c55e; }

.status-invalid {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.status-invalid .status-dot { background-color: #ef4444; }

.status-expired {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-expired .status-dot { background-color: #f59e0b; }

/* Toolbar Buttons */
.jwt-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.jwt-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.825rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    border-radius: 6px;
    background-color: var(--primary-light, rgba(99, 102, 241, 0.1));
    color: var(--text-primary, #f8fafc);
    border: 1px solid var(--border, #1e293b);
    cursor: pointer;
    transition: var(--transition);
}

.jwt-btn:hover {
    background-color: var(--primary, #6366f1);
    border-color: var(--primary, #6366f1);
    color: #ffffff;
}

.jwt-btn.btn-danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
    background-color: rgba(239, 68, 68, 0.05);
}
.jwt-btn.btn-danger:hover {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

.jwt-btn-sm {
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    background-color: var(--primary-light, rgba(99, 102, 241, 0.1));
    color: var(--text-secondary, #94a3b8);
    border: 1px solid var(--border, #1e293b);
    cursor: pointer;
    transition: var(--transition);
}
.jwt-btn-sm:hover {
    color: var(--text-primary, #f8fafc);
    border-color: var(--primary, #6366f1);
}

/* Input Area */
.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.jwt-textarea {
    width: 100%;
    min-height: 220px;
    height: 100%;
    background-color: var(--textarea-bg, #0e1422);
    color: var(--textarea-color, #e2e8f0);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 1rem;
    border: 1px solid var(--border, #1e293b);
    border-radius: 8px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.jwt-textarea:focus {
    border-color: var(--primary, #6366f1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* Color-Coded Token Preview */
.jwt-preview-container {
    margin-top: 1rem;
    padding: 0.85rem;
    background-color: var(--textarea-bg, #0e1422);
    border: 1px solid var(--border, #1e293b);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    word-break: break-all;
    line-height: 1.6;
}

.jwt-token-part {
    font-weight: 500;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
}

.jwt-header-part {
    color: #fb7185;
    background-color: rgba(251, 113, 133, 0.15);
}

.jwt-payload-part {
    color: #818cf8;
    background-color: rgba(129, 140, 248, 0.15);
}

.jwt-signature-part {
    color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.15);
}

.jwt-dot {
    color: var(--text-secondary, #94a3b8);
    font-weight: bold;
}

/* Decoded Output Sections */
.jwt-section {
    margin-bottom: 1.25rem;
}

.jwt-section:last-child {
    margin-bottom: 0;
}

.jwt-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.jwt-section-tag {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.tag-header {
    background-color: rgba(251, 113, 133, 0.2);
    color: #fb7185;
    border: 1px solid rgba(251, 113, 133, 0.4);
}

.tag-payload {
    background-color: rgba(129, 140, 248, 0.2);
    color: #818cf8;
    border: 1px solid rgba(129, 140, 248, 0.4);
}

.tag-signature {
    background-color: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.jwt-section-desc {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
    font-weight: 500;
    flex: 1;
}

.jwt-code-block {
    background-color: var(--textarea-bg, #0e1422);
    border: 1px solid var(--border, #1e293b);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    overflow-x: auto;
    color: var(--textarea-color, #e2e8f0);
    max-height: 250px;
}

/* Syntax Highlighting */
.json-key { color: #818cf8; font-weight: 500; }
.json-string { color: #4ade80; }
.json-number { color: #f59e0b; }
.json-boolean { color: #ec4899; }
.json-null { color: #94a3b8; font-style: italic; }

/* Claims Meta Panel */
.jwt-claims-meta {
    background-color: var(--textarea-bg, #0e1422);
    border: 1px solid var(--border, #1e293b);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.825rem;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px dashed var(--border, rgba(255, 255, 255, 0.08));
}

.meta-row:last-child {
    border-bottom: none;
}

.meta-label {
    color: var(--text-secondary, #94a3b8);
    font-weight: 500;
}

.meta-value {
    color: var(--text-primary, #f8fafc);
    font-family: 'JetBrains Mono', monospace;
}

.time-rel {
    font-size: 0.75rem;
    color: var(--text-secondary, #94a3b8);
    margin-left: 0.3rem;
}

.time-expired {
    color: #f59e0b;
}

.time-active {
    color: #22c55e;
}

/* Signature Verification Section */
.signature-verify-box {
    background-color: var(--textarea-bg, #0e1422);
    border: 1px solid var(--border, #1e293b);
    border-radius: 8px;
    padding: 1rem;
}

.secret-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.secret-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary, #94a3b8);
}

.secret-input {
    width: 100%;
    background-color: var(--bg-card, #151d30);
    color: var(--text-primary, #f8fafc);
    border: 1px solid var(--border, #1e293b);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.secret-input:focus {
    border-color: var(--primary, #6366f1);
}

.signature-result-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    font-size: 0.825rem;
    font-weight: 500;
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary, #94a3b8);
    border: 1px solid var(--border, #1e293b);
}

.sig-verified {
    background-color: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.4);
}

.sig-invalid {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
}

/* Info Section & Feature Grid */
.info-section {
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.info-section h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-primary, #f8fafc);
}

.info-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

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

.feature-card {
    background-color: var(--bg-card, #151d30);
    border: 1px solid var(--border, #1e293b);
    border-radius: var(--radius-md, 12px);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--primary, #6366f1);
    transform: translateY(-2px);
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.feature-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.5;
}

.feature-card code {
    background-color: var(--textarea-bg, rgba(255, 255, 255, 0.06));
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* FAQ Accordion Styling */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background-color: var(--bg-card, #151d30);
    border: 1px solid var(--border, #1e293b);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    transition: var(--transition);
}

.faq-question {
    padding: 1.1rem 1.25rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.faq-question::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--primary, #6366f1);
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question::after {
    content: '-';
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 1.25rem 1.1rem 1.25rem;
    display: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    line-height: 1.6;
}

.faq-item.active .faq-answer {
    display: block;
}

.faq-answer p {
    margin-bottom: 0.5rem;
}
.faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-answer ul {
    margin-left: 1.25rem;
    margin-top: 0.5rem;
}

.faq-answer li {
    margin-bottom: 0.4rem;
}

/* Explicit Light Theme Overrides */
[data-theme="light"] .jwt-card,
[data-theme="light"] .feature-card,
[data-theme="light"] .faq-item {
    background-color: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .jwt-card-title,
[data-theme="light"] .info-section h2,
[data-theme="light"] .feature-card h3,
[data-theme="light"] .faq-question {
    color: #0f172a;
}

[data-theme="light"] .jwt-btn {
    background-color: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

[data-theme="light"] .jwt-btn:hover {
    background-color: #4f46e5;
    border-color: #4f46e5;
    color: #ffffff;
}

[data-theme="light"] .jwt-btn-sm {
    background-color: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

[data-theme="light"] .jwt-btn-sm:hover {
    color: #0f172a;
    border-color: #4f46e5;
}

[data-theme="light"] .jwt-textarea,
[data-theme="light"] .jwt-code-block,
[data-theme="light"] .jwt-preview-container,
[data-theme="light"] .jwt-claims-meta,
[data-theme="light"] .signature-verify-box {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .secret-input {
    background-color: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .meta-label,
[data-theme="light"] .jwt-section-desc,
[data-theme="light"] .secret-label,
[data-theme="light"] .feature-card p,
[data-theme="light"] .faq-answer {
    color: #475569;
}

[data-theme="light"] .meta-value {
    color: #0f172a;
}

[data-theme="light"] .jwt-header-part {
    color: #e11d48;
    background-color: rgba(225, 29, 72, 0.1);
}

[data-theme="light"] .jwt-payload-part {
    color: #4f46e5;
    background-color: rgba(79, 70, 229, 0.1);
}

[data-theme="light"] .jwt-signature-part {
    color: #0284c7;
    background-color: rgba(2, 132, 199, 0.1);
}

[data-theme="light"] .json-key { color: #4f46e5; }
[data-theme="light"] .json-string { color: #16a34a; }
[data-theme="light"] .json-number { color: #d97706; }
[data-theme="light"] .json-boolean { color: #db2777; }
[data-theme="light"] .json-null { color: #64748b; }
