/* ============================================================
   URL Encoder/Decoder Pro — Stylesheet
   Design: Dark industrial developer aesthetic
   ============================================================ */

/* --- CSS Variables / Theme --- */
:root {
    /* Colors */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #151d2e;
    --bg-input: #0d1321;
    --bg-hover: #1a2540;

    --text-primary: #e2e8f0;
    --text-secondary: #8896b0;
    --text-muted: #4a5568;
    --text-code: #7dd3fc;

    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.15);
    --accent-hover: #22d3ee;
    --accent-secondary: #818cf8;

    --success: #34d399;
    --error: #f87171;
    --warning: #fbbf24;

    --border: #1e293b;
    --border-active: #334155;
    --border-accent: rgba(56, 189, 248, 0.3);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --container: 860px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Ambient background texture */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 10%, rgba(56, 189, 248, 0.04), transparent),
        radial-gradient(ellipse 500px 500px at 80% 80%, rgba(129, 140, 248, 0.03), transparent);
    pointer-events: none;
    z-index: 0;
}

/* --- Utility --- */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

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

.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--bg-primary);
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    z-index: 999;
    transition: top var(--transition);
    text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* --- Header --- */
.site-header {
    border-bottom: 1px solid var(--border);
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 17px;
}
.logo-icon {
    font-family: var(--font-mono);
    font-size: 20px;
    color: var(--accent);
    letter-spacing: -1px;
}

.main-nav {
    display: flex;
    gap: 6px;
}
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.nav-link.active { color: var(--accent); }

/* --- Hero --- */
.hero {
    padding: 52px 0 28px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 12px;
}

.accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.6;
}

/* --- Tool Card --- */
.tool-section {
    padding-bottom: 40px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

/* Subtle top glow line */
.tool-card::before {
    content: '';
    position: absolute;
    top: -1px; left: 40px; right: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.4;
}

/* --- Mode Bar --- */
.mode-bar {
    margin-bottom: 24px;
}
.mode-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.mode-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mode-btn {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 500;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.mode-btn:hover {
    border-color: var(--border-active);
    color: var(--text-primary);
    background: var(--bg-hover);
}
.mode-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
    box-shadow: var(--shadow-glow);
}

/* --- I/O Areas --- */
.io-area { margin-bottom: 16px; }

.io-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.io-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.io-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.char-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icon:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
    background: var(--bg-hover);
}

.code-textarea {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.6;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    resize: vertical;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    tab-size: 4;
}
.code-textarea::placeholder { color: var(--text-muted); }
.code-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.code-textarea[readonly] {
    background: rgba(13, 19, 33, 0.6);
    color: var(--text-code);
}

/* --- Action Buttons --- */
.action-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
    letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #0ea5e9);
    color: #0a0e17;
    box-shadow: 0 2px 12px rgba(56, 189, 248, 0.25);
}
.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.35);
    filter: brightness(1.08);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-active);
}
.btn-secondary:hover {
    background: var(--border-active);
    border-color: var(--text-muted);
}

.btn-tertiary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-tertiary:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
    background: var(--bg-hover);
}

.btn-icon-text {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
    margin-top: 8px;
}
.btn-icon-text:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
}

/* --- Options Bar --- */
.options-bar {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.toggle-label input { display: none; }

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--border);
    border-radius: 999px;
    position: relative;
    transition: background var(--transition);
    flex-shrink: 0;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 14px; height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}
.toggle-label input:checked + .toggle-switch {
    background: var(--accent);
}
.toggle-label input:checked + .toggle-switch::after {
    left: 19px;
    background: var(--bg-primary);
}

/* --- Status Bar --- */
.status-bar {
    margin-top: 12px;
    padding: 0;
    font-size: 13px;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    overflow: hidden;
    max-height: 0;
}
.status-bar.visible {
    padding: 10px 14px;
    max-height: 100px;
    margin-top: 12px;
}
.status-bar.success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: var(--success);
}
.status-bar.error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--error);
}

/* --- Batch Section --- */
.batch-section {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.batch-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    background: var(--bg-secondary);
    transition: all var(--transition);
    list-style: none;
}
.batch-toggle::-webkit-details-marker { display: none; }
.batch-toggle::after {
    content: '▸';
    margin-left: auto;
    transition: transform var(--transition);
    font-size: 12px;
}
details[open] .batch-toggle::after { transform: rotate(90deg); }
.batch-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }

.batch-content {
    padding: 20px;
    background: var(--bg-card);
}
.batch-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* --- Info Section --- */
.info-section {
    padding: 60px 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition);
}
.info-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.info-card h2 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}
.info-card p {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.65;
}
.info-card code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--text-code);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- Reference Table --- */
.ref-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    overflow-x: auto;
}
.ref-table-wrap h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.ref-table th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
}
.ref-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
    color: var(--text-secondary);
}
.ref-table tr:last-child td { border-bottom: none; }
.ref-table tr:hover td { background: rgba(26, 37, 64, 0.3); }
.ref-table code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--accent);
    background: rgba(56, 189, 248, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 20px;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.footer-inner p {
    font-size: 13px;
    color: var(--text-muted);
}
.footer-nav {
    display: flex;
    gap: 20px;
}
.footer-nav a {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}
.footer-nav a:hover { color: var(--text-primary); }

/* --- Content Pages (About / Privacy) --- */
.content-page {
    padding: 48px 0 60px;
}
.content-page h1 {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}
.content-page .page-updated {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 36px;
}
.content-page h2 {
    font-size: 20px;
    font-weight: 700;
    margin-top: 36px;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.content-page h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.content-page p {
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.7;
}
.content-page ul, .content-page ol {
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-left: 24px;
    line-height: 1.7;
}
.content-page li { margin-bottom: 4px; }
.content-page a {
    color: var(--accent);
    text-decoration: none;
}
.content-page a:hover { text-decoration: underline; }
.content-page strong { color: var(--text-primary); }
.content-page code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: rgba(56, 189, 248, 0.08);
    color: var(--text-code);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .tool-card { padding: 18px; }
    .mode-btn { font-size: 11px; padding: 6px 10px; }
    .action-bar { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
    .options-bar { flex-direction: column; gap: 12px; }
    .info-grid { grid-template-columns: 1fr; }
    .header-inner { height: 52px; }
    .hero { padding: 36px 0 20px; }
    .footer-inner { flex-direction: column; text-align: center; }
}

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-card { animation: fadeInUp 0.4s ease-out; }
.info-card { animation: fadeInUp 0.5s ease-out both; }
.info-card:nth-child(2) { animation-delay: 0.05s; }
.info-card:nth-child(3) { animation-delay: 0.1s; }
.info-card:nth-child(4) { animation-delay: 0.15s; }
.info-card:nth-child(5) { animation-delay: 0.2s; }
.info-card:nth-child(6) { animation-delay: 0.25s; }

/* --- Print --- */
@media print {
    .site-header, .site-footer, .action-bar, .options-bar,
    .batch-section, .btn-icon, .skip-link { display: none; }
    body { background: #fff; color: #111; }
    .tool-card, .info-card { border: 1px solid #ccc; box-shadow: none; }
}
