/* ==========================================================================
   ConvertHub — Universal Tool Design System v2.0
   Modern, fast, accessible — 2026 Edition
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
    /* Brand palette */
    --ch-primary: #6366f1;
    --ch-primary-light: #818cf8;
    --ch-primary-dark: #4f46e5;
    --ch-primary-50: rgba(99, 102, 241, .06);
    --ch-primary-100: rgba(99, 102, 241, .12);
    --ch-primary-200: rgba(99, 102, 241, .22);
    --ch-accent: #06b6d4;
    --ch-accent-light: #22d3ee;

    /* Semantic */
    --ch-success: #10b981;
    --ch-success-light: #d1fae5;
    --ch-danger: #ef4444;
    --ch-danger-light: #fee2e2;
    --ch-warning: #f59e0b;
    --ch-warning-light: #fef3c7;
    --ch-info: #3b82f6;
    --ch-info-light: #dbeafe;

    /* Neutral */
    --ch-white: #ffffff;
    --ch-gray-50: #f9fafb;
    --ch-gray-100: #f3f4f6;
    --ch-gray-200: #e5e7eb;
    --ch-gray-300: #d1d5db;
    --ch-gray-400: #9ca3af;
    --ch-gray-500: #6b7280;
    --ch-gray-600: #4b5563;
    --ch-gray-700: #374151;
    --ch-gray-800: #1f2937;
    --ch-gray-900: #111827;

    /* Surfaces */
    --ch-surface: var(--ch-white);
    --ch-surface-raised: var(--ch-white);
    --ch-bg: var(--ch-gray-50);
    --ch-text: var(--ch-gray-800);
    --ch-text-secondary: var(--ch-gray-500);
    --ch-border: var(--ch-gray-200);

    /* Elevation */
    --ch-shadow-xs: 0 1px 2px rgba(0,0,0,.04);
    --ch-shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --ch-shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --ch-shadow-md: 0 6px 16px -4px rgba(0,0,0,.08), 0 2px 6px -2px rgba(0,0,0,.04);
    --ch-shadow-lg: 0 12px 28px -6px rgba(0,0,0,.1), 0 4px 8px -2px rgba(0,0,0,.05);
    --ch-shadow-xl: 0 20px 40px -8px rgba(0,0,0,.12);
    --ch-shadow-glow: 0 0 20px rgba(99,102,241,.18);

    /* Radius */
    --ch-radius-sm: 8px;
    --ch-radius: 12px;
    --ch-radius-lg: 16px;
    --ch-radius-xl: 24px;
    --ch-radius-full: 9999px;

    /* Timing */
    --ch-ease: cubic-bezier(.4,0,.2,1);
    --ch-ease-spring: cubic-bezier(.34,1.56,.64,1);
    --ch-duration-fast: 150ms;
    --ch-duration: 250ms;
    --ch-duration-slow: 400ms;

    /* Typography */
    --ch-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --ch-font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
    --ch-surface: #1a1b2e;
    --ch-surface-raised: #222339;
    --ch-bg: #12131f;
    --ch-text: #e5e7eb;
    --ch-text-secondary: #9ca3af;
    --ch-border: rgba(255,255,255,.08);
    --ch-shadow-xs: 0 1px 2px rgba(0,0,0,.2);
    --ch-shadow-sm: 0 1px 3px rgba(0,0,0,.3);
    --ch-shadow: 0 4px 6px rgba(0,0,0,.25);
    --ch-shadow-md: 0 6px 16px rgba(0,0,0,.3);
    --ch-shadow-lg: 0 12px 28px rgba(0,0,0,.35);
    --ch-shadow-xl: 0 20px 40px rgba(0,0,0,.4);
    --ch-shadow-glow: 0 0 24px rgba(99,102,241,.25);
    --ch-gray-50: #1e1f33;
    --ch-gray-100: #262840;
    --ch-gray-200: #333555;
    --ch-gray-300: #444670;
    --ch-primary-50: rgba(99,102,241,.1);
    --ch-primary-100: rgba(99,102,241,.18);
}

/* ---------- Font Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

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

body {
    font-family: var(--ch-font);
    background: var(--ch-bg);
    color: var(--ch-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Subtle mesh gradient background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99,102,241,.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(6,182,212,.05) 0%, transparent 60%),
        var(--ch-bg);
    pointer-events: none;
}

[data-theme="dark"] body::before {
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99,102,241,.1) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(6,182,212,.08) 0%, transparent 60%),
        var(--ch-bg);
}

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

@keyframes ch-slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ch-scaleIn {
    from { opacity: 0; transform: scale(.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes ch-spin {
    to { transform: rotate(360deg); }
}

@keyframes ch-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

@keyframes ch-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes ch-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes ch-toast-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

@keyframes ch-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes ch-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-4px) rotate(1deg); }
    75% { transform: translateY(2px) rotate(-1deg); }
}

@keyframes ch-checkmark {
    0% { stroke-dashoffset: 24; }
    100% { stroke-dashoffset: 0; }
}

/* ---------- Universal Header ---------- */
.universal-header {
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    border-bottom: 1px solid var(--ch-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow var(--ch-duration) var(--ch-ease);
}

.universal-header.scrolled {
    box-shadow: var(--ch-shadow-md);
}

[data-theme="dark"] .universal-header {
    background: rgba(26,27,46,.85);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: .875rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: var(--ch-text);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -.02em;
    transition: color var(--ch-duration) var(--ch-ease);
}

.logo:hover { color: var(--ch-primary); }

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--ch-primary), var(--ch-accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    font-size: .95rem;
    box-shadow: 0 2px 8px rgba(99,102,241,.28);
    transition: transform var(--ch-duration) var(--ch-ease-spring);
}

.logo:hover .logo-icon { transform: rotate(-8deg) scale(1.08); }

/* Nav */
.header-nav {
    display: flex;
    gap: .75rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--ch-text-secondary);
    font-weight: 500;
    font-size: .9rem;
    padding: .5rem .875rem;
    border-radius: var(--ch-radius-sm);
    transition: all var(--ch-duration) var(--ch-ease);
}

.nav-link:hover {
    color: var(--ch-primary);
    background: var(--ch-primary-50);
}

/* Theme toggle button */
.theme-toggle {
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--ch-border);
    border-radius: var(--ch-radius-sm);
    background: var(--ch-surface);
    color: var(--ch-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--ch-duration) var(--ch-ease);
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--ch-primary);
    border-color: var(--ch-primary-light);
    background: var(--ch-primary-50);
}

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    animation: ch-fadeIn .5s var(--ch-ease) both;
}

/* ---------- Tool Header ---------- */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
    animation: ch-slideUp .5s var(--ch-ease) .1s both;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .85rem;
    background: var(--ch-primary-50);
    color: var(--ch-primary);
    border-radius: var(--ch-radius-full);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
    margin-bottom: .75rem;
    border: 1px solid var(--ch-primary-100);
}

.tool-header h1 {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--ch-text);
    margin-bottom: .5rem;
    background: linear-gradient(135deg, var(--ch-text) 30%, var(--ch-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-header p {
    font-size: 1rem;
    color: var(--ch-text-secondary);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.5;
}

/* ---------- Content Boxes ---------- */
.content-box {
    background: var(--ch-surface-raised);
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius-lg);
    padding: 0;
    box-shadow: var(--ch-shadow-sm);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: box-shadow var(--ch-duration) var(--ch-ease),
                border-color var(--ch-duration) var(--ch-ease);
    animation: ch-scaleIn .4s var(--ch-ease) both;
}

.content-box:nth-child(2) { animation-delay: .12s; }
.content-box:nth-child(3) { animation-delay: .2s; }
.content-box:nth-child(4) { animation-delay: .28s; }

.content-box:hover {
    box-shadow: var(--ch-shadow-md);
    border-color: rgba(99,102,241,.12);
}

.content-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .875rem 1.25rem;
    background: var(--ch-gray-50);
    border-bottom: 1px solid var(--ch-border);
}

.content-box-title {
    font-size: .75rem;
    font-weight: 700;
    color: var(--ch-text-secondary);
    text-transform: uppercase;
    letter-spacing: .08em;
}

.content-box-body {
    padding: 1.25rem;
}

/* ---------- I/O Section ---------- */
.io-section {
    display: grid;
    gap: 1rem;
}

/* ---------- Form Inputs ---------- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.input-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--ch-text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
}

textarea,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="date"],
select {
    width: 100%;
    padding: .75rem 1rem;
    border: 1.5px solid var(--ch-border);
    border-radius: var(--ch-radius-sm);
    font-size: .95rem;
    font-family: var(--ch-font);
    background: var(--ch-surface);
    color: var(--ch-text);
    transition: border-color var(--ch-duration) var(--ch-ease),
                box-shadow var(--ch-duration) var(--ch-ease);
    appearance: none;
    -webkit-appearance: none;
}

textarea {
    min-height: 140px;
    resize: vertical;
    font-family: var(--ch-font-mono);
    font-size: .875rem;
    line-height: 1.65;
}

textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: var(--ch-primary-light);
    box-shadow: 0 0 0 3px var(--ch-primary-100);
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 10px;
    padding-right: 2.5rem;
}

input[type="date"] {
    padding: .875rem 1rem;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: 4px;
    padding: 4px;
    background: var(--ch-primary);
    color: white;
    opacity: .85;
    transition: opacity var(--ch-duration-fast);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* ---------- File Upload Zone ---------- */
.file-upload-zone,
#uploadZone {
    border: 2px dashed var(--ch-gray-300);
    border-radius: var(--ch-radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    background: var(--ch-gray-50);
    transition: all var(--ch-duration) var(--ch-ease);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.file-upload-zone::before,
#uploadZone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--ch-primary-50), rgba(6,182,212,.04));
    opacity: 0;
    transition: opacity var(--ch-duration) var(--ch-ease);
    pointer-events: none;
}

.file-upload-zone:hover,
#uploadZone:hover {
    border-color: var(--ch-primary-light);
    background: var(--ch-surface);
}

.file-upload-zone:hover::before,
#uploadZone:hover::before {
    opacity: 1;
}

.file-upload-zone.dragover,
#uploadZone.dragover {
    border-color: var(--ch-primary);
    background: var(--ch-surface);
    box-shadow: var(--ch-shadow-glow);
    transform: scale(1.01);
}

.file-upload-zone.dragover::before,
#uploadZone.dragover::before {
    opacity: 1;
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--ch-primary-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ch-primary);
    font-size: 1.75rem;
    transition: transform var(--ch-duration) var(--ch-ease-spring);
}

.file-upload-zone:hover .upload-icon,
#uploadZone:hover .upload-icon {
    transform: translateY(-4px) scale(1.05);
}

.upload-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ch-text);
    margin-bottom: .35rem;
}

.upload-hint {
    font-size: .85rem;
    color: var(--ch-text-secondary);
}

/* ---------- Image Preview ---------- */
.image-preview {
    max-width: 100%;
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    margin: 1rem 0;
}

.preview-container {
    text-align: center;
    padding: 1.25rem;
    background: var(--ch-gray-50);
    border-radius: var(--ch-radius);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.5rem;
    border: none;
    border-radius: var(--ch-radius-sm);
    font-size: .95rem;
    font-weight: 600;
    font-family: var(--ch-font);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--ch-duration) var(--ch-ease);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,.3), transparent 60%);
    opacity: 0;
    transition: opacity .4s;
    pointer-events: none;
}

.btn:active::after { opacity: 1; }

.btn-primary {
    background: linear-gradient(135deg, var(--ch-primary), var(--ch-primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99,102,241,.35);
    background: linear-gradient(135deg, var(--ch-primary-light), var(--ch-primary));
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(99,102,241,.25);
}

.btn-success {
    background: linear-gradient(135deg, var(--ch-success), #059669);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16,185,129,.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16,185,129,.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--ch-danger), #dc2626);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239,68,68,.35);
}

.btn-secondary {
    background: var(--ch-surface);
    color: var(--ch-text);
    border: 1.5px solid var(--ch-border);
}

.btn-secondary:hover {
    background: var(--ch-gray-50);
    border-color: var(--ch-primary-light);
    color: var(--ch-primary);
    transform: translateY(-1px);
    box-shadow: var(--ch-shadow-sm);
}

.btn-ghost {
    background: transparent;
    color: var(--ch-primary);
    padding: .5rem 1rem;
}

.btn-ghost:hover {
    background: var(--ch-primary-50);
}

.btn[disabled],
.btn.btn-disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    padding: .5rem 1rem;
    font-size: .85rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.05rem;
    border-radius: var(--ch-radius);
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1rem 0;
}

/* ---------- Settings Grid ---------- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

/* ---------- Stats Bar ---------- */
.stats-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--ch-gray-50);
    border-radius: var(--ch-radius);
    margin-top: 1rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .15rem;
}

.stat-label {
    font-size: .7rem;
    font-weight: 600;
    color: var(--ch-text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--ch-text);
    letter-spacing: -.02em;
}

/* ---------- Toast Notifications ---------- */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    min-width: 300px;
    max-width: 420px;
    padding: 1rem 1.25rem;
    border-radius: var(--ch-radius);
    color: #fff;
    font-weight: 500;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    z-index: 9999;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: none;
    box-shadow: var(--ch-shadow-lg);
    backdrop-filter: blur(12px);
}

.toast.show {
    animation: ch-toast-in .4s var(--ch-ease-spring) forwards;
}

.toast.hide {
    animation: ch-toast-out .35s var(--ch-ease) forwards;
}

.toast.success {
    background: linear-gradient(135deg, rgba(16,185,129,.95), rgba(5,150,105,.95));
}

.toast.error {
    background: linear-gradient(135deg, rgba(239,68,68,.95), rgba(220,38,38,.95));
}

.toast.info {
    background: linear-gradient(135deg, rgba(59,130,246,.95), rgba(37,99,235,.95));
}

/* ---------- Progress Bar ---------- */
.ch-progress {
    width: 100%;
    height: 6px;
    background: var(--ch-gray-200);
    border-radius: var(--ch-radius-full);
    overflow: hidden;
    margin: .75rem 0;
}

.ch-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--ch-primary), var(--ch-accent));
    border-radius: var(--ch-radius-full);
    transition: width .3s var(--ch-ease);
}

.ch-progress-bar.indeterminate {
    width: 30%;
    animation: ch-progress-indeterminate 1.4s ease-in-out infinite;
}

@keyframes ch-progress-indeterminate {
    0%   { margin-left: -30%; }
    100% { margin-left: 100%; }
}

/* ---------- Spinner ---------- */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ch-gray-200);
    border-top-color: var(--ch-primary);
    border-radius: 50%;
    animation: ch-spin .7s linear infinite;
    margin: 2rem auto;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
    margin: 0;
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--ch-gray-200) 25%, var(--ch-gray-100) 50%, var(--ch-gray-200) 75%);
    background-size: 200% 100%;
    animation: ch-shimmer 1.5s ease infinite;
    border-radius: var(--ch-radius-sm);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    font-size: .72rem;
    font-weight: 700;
    border-radius: var(--ch-radius-full);
    letter-spacing: .03em;
    text-transform: uppercase;
}

.badge-primary {
    background: var(--ch-primary-100);
    color: var(--ch-primary);
}

.badge-success {
    background: var(--ch-success-light);
    color: var(--ch-success);
}

.badge-danger {
    background: var(--ch-danger-light);
    color: var(--ch-danger);
}

/* ---------- Alert / Info Box ---------- */
.ch-alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--ch-radius);
    font-size: .9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.ch-alert-info {
    background: var(--ch-info-light);
    color: #1e40af;
    border-left: 4px solid var(--ch-info);
}

.ch-alert-success {
    background: var(--ch-success-light);
    color: #065f46;
    border-left: 4px solid var(--ch-success);
}

.ch-alert-warning {
    background: var(--ch-warning-light);
    color: #92400e;
    border-left: 4px solid var(--ch-warning);
}

.ch-alert-danger {
    background: var(--ch-danger-light);
    color: #991b1b;
    border-left: 4px solid var(--ch-danger);
}

/* ---------- Tabs ---------- */
.ch-tabs {
    display: flex;
    gap: 2px;
    background: var(--ch-gray-100);
    border-radius: var(--ch-radius-sm);
    padding: 3px;
    margin-bottom: 1rem;
}

.ch-tab {
    flex: 1;
    padding: .6rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ch-text-secondary);
    cursor: pointer;
    transition: all var(--ch-duration) var(--ch-ease);
    font-family: var(--ch-font);
}

.ch-tab:hover { color: var(--ch-text); }

.ch-tab.active {
    background: var(--ch-surface);
    color: var(--ch-primary);
    box-shadow: var(--ch-shadow-xs);
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--ch-gray-800);
    color: #fff;
    font-size: .75rem;
    font-weight: 500;
    padding: .4rem .7rem;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all var(--ch-duration-fast) var(--ch-ease);
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--ch-text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: .5;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ch-text);
    margin-bottom: .35rem;
}

.empty-state-desc {
    font-size: .9rem;
    max-width: 360px;
    margin: 0 auto;
}

/* ---------- Footer ---------- */
.universal-footer {
    margin-top: auto;
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: .8rem;
    color: var(--ch-text-secondary);
    border-top: 1px solid var(--ch-border);
    background: var(--ch-surface);
}

.universal-footer a {
    color: var(--ch-primary);
    text-decoration: none;
    font-weight: 500;
}

.universal-footer a:hover { text-decoration: underline; }

/* ---------- Utility Classes ---------- */
.text-center { text-align: center; }
.text-mono { font-family: var(--ch-font-mono); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: .5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .header-content {
        padding: .875rem 1rem;
    }
    
    .header-nav {
        gap: .5rem;
    }
    
    .nav-link {
        font-size: .82rem;
        padding: .4rem .6rem;
    }
    
    .main-content {
        padding: 1.25rem 1rem 3rem;
    }
    
    .tool-header h1 {
        font-size: 1.5rem;
    }
    
    .tool-header p {
        font-size: .9rem;
    }
    
    .content-box {
        border-radius: var(--ch-radius);
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    .stats-bar {
        flex-direction: column;
    }
    
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .tool-header h1 {
        font-size: 1.3rem;
    }
    
    .file-upload-zone,
    #uploadZone {
        padding: 2rem 1rem;
    }
    
    .btn {
        font-size: .88rem;
        padding: .65rem 1.25rem;
    }
}

/* ---------- Print ---------- */
@media print {
    .universal-header,
    .toast,
    .btn-group { display: none !important; }
    
    body { background: #fff; }
    
    .content-box {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}

/* ---------- Focus Visible (Accessibility) ---------- */
:focus-visible {
    outline: 2px solid var(--ch-primary);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--ch-gray-300);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ch-gray-400); }
