/* ===== тема (взято из cobalt и упрощено) ===== */
:root {
    --primary: #ffffff;
    --secondary: #000000;
    --gray: #75757e;
    --blue: #2f8af9;
    --green: #30bd1b;
    --red: #ed2236;

    --bg: #ffffff;
    --card-bg: #ffffff;
    --button: #f4f4f4;
    --button-hover: #ededed;
    --button-press: #e8e8e8;
    --button-text: #282828;
    --button-stroke: rgba(0, 0, 0, 0.08);
    --sidebar-bg: #f4f4f4;
    --sidebar-stroke: rgba(0, 0, 0, 0.05);
    --dropzone-border: #cfcfd6;
    --dropzone-hover: #f5f8ff;
    --input-border: #adadb7;
    --content-border: rgba(0, 0, 0, 0.07);
    --toggle-bg: #adadb7;

    --border-radius: 11px;
    --padding: 12px;
    --sidebar-width: 84px;
}

[data-theme="dark"] {
    --primary: #000000;
    --secondary: #e1e1e1;
    --gray: #818181;
    --blue: #2a7ce1;

    --bg: #0e0e0e;
    --card-bg: #161616;
    --button: #1f1f1f;
    --button-hover: #262626;
    --button-press: #2c2c2c;
    --button-text: #e1e1e1;
    --button-stroke: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #131313;
    --sidebar-stroke: rgba(255, 255, 255, 0.05);
    --dropzone-border: #333;
    --dropzone-hover: #1a1d24;
    --input-border: #383838;
    --content-border: rgba(255, 255, 255, 0.07);
    --toggle-bg: #383838;
}

* {
    box-sizing: border-box;
    font-family: "IBM Plex Mono", monospace;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--secondary);
    min-height: 100vh;
}

::selection { color: var(--primary); background: var(--secondary); }

/* ===== каркас приложения ===== */
#app {
    display: flex;
    min-height: 100vh;
}

/* ----- боковая панель ----- */
#sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-stroke);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-logo {
    font-weight: 600;
    font-size: 13px;
    letter-spacing: -0.5px;
    padding: 8px 0 12px;
    text-decoration: none;
    color: var(--secondary);
    text-align: center;
}
.sidebar-tab {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--secondary);
    font-size: 11px;
    font-weight: 500;
    transition: background 0.15s;
}
.sidebar-tab svg { width: 22px; height: 22px; }
.sidebar-tab:hover { background: var(--button-hover); }
.sidebar-tab.active { background: var(--secondary); color: var(--primary); }
.sidebar-spacer { flex: 1; }

/* ----- основная область ----- */
#content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px 80px;
    overflow-x: hidden;
}
.page {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.page.wide { max-width: 720px; }

/* ===== котик-маскот ===== */
.cat {
    width: 132px;
    height: 132px;
    color: var(--secondary);
}
.cat.small { width: 88px; height: 88px; }

/* ===== заголовки ===== */
.title {
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin: 0;
    text-align: center;
}
.subtitle {
    font-size: 13px;
    color: var(--gray);
    text-align: center;
    margin: 0;
    line-height: 1.55;
    max-width: 400px;
}

/* ===== виджет-конвертер ===== */
.converter {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--button-stroke);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
}
.conv-selectors {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.arrow { color: var(--gray); font-size: 16px; }
.format-chip {
    background: var(--button);
    border-radius: var(--border-radius);
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    min-width: 72px;
    text-align: center;
}
.cobalt-select {
    flex: 1;
    background: var(--button);
    color: var(--button-text);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-align-last: center;
    cursor: pointer;
    appearance: none;
}
.cobalt-select:focus-visible { outline: 2px solid var(--blue); }

.conv-categories { width: 100%; }

/* поля ввода сжатия */
.comp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--gray);
}
.comp-row > span { white-space: nowrap; }
.comp-row .cobalt-select { flex: 0 0 110px; }
.cobalt-input {
    flex: 0 0 110px;
    background: var(--button);
    color: var(--button-text);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-size: 14px;
    text-align: center;
}
.qual-val { color: var(--secondary); }
.qual-range {
    flex: 1;
    accent-color: var(--blue);
    cursor: pointer;
}
.comp-categories, .comp-stage { width: 100%; }

/* карточка «в разработке» */
.indev-card {
    width: 100%;
    border: 1.5px dashed var(--dropzone-border);
    border-radius: var(--border-radius);
    padding: 36px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    color: var(--gray);
}
.indev-icon svg { width: 34px; height: 34px; color: var(--gray); opacity: 0.7; }
.indev-title { font-size: 15px; font-weight: 600; color: var(--secondary); }
.indev-sub { font-size: 12.5px; line-height: 1.5; max-width: 280px; }

/* результат сжатия */
.comp-result {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-top: 4px;
}
.comp-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--green) 14%, transparent);
    color: var(--green);
}
.comp-saved { font-size: 24px; font-weight: 600; letter-spacing: -1px; line-height: 1; }
.comp-saved-label { font-size: 11px; font-weight: 500; margin-top: 3px; }
.comp-sizes {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.sz-old { color: var(--gray); text-decoration: line-through; }
.sz-arrow { color: var(--gray); }
.sz-new { font-weight: 600; color: var(--secondary); }

.dropzone {
    border: 1.5px dashed var(--dropzone-border);
    border-radius: var(--border-radius);
    padding: 32px 16px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--blue);
    background: var(--dropzone-hover);
}
.dz-icon { font-size: 24px; color: var(--blue); margin-bottom: 6px; }
.dz-text { font-size: 14px; font-weight: 500; }
.dz-sub { font-size: 12px; color: var(--gray); margin-top: 4px; }

.conv-controls, .conv-result {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
.file-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--button);
    border-radius: var(--border-radius);
    padding: 8px 12px;
}
.file-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== кнопки ===== */
.primary-btn {
    width: 100%;
    background: var(--secondary);
    color: var(--primary);
    border: none;
    border-radius: var(--border-radius);
    padding: 12px;
    font-size: 14.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity 0.15s;
}
.primary-btn:hover { opacity: 0.85; }
.primary-btn:disabled { opacity: 0.45; cursor: default; }

.ghost-btn {
    background: var(--button);
    color: var(--button-text);
    border: 1px solid var(--button-stroke);
    border-radius: var(--border-radius);
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.ghost-btn:hover { background: var(--button-hover); }
.ghost-btn.small { padding: 4px 9px; font-size: 12px; }

.result-status { font-size: 14px; font-weight: 500; text-align: center; color: var(--green); }
.status-line { font-size: 12.5px; color: var(--gray); text-align: center; min-height: 14px; }
.status-line.error { color: var(--red); }

/* ===== популярные конвертации (сетка ссылок) ===== */
.popular { width: 100%; }
.popular-title { font-size: 13px; color: var(--gray); margin: 0 0 10px; text-align: center; }
.popular-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.popular-link {
    background: var(--button);
    border: 1px solid var(--button-stroke);
    border-radius: var(--border-radius);
    padding: 11px 12px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    color: var(--secondary);
    transition: background 0.15s;
}
.popular-link:hover { background: var(--button-hover); }

/* ===== длинный SEO-текст на лендингах ===== */
.long-text {
    width: 100%;
    line-height: 1.7;
    font-size: 14.5px;
}
.long-text h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--content-border);
}
.long-text ol, .long-text ul { padding-left: 22px; margin: 8px 0; }
.long-text li { margin: 5px 0; }
.long-text p { margin: 8px 0; color: var(--secondary); }

.faq-item {
    border-bottom: 1px solid var(--content-border);
    padding: 12px 0;
}
.faq-q { font-size: 14.5px; font-weight: 600; margin: 0 0 6px; }
.faq-a { font-size: 14px; color: var(--gray); margin: 0; line-height: 1.6; }

.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.related-links a {
    background: var(--button);
    border: 1px solid var(--button-stroke);
    border-radius: var(--border-radius);
    padding: 6px 11px;
    font-size: 12.5px;
    text-decoration: none;
    color: var(--secondary);
}
.related-links a:hover { background: var(--button-hover); }

.breadcrumb { width: 100%; font-size: 12px; color: var(--gray); }
.breadcrumb a { color: var(--gray); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ===== настройки (стиль кобальта) ===== */
.settings-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}
.settings-heading { font-size: 13px; font-weight: 600; color: var(--gray); }
.settings-desc { font-size: 12.5px; color: var(--gray); line-height: 1.5; }

.switcher {
    display: flex;
    background: var(--button);
    box-shadow: 0 0 0 1px var(--button-stroke) inset;
    border-radius: var(--border-radius);
    padding: 3.5px;
    gap: 2px;
}
.switch-btn {
    flex: 1;
    background: transparent;
    color: var(--button-text);
    border: none;
    border-radius: calc(var(--border-radius) - 3.5px);
    padding: 9px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.switch-btn:hover:not(.active) { background: var(--button-hover); }
.switch-btn.active { background: var(--secondary); color: var(--primary); }

/* ===== подвал ===== */
.footnote { font-size: 11.5px; color: var(--gray); text-align: center; margin: 0; }

.site-footer {
    width: 100%;
    max-width: 720px;
    margin-top: 40px;
    padding-top: 18px;
    border-top: 1px solid var(--content-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.footer-langs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}
.lang-link {
    font-size: 12px;
    color: var(--gray);
    text-decoration: none;
    padding: 4px 9px;
    border-radius: var(--border-radius);
    transition: background 0.15s, color 0.15s;
}
.lang-link:hover { background: var(--button-hover); }
.lang-link.active { color: var(--primary); background: var(--secondary); }
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}
.footer-links a { font-size: 12px; color: var(--gray); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-copy { font-size: 11.5px; color: var(--gray); }

.hidden { display: none !important; }

/* спиннер */
.spinner {
    display: inline-block;
    width: 13px; height: 13px;
    border: 2px solid var(--gray);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== мобильная версия: панель снизу ===== */
@media screen and (max-width: 640px) {
    #app { flex-direction: column; }
    #sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        position: fixed;
        bottom: 0;
        top: auto;
        z-index: 10;
        border-right: none;
        border-top: 1px solid var(--sidebar-stroke);
        padding: 6px 8px;
        justify-content: space-around;
        gap: 4px;
    }
    .sidebar-logo { display: none; }
    .sidebar-spacer { display: none; }
    .sidebar-tab { padding: 6px 4px; font-size: 10px; }
    #content { padding: 24px 16px 90px; }
    .popular-grid { grid-template-columns: 1fr; }
}
