/* Page CSS for the JWT Encoder and Verifier.
   Loaded after the shared css/style.css. Intentionally does NOT redeclare
   body { font-family } — the shared stylesheet owns the system font stack. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f5f5f5;
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

body.dark-mode .container { background: #252525; border-color: #404040; }

header {
    background: #ffffff;
    color: #333;
    padding: 24px 80px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

body.dark-mode header { background: #2d2d2d; border-bottom-color: #404040; color: #e0e0e0; }

header h1 { font-size: 20px; margin-bottom: 8px; color: #333; font-weight: 600; letter-spacing: -0.3px; }
body.dark-mode header h1 { color: #e0e0e0; }
header p { font-size: 11px; color: #64748b; margin: 0; font-weight: 400; }
header p.header-description { display: block; }
body.dark-mode header p { color: #94a3b8; }

/* Buttons */
button {
    padding: 0px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    background: #2563eb;
    color: white;
    height: 34px;
}

button:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
button:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

button.secondary { background: #6c757d; }
button.secondary:hover { background: #5a6268; }
button.success { background: #218838; color: #fff; }
button.success:hover { background: #1e7e34; }
button.danger { background: #dc3545; }
button.danger:hover { background: #c82333; }
button.primary { background: #2563eb; }
button.primary:hover { background: #1d4ed8; }
button.small { padding: 0px 14px; font-size: 12px; font-weight: 500; height: 30px; border-radius: 6px; }

button:disabled, button:disabled:hover { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid #0066cc; outline-offset: 2px; }

body.dark-mode button { color: white; }

/* Main tool area */
.je-main-content { padding: 20px; }

.je-algrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.je-algrow label { font-size: 14px; font-weight: 600; }
.je-algrow select { height: 44px; min-width: 260px; padding: 0 10px; border: 1.5px solid #9ca3af; border-radius: 8px; background: #fff; color: #333; font-size: 14px; }
body.dark-mode .je-algrow select { background: #1a1a1a; border-color: #6b7280; color: #e0e0e0; }

/* Tabs: class "tab" keeps them out of the global button:not(.tab) reset */
.je-tabs { display: flex; gap: 6px; border-bottom: 1.5px solid #e5e7eb; margin-bottom: 16px; }
body.dark-mode .je-tabs { border-bottom-color: #404040; }
.je-tabs button.tab {
    background: transparent; border: none; border-bottom: 3px solid transparent; border-radius: 0;
    color: #4b5563; font-size: 15px; font-weight: 600; padding: 0 22px; height: auto; min-height: 48px; min-width: 96px; cursor: pointer;
}
.je-tabs button.tab:hover { color: #0052a3; background: transparent; transform: none; box-shadow: none; }
.je-tabs button.tab.active { color: #0052a3; border-bottom-color: #0052a3; }
body.dark-mode .je-tabs button.tab { color: #b8bfcc; }
body.dark-mode .je-tabs button.tab:hover, body.dark-mode .je-tabs button.tab.active { color: #6bb6ff; }
body.dark-mode .je-tabs button.tab.active { border-bottom-color: #6bb6ff; }

.je-secrets-note {
    margin: 0 0 16px; padding: 10px 14px; border: 1.5px solid #d4a72c; border-left-width: 5px; border-radius: 8px;
    background: #fff8e1; color: #4a3600; font-size: 13px; line-height: 1.6;
}
body.dark-mode .je-secrets-note { background: #2f2808; border-color: #b8901f; color: #ffe9a3; }

.je-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.je-col { min-width: 0; }
.je-field { margin-bottom: 14px; }
.je-field > label, .je-field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: #333; }
body.dark-mode .je-field > label, body.dark-mode .je-field-label { color: #e0e0e0; }
.je-help { margin: 6px 0 0; font-size: 12.5px; line-height: 1.55; color: #475569; overflow-wrap: anywhere; }
body.dark-mode .je-help { color: #b8bfcc; }

.je-textarea {
    display: block; width: 100%; height: 150px; padding: 12px; border: 1.5px solid #9ca3af; border-radius: 10px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 13px; line-height: 1.5;
    overflow-wrap: anywhere; resize: vertical; background: #fff; color: #333;
}
.je-textarea.je-tall { height: 190px; }
.je-textarea::placeholder { color: #6b7280; opacity: 1; }
.je-textarea:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 3px rgba(0,102,204,0.12); }
body.dark-mode .je-textarea { background: #1a1a1a; border-color: #6b7280; color: #e0e0e0; }
body.dark-mode .je-textarea::placeholder { color: #9ca3af; }

.je-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: #333; cursor: pointer; min-height: 44px; }
.je-check[hidden] { display: none; }
.je-field > label.je-check { display: flex; margin-bottom: 0; font-weight: 500; }
.je-field > label.je-check[hidden] { display: none; }
body.dark-mode .je-check { color: #e0e0e0; }
.je-check input { width: 18px; height: 18px; cursor: pointer; accent-color: #0066cc; flex-shrink: 0; }

.je-helpers { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 14px; }
.je-helpers input[type="number"] { width: 84px; height: 44px; padding: 0 8px; border: 1.5px solid #9ca3af; border-radius: 8px; background: #fff; color: #333; font-size: 14px; }
.je-helpers select { height: 44px; padding: 0 8px; border: 1.5px solid #9ca3af; border-radius: 8px; background: #fff; color: #333; font-size: 14px; }
body.dark-mode .je-helpers input, body.dark-mode .je-helpers select { background: #1a1a1a; border-color: #6b7280; color: #e0e0e0; }
.je-helpers .je-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.je-helpers label { font-size: 13px; font-weight: 600; }

.je-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.je-actions button { height: 44px; padding: 0 20px; font-weight: 600; }

.je-line { min-height: 22px; margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: #475569; overflow-wrap: anywhere; }
body.dark-mode .je-line { color: #b8bfcc; }

/* Token output: three coloured, labelled parts */
.je-token { padding: 12px 14px; border: 1.5px solid #cbd5e1; border-radius: 10px; background: #f8fafc; margin-bottom: 8px; }
.je-token[hidden] { display: none; }
body.dark-mode .je-token { background: #1a1a1a; border-color: #404040; }
.je-token-text { display: block; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; word-break: break-all; }
.je-p-h { color: #b42318; }
.je-p-p { color: #6d28d9; }
.je-p-s { color: #0b5cad; }
.je-dot { color: #475569; }
body.dark-mode .je-p-h { color: #ff9a9a; }
body.dark-mode .je-p-p { color: #c9adff; }
body.dark-mode .je-p-s { color: #7ec3ff; }
body.dark-mode .je-dot { color: #b8bfcc; }
.je-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12.5px; font-weight: 600; }
.je-legend .je-p-h::before, .je-legend .je-p-p::before, .je-legend .je-p-s::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: currentColor; margin-right: 6px; }

/* Messages (warnings, notices, errors): reserved height so the page does not jump */
.je-messages { list-style: none; min-height: 24px; margin: 4px 0 8px; }
.je-msg { font-size: 12.5px; line-height: 1.5; padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; overflow-wrap: anywhere; }
.je-msg-warning { background: #fff3cd; color: #664d03; }
.je-msg-notice { background: #e8f1fb; color: #1e3a5f; }
.je-msg-error { background: #fde8e8; color: #7a1d1d; }
body.dark-mode .je-msg-warning { background: #3a2f0b; color: #ffe08a; }
body.dark-mode .je-msg-notice { background: #1f2a3d; color: #cfe3ff; }
body.dark-mode .je-msg-error { background: #3b1717; color: #ffc9c9; }

/* Verification result */
.je-result { min-height: 52px; padding: 12px 14px; border-radius: 10px; border: 1.5px solid transparent; font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; margin-bottom: 10px; }
.je-result:empty { border-color: #cbd5e1; background: #f8fafc; }
.je-result:empty::before { content: 'The result appears here.'; color: #475569; }
body.dark-mode .je-result:empty { border-color: #404040; background: #1a1a1a; }
body.dark-mode .je-result:empty::before { color: #b8bfcc; }
.je-result strong { display: block; font-size: 15px; margin-bottom: 2px; }
.je-result-valid { background: #e6f4ea; border-color: #2e7d32; color: #0f3d1a; }
.je-result-invalid { background: #fde8e8; border-color: #c62828; color: #6b1010; }
.je-result-unsigned { background: #fff3cd; border-color: #b8860b; color: #5c4300; }
.je-result-mismatch { background: #fff3cd; border-color: #b8860b; color: #5c4300; }
.je-result-error { background: #e8eef5; border-color: #5b6b82; color: #1f2d44; }
body.dark-mode .je-result-valid { background: #14301b; border-color: #4caf50; color: #c9f0d0; }
body.dark-mode .je-result-invalid { background: #3b1717; border-color: #ef5350; color: #ffd0d0; }
body.dark-mode .je-result-unsigned { background: #3a2f0b; border-color: #d4a72c; color: #ffe9a3; }
body.dark-mode .je-result-mismatch { background: #3a2f0b; border-color: #d4a72c; color: #ffe9a3; }
body.dark-mode .je-result-error { background: #1f2a3d; border-color: #6b7f9c; color: #d6e4f7; }

.je-result button.je-switch { display: block; margin-top: 10px; height: 44px; padding: 0 18px; font-weight: 600; }
.je-decoded[hidden] { display: none; }
.je-decoded h3 { font-size: 14px; margin: 10px 0 6px; font-weight: 600; }
pre.je-pre { margin: 0 0 10px; padding: 10px 12px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 8px; overflow-x: auto; max-height: 260px; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 12.5px; line-height: 1.5; color: #1f2937; }
body.dark-mode pre.je-pre { background: #1a1a1a; border-color: #404040; color: #e0e0e0; }

.je-claims-box { margin-top: 10px; overflow-x: auto; }
table.je-claims { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.je-claims caption { text-align: left; font-size: 12.5px; color: #475569; padding: 0 0 6px; }
body.dark-mode table.je-claims caption { color: #b8bfcc; }
table.je-claims th, table.je-claims td { text-align: left; padding: 6px 8px; border: 1px solid #e5e7eb; vertical-align: top; }
body.dark-mode table.je-claims th, body.dark-mode table.je-claims td { border-color: #404040; }
table.je-claims thead th { background: #f1f5f9; }
body.dark-mode table.je-claims thead th { background: #2d2d2d; }
.je-claim-ok { color: #0f5132; font-weight: 600; }
.je-claim-bad { color: #8a1c1c; font-weight: 600; }
.je-claim-warn { color: #6b4e00; font-weight: 600; }
.je-claim-info { color: #1f2937; }
body.dark-mode .je-claim-ok { color: #8fe0a8; }
body.dark-mode .je-claim-bad { color: #ffa3a3; }
body.dark-mode .je-claim-warn { color: #ffd77a; }
body.dark-mode .je-claim-info { color: #e0e0e0; }

.je-panel[hidden] { display: none; }
.je-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

table.je-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 16px; }
table.je-table caption { text-align: left; font-size: 12.5px; color: #475569; padding-bottom: 6px; }
table.je-table th, table.je-table td { text-align: left; padding: 8px 10px; border: 1px solid #e5e7eb; vertical-align: top; line-height: 1.5; overflow-wrap: anywhere; }
table.je-table thead th { background: #f1f5f9; }
body.dark-mode table.je-table caption { color: #b8bfcc; }
body.dark-mode table.je-table th, body.dark-mode table.je-table td { border-color: #404040; }
body.dark-mode table.je-table thead th { background: #2d2d2d; }
.je-content table.je-table { display: block; overflow-x: auto; max-width: 100%; }

/* Long-form content */
.je-content { padding: 28px 30px 8px; border-top: 1px solid #e5e7eb; }
body.dark-mode .je-content { border-top-color: #404040; }
.je-content h2 { font-size: 22px; font-weight: 600; margin: 30px 0 12px; color: #1f2937; }
.je-content h2:first-child { margin-top: 0; }
.je-content h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; color: #0052a3; }
body.dark-mode .je-content h2 { color: #e5e9f0; }
body.dark-mode .je-content h3 { color: #6bb6ff; }
.je-content p { font-size: 14.5px; line-height: 1.75; color: #3b4351; margin-bottom: 12px; max-width: 90ch; }
body.dark-mode .je-content p { color: #ccc; }
.je-content ul { margin: 0 0 14px 22px; font-size: 14.5px; line-height: 1.8; color: #3b4351; max-width: 90ch; }
body.dark-mode .je-content ul { color: #ccc; }
.je-content a { color: #1d4ed8; }
body.dark-mode .je-content a { color: #6bb6ff; }
/* style.css strips underlines from every link with !important; body-text links need one back */
.je-content p a, .je-content li a { text-decoration: underline !important; }
.je-answer { font-size: 15px; font-weight: 500; }

pre.je-code {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    line-height: 1.55;
    color: #1f2937;
    max-width: 100%;
}
body.dark-mode pre.je-code { background: #1a1a1a; border-color: #404040; color: #e0e0e0; }
.je-code-label { font-size: 12px; font-weight: 600; color: #475569; margin: 0 0 4px !important; }
body.dark-mode .je-code-label { color: #b8bfcc; }

.faq-section { padding: 28px 30px 40px; }
.faq-section h2 { font-size: 22px; font-weight: 600; color: #1f2937; margin-bottom: 16px; }
body.dark-mode .faq-section h2 { color: #e5e9f0; }
.faq-item { border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 10px; padding: 14px 18px; background: #fff; }
body.dark-mode .faq-item { border-color: #404040; background: #2d2d2d; }
.faq-question { cursor: pointer; font-weight: 600; font-size: 14px; color: #333; }
body.dark-mode .faq-question { color: #e0e0e0; }
.faq-answer p { font-size: 13.5px; line-height: 1.7; color: #4b5563; margin-top: 10px; }
body.dark-mode .faq-answer p { color: #b8bfcc; }

/* "Built by" note */
.builder-note { text-align: center; padding: 16px 24px; background: #f0f4ff; border-top: 1px solid #dde4f0; font-size: 0.95rem; color: #444; }
.builder-note p { line-height: 1.6; }
body.dark-mode .builder-note { background: #1e2433; border-top-color: #2d3748; color: #b8bfcc; }
body.dark-mode .builder-note a { color: #6bb6ff; }

/* Footer */
footer { margin-top: 30px; border-top: 1px solid #e5e7eb; color: #666; font-size: 12px; }
.footer-content { max-width: 1400px; margin: 0 auto; padding: 30px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; text-align: left; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.footer-brand-name { font-weight: 700; color: #333; font-size: 15px; }
body.dark-mode .footer-brand-name { color: #e0e0e0; }
.footer-section p { margin: 0 0 10px 0; line-height: 1.6; color: #666; }
.footer-section ul { list-style: none; padding: 0; margin: 0; }
.footer-section ul li { padding: 4px 0; color: #666; line-height: 1.5; }
.footer-section ul li a { color: #0066cc; text-decoration: none; }
.footer-section ul li a:hover { text-decoration: underline; }
.footer-bottom { text-align: center; padding: 20px; border-top: 1px solid #e5e7eb; background: #f9fafb; }
.footer-bottom p { margin: 0 0 15px 0; }
.footer-links { display: flex !important; align-items: center; justify-content: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.footer-links a { color: #6b7c94 !important; text-decoration: none; white-space: nowrap; }
.footer-links a:hover { color: #a5b4fc !important; text-decoration: underline; }
.footer-separator { color: #999; margin: 0 4px; }

body.dark-mode footer { border-top-color: #404040; background: #1a1a1a; }
body.dark-mode .footer-content { background: #1a1a1a; }
body.dark-mode .footer-section p,
body.dark-mode .footer-section ul li { color: #b0b0b0; }
body.dark-mode .footer-section ul li a { color: #6bb6ff; }
body.dark-mode .footer-bottom { background: #252525; border-top-color: #404040; }
body.dark-mode .footer-links a { color: #6a7990 !important; }
body.dark-mode .footer-links a:hover { color: #a5b4fc !important; }
body.dark-mode .footer-separator { color: #666; }

/* Responsive: stacked layout on mobile, same 768px breakpoint as the sibling pages */
@media (max-width: 768px) {
    body { padding: 5px; }
    .container { border-radius: 0; margin: 0; max-width: 100%; }
    header { padding: 15px 15px; text-align: left; }
    header h1 { font-size: 16px; line-height: 1.3; margin-bottom: 6px; text-align: center; }
    header p { font-size: 10px; line-height: 1.4; text-align: center; }


    /* Minimum 48x48px touch targets */

    .je-content { padding: 20px 12px 4px; }
    .je-content h2 { font-size: 20px; }
    .faq-section { padding: 20px 12px 28px; }
    .builder-note { padding: 16px 15px; }

    .footer-content { grid-template-columns: 1fr; gap: 20px; padding: 20px 15px; }
    .footer-section { text-align: center; }
    .footer-section ul { text-align: left; display: inline-block; }
}

@media (max-width: 768px) {
    .je-main-content { padding: 15px 10px; }
    .je-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .je-textarea { height: 170px; }
    .je-algrow select { width: 100%; min-width: 0; height: 48px; font-size: 16px; }
    .je-helpers input[type="number"], .je-helpers select { height: 48px; font-size: 16px; }
    .je-tabs button.tab { flex: 1 1 0; min-width: 0; }
    /* Minimum 48x48px touch targets */
    button, button.small { min-height: 48px; min-width: 48px; }
    .je-check { min-height: 48px; }
    .je-check input { width: 22px; height: 22px; }
    .je-actions button { flex: 1 1 auto; }
    .faq-question { min-height: 48px; padding: 13px 0; }
    table.je-claims { font-size: 12px; }
}
