/* Page CSS for JSON Escape / Unescape.
   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 30px;
    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; }

.header-actions { display: flex; align-items: center; gap: 15px; }

.dark-mode-toggle {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 11px;
    color: white;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.dark-mode-toggle:hover {
    background: linear-gradient(135deg, #0052a3 0%, #0066cc 100%);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4), 0 2px 6px rgba(0, 0, 0, 0.15);
}

.dark-mode-toggle .icon { font-size: 14px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; filter: brightness(1.2); }
.dark-mode-toggle span:not(.icon) { font-size: 11px; font-weight: 500; letter-spacing: 0.2px; }

/* Buttons (tab buttons are excluded and styled separately below) */
button:not(.je-tab) {
    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:not(.je-tab):hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
button:not(.je-tab):active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

button:not(.je-tab).secondary { background: #6c757d; }
button:not(.je-tab).secondary:hover { background: #5a6268; }
button:not(.je-tab).danger { background: #dc3545; }
button:not(.je-tab).danger:hover { background: #c82333; }
button:not(.je-tab).primary { background: #2563eb; }
button:not(.je-tab).primary:hover { background: #1d4ed8; }

button:not(.je-tab).small { padding: 0px 14px; font-size: 12px; font-weight: 500; height: 30px; border-radius: 6px; }

button:focus-visible, a:focus-visible, .je-option input:focus-visible { outline: 3px solid #0066cc; outline-offset: 2px; }

body.dark-mode button:not(.je-tab) { color: white; }

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

/* Mode tabs (Escape / Unescape) — segmented toggle, same look as the Base64
   page's Encode/Decode toggle. Styled from aria-selected, not a CSS class, so
   the visual state can never drift from the accessible state. */
.je-mode-tabs {
    display: inline-flex;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}

body.dark-mode .je-mode-tabs { border-color: #404040; }

button.je-tab {
    background: #f8f9fa;
    color: #333;
    border: none;
    border-radius: 0;
    height: 38px;
    padding: 0 22px;
    font-size: 14px;
    font-weight: 600;
    transform: none;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

button.je-tab:hover { background: #eef1f4; color: #333; transform: none; box-shadow: none; }
button.je-tab:active { transform: none; box-shadow: none; }
button.je-tab[aria-selected="true"] { background: #2563eb; color: #fff; box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15); }
button.je-tab[aria-selected="true"]:hover { background: #1d4ed8; color: #fff; box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15); }

/* Inset focus ring: the rounded container clips an outside outline */
button.je-tab:focus-visible { outline: 3px solid #0066cc; outline-offset: -3px; }
button.je-tab[aria-selected="true"]:focus-visible { outline-color: #fff; }

body.dark-mode button.je-tab { background: #252525; color: #e0e0e0; }
body.dark-mode button.je-tab:hover { background: #2d2d2d; color: #e0e0e0; }
body.dark-mode button.je-tab[aria-selected="true"] { background: #2563eb; color: #fff; }
body.dark-mode button.je-tab[aria-selected="true"]:hover { background: #1d4ed8; color: #fff; }
body.dark-mode button.je-tab:focus-visible { outline-color: #6bb6ff; }
body.dark-mode button.je-tab[aria-selected="true"]:focus-visible { outline-color: #fff; }

/* Escape options */
.je-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 22px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #f8f9fa;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
}

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

.je-option { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: #333; cursor: pointer; }
body.dark-mode .je-option { color: #e0e0e0; }
.je-option input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #0066cc; }
.je-option.is-disabled { opacity: 0.6; cursor: not-allowed; }
.je-option.is-disabled input[type="checkbox"] { cursor: not-allowed; }

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

.je-panel-header h2 { margin: 0; font-size: 15px; font-weight: 600; color: #333; }
body.dark-mode .je-panel-header h2 { color: #e0e0e0; }
.je-panel-actions { display: flex; gap: 8px; }

.je-textarea {
    display: block;
    width: 100%;
    min-height: 160px;
    padding: 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13.5px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    resize: vertical;
    background: #fff;
    color: #333;
    margin-bottom: 18px;
}

.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: #404040; color: #e0e0e0; }

.je-swap-row { display: flex; justify-content: center; margin: -6px 0 14px; }

.je-swap-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8f9fa;
    color: #333;
    border: 1.5px solid #e5e7eb;
}

button:not(.je-tab).je-swap-btn { background: #f8f9fa; color: #333; }
button:not(.je-tab).je-swap-btn:hover { background: #eef1f4; }
body.dark-mode button:not(.je-tab).je-swap-btn { background: #252525; color: #e0e0e0; border-color: #404040; }
body.dark-mode button:not(.je-tab).je-swap-btn:hover { background: #2d2d2d; }

/* Status / error region (role="status", aria-live="polite").
   Stays in the accessibility tree while empty (so screen readers announce
   later changes) but takes no visual space until it has text. */
.je-status {
    margin: -6px 0 18px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1.5px solid transparent;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

.je-status:empty { margin: 0; padding: 0; border-width: 0; height: 0; overflow: hidden; }
.je-status.error { background: #f8d7da; color: #721c24; border-color: #dc3545; }
.je-status.success { background: #d4edda; color: #155724; border-color: #28a745; }
body.dark-mode .je-status.error { background: #3d1f1f; color: #ffb3b3; border-color: #dc3545; }
body.dark-mode .je-status.success { background: #1e3a24; color: #b7f0c0; border-color: #28a745; }

/* Publisher / SEO / FAQ content */
.seo-content-section { padding: 40px 30px; background: #f8f9fa; border-top: 1px solid #e5e7eb; }
body.dark-mode .seo-content-section { background: #1a1a1a; border-top-color: #404040; }
.seo-content-section h2 { font-size: 24px; font-weight: 600; color: #333; margin-bottom: 15px; }
body.dark-mode .seo-content-section h2 { color: #e0e0e0; }
.seo-intro { font-size: 15px; line-height: 1.7; color: #666; margin-bottom: 30px; }
body.dark-mode .seo-intro { color: #b0b0b0; }

.seo-features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }
.seo-feature { background: white; padding: 20px; border-radius: 8px; border: 1px solid #e5e7eb; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
body.dark-mode .seo-feature { background: #2d2d2d; border-color: #404040; }
.seo-feature h3 { color: #0066cc; font-size: 16px; font-weight: 600; margin-bottom: 10px; }
body.dark-mode .seo-feature h3 { color: #6bb6ff; }
.seo-feature p { font-size: 13px; line-height: 1.6; color: #666; margin: 0; }
body.dark-mode .seo-feature p { color: #b0b0b0; }

.seo-use-cases { background: white; padding: 25px; border-radius: 8px; border: 1px solid #e5e7eb; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
body.dark-mode .seo-use-cases { background: #2d2d2d; border-color: #404040; }
.seo-use-cases h3 { color: #0066cc; font-size: 18px; font-weight: 600; margin-bottom: 12px; }
body.dark-mode .seo-use-cases h3 { color: #6bb6ff; }

.use-cases-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.use-case-item { background: #f8f9fa; padding: 18px; border-radius: 8px; border-left: 4px solid #0066cc; transition: transform 0.2s ease, box-shadow 0.2s ease; }
body.dark-mode .use-case-item { background: #2d2d2d; border-left-color: #0066cc; }
.use-case-item:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0, 102, 204, 0.15); }
.use-case-item h4 { color: #0066cc; font-size: 15px; font-weight: 600; margin: 0 0 8px 0; }
body.dark-mode .use-case-item h4 { color: #6bb6ff; }
.use-case-item p { font-size: 13px; line-height: 1.6; color: #666; margin: 0; }
body.dark-mode .use-case-item p { color: #b0b0b0; }

.faq-section { padding: 40px 30px; border-top: 1px solid #e5e7eb; }
body.dark-mode .faq-section { border-top-color: #404040; }
.faq-section h2 { font-size: 24px; font-weight: 600; color: #333; margin-bottom: 20px; }
body.dark-mode .faq-section h2 { color: #e0e0e0; }
.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: 13px; line-height: 1.7; color: #666; margin-top: 10px; }
body.dark-mode .faq-answer p { color: #b0b0b0; }

.publisher-content { padding: 20px 30px; }
.publisher-content h2 { font-size: 22px; margin-bottom: 12px; }
.publisher-content h3 { font-size: 16px; margin: 18px 0 8px; color: #0066cc; }
body.dark-mode .publisher-content h3 { color: #6bb6ff; }
.publisher-content p { font-size: 14px; line-height: 1.7; color: #444; margin-bottom: 10px; }
body.dark-mode .publisher-content p { color: #ccc; }
.publisher-content ul { margin: 0 0 10px 22px; font-size: 14px; line-height: 1.8; color: #444; }
body.dark-mode .publisher-content ul { color: #ccc; }

/* "Built by" note — same look as the other tool pages, plus a dark variant */
.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 */
@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; }
    .header-actions { position: static; justify-content: center; margin-top: 15px; flex-wrap: wrap; gap: 10px; }
    .dark-mode-toggle { font-size: 10px; padding: 6px 12px; }

    .je-main-content { padding: 15px 10px; }

    /* Tabs: split the row evenly; labels switch to the short spans (shared
       .tab-label-full / .tab-label-short rules in style.css). */
    .je-mode-tabs { width: 100%; }
    button.je-tab { flex: 1; padding: 0 8px; }

    .je-options { flex-direction: column; align-items: stretch; gap: 0; padding: 4px 12px; }
    .je-option { min-height: 48px; }
    .je-option input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 22px; }

    .je-panel-header { flex-direction: column; align-items: stretch; gap: 8px; }
    .je-panel-actions { flex-wrap: wrap; }
    .je-panel-actions button { flex: 1 1 0; }
    .je-textarea { min-height: 140px; }

    /* Minimum 48x48px touch targets for every control on this page */
    button.je-tab,
    button:not(.je-tab).small,
    button:not(.je-tab).je-swap-btn,
    .dark-mode-toggle,
    .dark-mode-toggle-mobile,
    .header-menu-btn,
    #backToTopBtn { min-height: 48px; min-width: 48px; }

    .builder-note { padding: 16px 15px; }
    .seo-content-section, .faq-section { padding: 20px 10px; }
    .seo-content-section h2, .faq-section h2 { font-size: 20px; }
    .seo-features-grid, .use-cases-grid { grid-template-columns: 1fr; gap: 15px; }
    .faq-question { min-height: 48px; padding: 13px 0; }

    .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; }
}
