/* ===== Zmienne i motyw ===== */
:root {
    --bg: #ffffff;
    --fg: #1f2328;
    --muted: #57606a;
    --surface: #f6f8fa;
    --card: #ffffff;
    --border: #d0d7de;
    --link: #0a7d3c;
    --accent: #16a34a;
    --accent-hover: #15803d;
    --accent-fg: #ffffff;
    --danger: #b00000;
}

html[data-theme="dark"] {
    --bg: #0d1117;
    --fg: #e6edf3;
    --muted: #9aa4af;
    --surface: #1c2128;
    --card: #161b22;
    --border: #30363d;
    --link: #4ade80;
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-fg: #06240f;
    --danger: #ff7b72;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme]) {
        --bg: #0d1117;
        --fg: #e6edf3;
        --muted: #9aa4af;
        --surface: #1c2128;
        --card: #161b22;
        --border: #30363d;
        --link: #4ade80;
        --accent: #22c55e;
        --accent-hover: #16a34a;
        --accent-fg: #06240f;
        --danger: #ff7b72;
    }
}

/* ===== Baza ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 760px;
    margin: 0 auto;
    padding: 1em;
    line-height: 1.5;
    color: var(--fg);
    background: var(--bg);
}

a {
    color: var(--link);
}

img,
audio,
video {
    max-width: 100%;
    height: auto;
}

h1 {
    font-size: 1.5em;
    text-align: center;
}

/* ===== Nagłówek: logo + motyw ===== */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.25em 0 0.75em;
}

.site-header .logo {
    height: 36px;
    width: auto;
    display: block;
}

.theme-toggle {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--card);
    color: var(--fg);
    cursor: pointer;
}

.theme-toggle:hover {
    background: var(--surface);
}

.theme-toggle .i-sun {
    display: none;
}

html[data-theme="dark"] .theme-toggle .i-sun {
    display: block;
}

html[data-theme="dark"] .theme-toggle .i-moon {
    display: none;
}

/* ===== Nawigacja ===== */
.lang-switcher {
    text-align: center;
    margin: 0.5rem 0;
}

.lang-switcher a,
.lang-switcher span {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    margin: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    color: var(--fg);
}

.lang-switcher .lang-current {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0 1rem;
}

.site-nav a.nav-btn {
    display: inline-block;
    padding: 0.6em 1.3em;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--fg);
    text-decoration: none;
    font-weight: bold;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.site-nav a.nav-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

.site-nav a.nav-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

.site-nav a.nav-cta {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ===== Stopka: lista artykułów ===== */
.footer-articles {
    margin: 1.5em 0 1em;
}

.footer-articles-title {
    font-size: 1em;
    margin: 0 0 0.5em;
}

.footer-articles ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4em 1.1em;
}

.footer-articles a {
    font-size: 0.92em;
}

/* ===== Formularze ===== */
label {
    display: block;
    font-weight: bold;
    margin-top: 1em;
    margin-bottom: 0.25em;
}

select,
textarea,
input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    font-size: 1em;
    padding: 0.5em;
    color: var(--fg);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}

textarea {
    resize: vertical;
}

input[type="range"] {
    width: 100%;
}

.voice-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.voice-row select {
    flex: 1;
}

/* ===== Przyciski ===== */
.buttons {
    margin-top: 1em;
    display: flex;
    gap: 0.5em;
    flex-wrap: wrap;
}

.buttons button {
    padding: 0.6em 1.2em;
    font-size: 1em;
    cursor: pointer;
    color: var(--fg);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.buttons button:hover {
    background: var(--surface);
}

.buttons button:disabled {
    cursor: default;
    opacity: 0.6;
}

.sample-btn {
    flex: 0 0 auto;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--card);
    color: var(--fg);
    cursor: pointer;
}

.sample-btn:hover {
    background: var(--surface);
}

.sample-btn.playing {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

.sample-btn .i-pause {
    display: none;
}

.sample-btn.playing .i-play {
    display: none;
}

.sample-btn.playing .i-pause {
    display: block;
}

/* ===== Pasek postępu i status ===== */
#progressBox {
    margin-top: 1em;
    display: none;
}

#progressBox.active {
    display: block;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25em;
}

#progressBar {
    width: 100%;
    height: 1.4em;
}

#statusBox {
    margin-top: 0.75em;
    min-height: 1.2em;
}

#statusBox.error {
    color: var(--danger);
    font-weight: bold;
}

/* ===== Notatka o silniku ===== */
.engine-note {
    display: none;
    margin-top: 0.25em;
    margin-bottom: 0.5em;
    padding: 0.5em 0.7em;
    background: var(--surface);
    border-left: 3px solid var(--muted);
    border-radius: 0 4px 4px 0;
    font-size: 0.85em;
    color: var(--muted);
}

/* ===== Wynik ===== */
#resultBox {
    margin-top: 1.5em;
    display: none;
}

#resultBox.active {
    display: block;
}

#audioPlayer {
    width: 100%;
}

/* ===== Sloty reklamowe ===== */
.ad-slot {
    margin: 1.5em 0;
    padding: 1em;
    border: 1px dashed var(--border);
    text-align: center;
    color: var(--muted);
    min-height: 60px;
}

/* ===== Pobrane modele ===== */
#cachedModels {
    margin-top: 1.5em;
    display: none;
}

#cachedModels.active {
    display: block;
}

#cachedBadges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
}

.cached-badge {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35em 0.6em;
    cursor: pointer;
    font-size: 0.9em;
    background: var(--card);
    color: var(--fg);
    text-align: left;
}

.cached-badge:hover {
    background: var(--surface);
}

.cached-badge small {
    display: block;
    font-size: 0.8em;
    color: var(--muted);
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
    font-size: 0.85em;
    color: var(--muted);
    margin: 0.5rem 0;
}

.breadcrumbs ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.breadcrumbs li + li::before {
    content: "›";
    margin: 0 0.35rem;
    color: var(--muted);
}

.breadcrumbs a {
    color: var(--muted);
}

/* ===== Hub artykułów ===== */
.hub-list ul {
    list-style: none;
    padding: 0;
}

.hub-list li {
    margin: 0 0 1em;
    padding-bottom: 0.75em;
    border-bottom: 1px solid var(--border);
}

.hub-item-desc {
    margin: 0.25em 0 0;
    color: var(--muted);
    font-size: 0.92em;
}

/* ===== Hub głosów ===== */
.voice-engine {
    margin-top: 1em;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6em 0.8em;
}

.voice-engine summary {
    cursor: pointer;
    font-weight: bold;
}

.voice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4em;
    margin-top: 0.8em;
}

.voice-card {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.3em 0.4em;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.voice-card[hidden],
.voice-engine[hidden] {
    display: none;
}

.voice-filter-empty {
    color: var(--muted);
    font-style: italic;
}

.voice-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.voice-name {
    font-size: 0.92em;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-meta {
    font-size: 0.8em;
    color: var(--muted);
}

.voice-filter {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1em 0;
}

.voice-filter input[type="search"] {
    flex: 1 1 12rem;
    width: auto;
}

.voice-filter select {
    flex: 0 0 auto;
    width: auto;
}

.voice-filter-count {
    align-self: center;
    font-size: 0.9em;
    color: var(--muted);
    white-space: nowrap;
}

/* ===== Artykuł ===== */
.article-page {
    max-width: 660px;
    margin: 0 auto;
}

.article-page h2 {
    font-size: 1.15em;
    margin-top: 1.6em;
}

.article-page h3 {
    font-size: 1em;
    margin-top: 1.3em;
}

.article-page p {
    margin: 0.7em 0;
    line-height: 1.6;
}

.article-page ul,
.article-page ol {
    margin: 0.7em 0;
    padding-left: 1.4em;
}

.article-page li {
    margin: 0.25em 0;
}

.article-page table,
.compare-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.9em;
}

.article-page th,
.article-page td,
.compare-table th,
.compare-table td {
    border: 1px solid var(--border);
    padding: 0.5em;
    text-align: left;
    vertical-align: top;
}

.article-page th,
.compare-table th {
    background: var(--surface);
}

.back-link {
    margin-top: 2em;
}

.subtitle {
    font-size: 1.05em;
    line-height: 1.5;
    color: var(--muted);
}

/* ===== Badge przetwarzania lokalnego ===== */
.processing-badge {
    display: flex;
    align-items: center;
    gap: 0.5em;
    width: fit-content;
    margin-top: 0.75em;
    padding: 0.35em 0.9em;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--surface);
    color: var(--link);
    font-size: 0.9em;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* ===== Sekcje SEO i powiązane ===== */
.seo-section {
    margin-top: 2.5em;
}

.seo-section h2 {
    font-size: 1.2em;
    margin-top: 1.5em;
}

.related-articles h3 {
    font-size: 1.05em;
    margin: 1.2em 0 0.3em;
}

.related-list {
    list-style: disc;
    padding-left: 1.25em;
    margin: 0.25em 0 0.75em;
}

.related-list li {
    margin: 0.25em 0;
}

/* ===== FAQ ===== */
.faq-item {
    margin: 0.5em 0;
    padding: 0.6em 0.8em;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.faq-item summary {
    cursor: pointer;
    font-weight: bold;
}

.faq-item p {
    margin: 0.5em 0 0;
    line-height: 1.5;
}

/* ===== Stopka ===== */
footer {
    margin-top: 2em;
    text-align: center;
    color: var(--muted);
}

.legal-links {
    text-align: center;
    margin-bottom: 0.75em;
}

.legal-links a {
    margin: 0 0.6rem;
}

.footer-entity {
    margin-top: 0.5em;
}

/* ===== 404 ===== */
.not-found {
    text-align: center;
}

/* ===== Baner zgody ===== */
.consent-dialog {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--fg);
}

.consent-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.consent-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    padding: 1.1em 1.2em;
    color: var(--fg);
}

.consent-dialog--main[data-mode="bar"] {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    margin: 0;
    width: 100%;
    max-width: none;
}

.consent-dialog--main[data-mode="bar"] .consent-card {
    max-width: 760px;
    margin: 0 auto;
    border-radius: 10px 10px 0 0;
    border-bottom: 0;
}

.consent-dialog--main[data-mode="modal"],
.consent-dialog--settings {
    width: calc(100% - 2em);
    max-width: 540px;
    margin: auto;
}

.consent-heading {
    margin: 0 0 0.6em;
    font-size: 1.15em;
}

.consent-body {
    font-size: 0.95em;
    line-height: 1.5;
}

.consent-body p {
    margin: 0 0 0.8em;
}

.consent-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 1em;
}

.consent-btn {
    padding: 0.55em 1.1em;
    font-size: 0.95em;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--fg);
}

.consent-btn:hover {
    background: var(--surface);
}

.consent-btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

.consent-btn--primary:hover {
    background: var(--accent-hover);
}

.consent-cats {
    list-style: none;
    margin: 1em 0 0;
    padding: 0;
}

.consent-cat {
    display: flex;
    gap: 0.8em;
    align-items: flex-start;
    padding: 0.8em 0;
    border-top: 1px solid var(--border);
}

.consent-cat-text {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
}

.consent-cat-title {
    font-weight: bold;
    font-size: 0.95em;
}

.consent-cat-desc {
    font-size: 0.88em;
    line-height: 1.45;
    color: var(--muted);
}

.consent-required {
    display: inline-block;
    margin-left: 0.5em;
    padding: 0.1em 0.5em;
    font-size: 0.72em;
    font-weight: normal;
    color: var(--accent-fg);
    background: var(--accent);
    border-radius: 999px;
}

.consent-switch {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    margin-top: 0.1em;
}

.consent-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.consent-switch-track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    transition: background 0.15s ease;
    pointer-events: none;
}

.consent-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.consent-switch input:checked + .consent-switch-track {
    background: var(--accent);
}

.consent-switch input:checked + .consent-switch-track::after {
    transform: translateX(18px);
}

.consent-switch input:disabled + .consent-switch-track {
    opacity: 0.6;
}

.consent-switch input:focus-visible + .consent-switch-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.consent-corner {
    position: fixed;
    bottom: 1em;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--fg);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.consent-corner:hover {
    background: var(--surface);
}

.consent-corner--right {
    right: 1em;
}

.consent-corner--left {
    left: 1em;
}

.consent-footer-link {
    margin: 0.5em 0 0;
}

/* ===== Responsywność ===== */
@media (max-width: 600px) {
    .article-page table,
    .compare-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.75em;
    }

    .site-header .logo {
        height: 30px;
    }

    .site-nav {
        gap: 0.5rem;
    }

    .site-nav a.nav-btn {
        flex: 1 1 auto;
        text-align: center;
    }

    .buttons button {
        flex: 1 1 auto;
    }

    .consent-buttons {
        flex-direction: column;
    }

    .consent-btn {
        width: 100%;
    }
}
