@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* ═══════════════════════════════════════════
TOKENS — Dark Theme (default)
═══════════════════════════════════════════ */
:root {
    --teal: #0e97ad;
    --sky: #0ea5e9;
    --light: #b0cfe5;
    --navy: #2a314d;
    --deep: #0B162A;

    /* semantic */
    --bg: #020617;
    --bg-2: #1a2235;
    --bg-3: #1e2c42;
    --text: #e8eef5;
    --text-muted: #7a91ab;
    --border: rgba(176, 207, 229, 0.12);
    --glow: rgba(14, 151, 173, 0.18);
    --accent: var(--teal);
    --accent-2: var(--sky);
    --input-bg: #1e2c42;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --grid-color: rgba(14, 151, 173, 0.035);
}

/* ═══════════════════════════════════════════
TOKENS — Light Theme
═══════════════════════════════════════════ */
[data-theme="light"] {
    --bg: #eef4fa;
    --bg-2: #ffffff;
    --bg-3: #e2ecf5;
    --text: #0f1c2e;
    --text-muted: #4e6680;
    --border: rgba(14, 97, 150, 0.13);
    --border-highlight: rgba(255, 255, 255, 0.85);
    --glow: rgba(14, 151, 173, 0.13);
    --accent: #0a7d94;
    --accent-2: #0284c7;
    --input-bg: #f5f9fd;
    --shadow: 0 4px 24px rgba(14, 60, 120, 0.10);
    --shadow-sm: 0 2px 10px rgba(14, 60, 120, 0.08);
    --grid-color: rgba(14, 97, 173, 0.045);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.35s ease, color 0.35s ease;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.35s;
}

.page {
    position: relative;
    z-index: 1;
}

/* ── Light Mode overrides ── */
[data-theme="light"] header {
    background: linear-gradient(to bottom, rgba(238, 244, 250, 0.97), rgba(238, 244, 250, 0.82));
    border-bottom: 1px solid rgba(14, 151, 173, 0.18);
}

[data-theme="light"] .card {
    box-shadow: 0 2px 12px rgba(14, 60, 120, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border-color: rgba(14, 97, 150, 0.13);
}

[data-theme="light"] .card-clickable:hover {
    border-color: rgba(14, 151, 173, 0.45);
    box-shadow: 0 4px 20px rgba(14, 97, 150, 0.14), 0 0 0 1px rgba(14, 151, 173, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

[data-theme="light"] input[type=text],
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: #f5f9fd;
    border-color: rgba(14, 97, 150, 0.18);
}

[data-theme="light"] .output-area {
    background: #f0f6fc;
    border-color: rgba(14, 97, 150, 0.15);
}

[data-theme="light"] .stat span {
    color: var(--accent);
}

[data-theme="light"] .hero h1 span {
    background: linear-gradient(135deg, #0a7d94, #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .btn-primary {
    background: var(--accent-2);
}

[data-theme="light"] .alert-success {
    background: rgba(14, 151, 173, 0.07);
    border-color: rgba(14, 151, 173, 0.25);
    color: #0a7d94;
}

[data-theme="light"] .alert-info {
    background: rgba(2, 132, 199, 0.07);
    border-color: rgba(2, 132, 199, 0.25);
    color: #0284c7;
}

[data-theme="light"] .alert-warn {
    background: rgba(201, 122, 0, 0.07);
    border-color: rgba(201, 122, 0, 0.25);
    color: #c97a00;
}

[data-theme="light"] .alert-error {
    background: rgba(165, 47, 47, 0.07);
    border-color: rgba(165, 47, 47, 0.25);
    color: #a52f2f;
}

/* ── transitions for theme switch ── */
.card,
header,
input,
textarea,
select,
.dropzone,
.output-area,
.table-wrap,
.tabs,
.tab,
.alert,
label,
.stat,
.badge,
.status-badge,
footer {
    transition: background 0.3s ease, border-color 0.3s ease,
        color 0.3s ease, box-shadow 0.3s ease;
}

/* ══════════════════════════════════
HEADER
══════════════════════════════════ */
header {
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: normal;
    color: var(--text);
    display: flex;
    align-items: center;
}

/* ── Theme Toggle ── */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.theme-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 32px;
    transition: color 0.3s;
}

.toggle-track {
    width: 44px;
    height: 24px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
}

.toggle-track.active {
    background: linear-gradient(135deg, var(--teal), var(--sky));
    border-color: var(--teal);
}

.toggle-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(.34, 1.56, .64, 1), background 0.3s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
}

.toggle-track.active .toggle-thumb {
    transform: translateX(20px);
}

.badge {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(14, 151, 173, 0.15);
    border: 1px solid rgba(14, 151, 173, 0.3);
    color: var(--teal);
    text-transform: uppercase;
}

/* ══════════════════════════════════
MAIN LAYOUT
══════════════════════════════════ */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

/* ── Hero ── */
.hero {
    margin-bottom: 52px;
    text-align: center;
}

.hero-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 16px;
}

.hero h1 {
    font-family: 'Inter', sans-serif;
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.hero h1 span {
    background: linear-gradient(135deg, var(--teal), var(--sky));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
}

/* ── Section title ── */
.section-title {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Card ── */
.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.4s ease both;
}

.card-clickable {
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.card-clickable:hover {
    border-color: rgba(14, 151, 173, 0.28);
    box-shadow: 0 0 30px var(--glow), var(--shadow-sm);
    transform: translateY(-2px);
}

.card:nth-child(2) {
    animation-delay: 0.08s;
}

.card:nth-child(3) {
    animation-delay: 0.15s;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(14, 151, 173, 0.15), rgba(14, 165, 233, 0.08));
    border: 1px solid rgba(14, 151, 173, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.card h2 {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 6px;
}

.card p {
    color: var(--text-muted);
    font-size: 13.5px;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* ── Buttons ── */
.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-primary {
    background: var(--sky);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(14, 151, 173, 0.06);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 9px 14px;
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text);
}

/* ── Drop Zone ── */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    background: color-mix(in srgb, var(--teal) 3%, transparent);
    transition: all 0.25s;
}

.dropzone:hover {
    border-color: var(--teal);
    background: color-mix(in srgb, var(--teal) 7%, transparent);
}

.dropzone.dragover {
    border-color: var(--sky);
    background: color-mix(in srgb, var(--sky) 12%, transparent);
    transform: translateY(-2px);
}

.dropzone-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.dropzone h3 {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.dropzone p {
    color: var(--text-muted);
    font-size: 12.5px;
}

/* ── Form elements ── */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

input[type=text],
textarea,
select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.3s;
}

input[type=text]:focus,
textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(14, 151, 173, 0.12);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
}

/* ── Table ── */
.table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead th {
    padding: 11px 16px;
    background: var(--bg-3);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: color-mix(in srgb, var(--teal) 4%, transparent);
}

tbody td {
    padding: 11px 16px;
    color: var(--text);
    vertical-align: middle;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
}

.status-ok {
    background: rgba(14, 151, 173, 0.12);
    color: var(--teal);
    border: 1px solid rgba(14, 151, 173, 0.22);
}

.status-wait {
    background: color-mix(in srgb, var(--light) 12%, transparent);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.status-warn {
    background: rgba(201, 122, 0, 0.12);
    color: #c97a00;
    border: 1px solid rgba(201, 122, 0, 0.22);
}

.status-error {
    background: rgba(165, 47, 47, 0.12);
    color: #a52f2f;
    border: 1px solid rgba(165, 47, 47, 0.22);
}

/* ── Output area ── */
.output-area {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: 'Fira Mono', 'Courier New', monospace;
    font-size: 12.5px;
    color: var(--text);
    padding: 20px;
    min-height: 130px;
    line-height: 1.7;
    transition: background 0.3s, border-color 0.3s;
    width: 100%;
}

.output-toolbar {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 10px;
}

/* ── Stats ── */
.stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    margin-top: 20px;
}

.stat {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--text-muted);
}

.stat span {
    color: var(--sky);
    font-weight: 600;
}

/* ── Progress ── */
.progress-bar {
    height: 4px;
    background: var(--bg-3);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
    transition: background 0.3s;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--sky));
    border-radius: 4px;
    width: 65%;
    animation: fillBar 1.5s ease-out forwards;
}

@keyframes fillBar {
    from {
        width: 0;
    }
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-3);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    text-align: center;
    transition: all 0.2s;
}

.tab.active {
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

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

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
}

.alert-info {
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.2);
    color: var(--sky);
}

.alert-success {
    background: rgba(14, 151, 173, 0.08);
    border: 1px solid rgba(14, 151, 173, 0.22);
    color: var(--teal);
}

.alert-warn {
    background: rgba(201, 122, 0, 0.08);
    border: 1px solid rgba(201, 122, 0, 0.22);
    color: #c97a00;
}

.alert-error {
    background: rgba(165, 47, 47, 0.08);
    border: 1px solid rgba(165, 47, 47, 0.22);
    color: #a52f2f;
}

/* ── Divider ── */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

/* ── Grid ── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 620px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ── Footer ── */
footer {
    border-top: 1px solid var(--border);
    padding: 20px 24px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

footer a {
    color: var(--teal);
    text-decoration: none;
}

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

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
