/* ===== CSS Variables ===== */
:root {
    --bg-color: #ffffff;
    --text-main: #0B242A;
    --text-secondary: #333333;
    --btn-color: #8fb2b3;
    --card-bg: #eaecef;
    --footer-bg: #06262d;
    --font-family: "Inter", system-ui, sans-serif;

    /* Layout (px) */
    --nav-w: 958px;
    --nav-h: 50px;
    --header-pad-top: 23px;
    --hero-offset: 189px;
    --h1-box-w: 982px;
    --h1-box-h: 180px;
    --subtitle-w: 426px;
    --subtitle-h: 54px;
    --subtitle-gap: 40px;
    --btn-w: 427px;
    --btn-h: 72px;
    --btn-gap: 168px;
    --features-offset: 191px;
    --card-h: 607px;
    --question-mark-size: 60px;

    /* Tabs and toggles */
    --toggle-w: 439px;
    --toggle-h: 55px;
    --toggle-top: 163px;
    --toggle-active: #8fb2b3;
    --toggle-inactive: #d9d9d9;

    /* Form fields */
    --field-w: 377px;
    --field-h: 36px;
    --field-radius: 30px;
    --field-bg: #d9d9d9;
    --form-gap-x: 165px;
    --form-offset-top: 113px;

    /* Dropdowns and selects */
    --dropdown-item: #00434f;
    --dropdown-hover-fg: #d8f9ff;
    --dropdown-hover-bg: rgba(0, 67, 79, 0.56);
    --method-select-w: 163px;
    --method-select-h: 25px;
    --method-field-bg: #d9d9d9;
    --method-field-radius: 30px;

    /* Other colors */
    --accent-color: #94b4b4;
    --section-bg: #dce7e7;
    --border-color: #ccc;
}

html {
    scroll-behavior: smooth;
}

[data-theme="dark"] {
    --bg-color: #0f171a;
    --text-main: #e8f1f2;
    --text-secondary: #b8c8cc;
    --btn-color: #5f8788;
    --card-bg: #1a252a;
    --footer-bg: #081216;
    --toggle-active: #5f8788;
    --toggle-inactive: #2a363c;
    --field-bg: #2a363c;
    --method-field-bg: #2a363c;
    --section-bg: #1a252a;
    --border-color: #3a4a50;
    --dropdown-item: #73b99a;
    --dropdown-hover-fg: #ecfff3;
    --dropdown-hover-bg: rgba(115, 185, 154, 0.28);
}

/* ===== Reset Styles ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-weight: 400;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Layout Basics ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--header-pad-top) 20px 0;
    width: 100%;
}

.header {
    display: flex;
    justify-content: center;
    padding: 0;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(var(--nav-w), 100%);
    height: var(--nav-h);
    flex-wrap: nowrap;
    gap: 12px;
}

.nav a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
}

.nav a:hover {
    opacity: 0.7;
}

/* Кнопка «Настройки»: не наследует .nav a; отдельно + выше специфичность, чем reset'ы `button` с бэка */
.header .nav .nav-dropdown__trigger {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
}

.header .nav .nav-dropdown__trigger:hover {
    opacity: 0.7;
}

.nav .nav-link {
    text-decoration: none;
    color: var(--text-main);
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
}

.nav .nav-link:hover {
    opacity: 0.7;
}

.nav-dropdown {
    position: relative;
    flex-shrink: 0;
}

.nav-dropdown__menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    box-sizing: border-box;
}

.nav-dropdown__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.nav-dropdown__group:last-child {
    margin-bottom: 0;
}

.nav-dropdown__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.nav-dropdown__toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nav-dropdown__pill {
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.nav-dropdown__pill:hover {
    filter: brightness(0.97);
}

.nav-dropdown__pill.is-active {
    background: rgba(143, 178, 179, 0.55);
    border-color: var(--toggle-active);
    font-weight: 600;
}

.nav-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
}

.nav-logo img {
    width: 32px;
    height: auto;
    display: block;
}

@media (max-width: 1100px) {
    .nav {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--nav-h);
        justify-content: center;
        row-gap: 8px;
    }
}

@media (max-width: 850px) {
    .nav {
        gap: 20px;
    }

    .nav > a:not(.nav-logo) {
        display: none;
    }
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 40px;
    box-sizing: border-box;
}

/* ===== Hero Section (Home Page) ===== */
.hero {
    text-align: center;
    margin-top: var(--hero-offset);
    margin-bottom: 0;
    width: 100%;
    max-width: var(--h1-box-w);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    width: 100%;
    max-width: var(--h1-box-w);
    min-height: var(--h1-box-h);
    margin: 0;
    padding: 0;
    font-size: 74px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-main);
    text-align: center;
}

.hero-title-nowrap {
    white-space: nowrap;
}

.hero p {
    width: 100%;
    max-width: var(--subtitle-w);
    min-height: var(--subtitle-h);
    margin: var(--subtitle-gap) 0 0;
    padding: 0;
    font-size: 22px;
    font-weight: 400;
    line-height: 1.25;
    color: var(--text-secondary);
    text-align: center;
}

/* ===== Features Section ===== */
.features {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: var(--btn-gap);
    margin-top: var(--features-offset);
    margin-bottom: 100px;
    width: 100%;
    max-width: calc(var(--btn-w) * 2 + var(--btn-gap));
}

.feature-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: var(--btn-w);
    max-width: 100%;
}

.feature-btn {
    background-color: var(--btn-color);
    color: var(--text-main);
    border: none;
    width: min(var(--btn-w), 100%);
    height: var(--btn-h);
    padding: 0 16px;
    border-radius: 30px;
    font-family: var(--font-family);
    font-size: 28px;
    font-weight: 500;
    line-height: 1;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.feature-btn:hover {
    filter: brightness(0.96);
}

.feature-btn:active {
    transform: scale(0.98);
}

.feature-btn:focus-visible {
    outline: 3px solid var(--text-main);
    outline-offset: 3px;
}

.feature-card {
    background-color: var(--card-bg);
    border-radius: 24px;
    padding: 20px;
    width: 100%;
    max-width: var(--btn-w);
    height: var(--card-h);
    display: flex;
    flex-direction: column;
    position: relative;
}

.card-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.gif-placeholder {
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 400;
    color: #555555;
    line-height: 1.4;
}

.bottom-hint {
    font-family: var(--font-family);
    text-align: center;
    font-size: 14px;
    font-weight: 400;
    color: #666666;
    margin-bottom: 20px;
    line-height: 1.4;
}

.tooltip-container {
    position: absolute;
    top: 20px;
    right: 20px;
}

.question-mark {
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    width: var(--question-mark-size);
    height: var(--question-mark-size);
    background-color: #d9d9d9;
    border-radius: 50%;
    font-size: 34px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: var(--text-main);
    transition: background-color 0.3s;
}

.question-mark:hover {
    background-color: #c0c4c8;
}

.tooltip-text {
    font-family: var(--font-family);
    visibility: hidden;
    width: 220px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 12px;
    position: absolute;
    z-index: 1;
    top: 100%;
    right: 0;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

@media (max-width: 850px) {
    .hero h1 {
        font-size: clamp(36px, 9vw, 74px);
        min-height: auto;
    }

    .hero p {
        font-size: clamp(16px, 4vw, 22px);
        min-height: auto;
    }

    .features {
        flex-direction: column;
        align-items: center;
        gap: 40px;
        margin-top: 80px;
    }

    .feature-column {
        width: 100%;
        max-width: var(--btn-w);
    }
}

/* ===== Page Sections (Multi-page Navigation) ===== */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* ===== Tabs/Toggle ===== */
.tabs {
    display: flex;
    width: min(var(--toggle-w), 100%);
    height: var(--toggle-h);
    margin: var(--toggle-top) auto 0;
    padding: 0;
    border-radius: 30px;
    overflow: hidden;
    background-color: var(--toggle-inactive);
}

.tab {
    flex: 1 1 50%;
    min-width: 0;
    height: 100%;
    margin: 0;
    padding: 0 8px;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
    color: var(--text-main);
    background-color: var(--toggle-inactive);
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.tab.active {
    background-color: var(--toggle-active);
    color: var(--text-main);
}

.tab:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
    z-index: 1;
    position: relative;
}

/* ===== Generate Page: Form Fields ===== */
.form-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-start;
    gap: var(--form-gap-x);
    width: 100%;
    max-width: 100%;
    margin-top: var(--form-offset-top);
    margin-bottom: 0;
    min-width: 0;
}

.field-wrap {
    width: var(--field-w);
    max-width: 100%;
    flex: 0 0 auto;
}

@media (max-width: 940px) {
    .form-row {
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: visible;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .field-wrap {
        flex: 0 0 var(--field-w);
        max-width: none;
    }
}

.field-input {
    width: 100%;
    height: var(--field-h);
    padding: 0 14px;
    border: none;
    border-radius: var(--field-radius);
    background-color: var(--field-bg);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    color: var(--text-main);
    outline: none;
}

.field-input::placeholder {
    color: #666;
}

.field-input:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.field-input--error {
    outline: 2px solid #850000;
    outline-offset: 2px;
}

.field-input--error:focus-visible {
    outline: 2px solid #850000;
    outline-offset: 2px;
}

/* ===== Custom Select ===== */
.custom-select {
    position: relative;
    width: 100%;
}

.custom-select__bar {
    display: flex;
    align-items: center;
    height: var(--field-h);
    padding-left: 14px;
    padding-right: 4px;
    border-radius: var(--field-radius);
    background-color: var(--field-bg);
    cursor: pointer;
    outline: none;
}

.custom-select:not(.custom-select--error).is-open .custom-select__bar {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.custom-select__bar:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.custom-select--error .custom-select__bar {
    outline: 2px solid #850000;
    outline-offset: 2px;
}

.custom-select--error .custom-select__bar:focus-visible {
    outline: 2px solid #850000;
    outline-offset: 2px;
}

.custom-select--error.is-open .custom-select__bar {
    outline: 2px solid #850000;
    outline-offset: 2px;
}

.custom-select__value {
    flex: 1;
    min-width: 0;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select.has-value .custom-select__value {
    color: var(--text-main);
}

.custom-select__toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 100%;
    padding: 0;
    pointer-events: none;
}

.custom-select__bird {
    display: block;
    transition: transform 0.25s ease;
}

.custom-select.is-open .custom-select__bird {
    transform: rotate(180deg);
}

.custom-select__list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 30;
    overflow: hidden;
}

.custom-select__list li {
    margin: 0;
    padding: 0;
}

.custom-select__option {
    width: 100%;
    margin: 0;
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    color: var(--dropdown-item);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.custom-select__option:hover {
    background-color: var(--dropdown-hover-bg);
    color: var(--dropdown-hover-fg);
}

.custom-select__option:focus-visible {
    outline: 2px solid var(--dropdown-item);
    outline-offset: -2px;
}

/* ===== Checkboxes ===== */
.checkboxes {
    margin-top: 50px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    width: min(961px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--dropdown-item);
}

.checkbox-item label {
    font-family: var(--font-family);
    font-size: 20px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
}

/* ===== Buttons ===== */
.submit-btn {
    width: min(961px, 100%);
    max-width: 100%;
    height: 58px;
    background-color: #8fb2b3;
    border: none;
    border-radius: 30px;
    padding: 0 20px;
    margin: 50px auto 0;
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
}

.submit-btn:hover:not(:disabled) {
    filter: brightness(0.96);
}

.submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

.submit-btn__loader {
    display: none;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(11, 36, 42, 0.25);
    border-top-color: var(--text-main);
    border-radius: 50%;
    animation: submit-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.submit-btn--loading .submit-btn__label {
    opacity: 0.9;
}

.submit-btn--loading .submit-btn__loader {
    display: block;
}

@keyframes submit-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Preview Section for Generate ===== */
.preview-section--generate {
    width: min(961px, 100%);
    max-width: 100%;
    margin: 40px auto 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-sizing: border-box;
}

.preview-table-wrap[hidden] {
    display: none !important;
}

.preview-table-wrap:not([hidden]) {
    display: block;
}

.preview-panel--generate {
    width: 100%;
    margin: 0 auto;
}

.preview-panel__table-clip--generate {
    overflow-x: auto;
}

.generate-download-wrap {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 26px;
}

.generate-download-wrap--anonym {
    width: min(964px, 100%);
    margin: 26px auto 0;
}

.download-btn--generate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 185px;
    height: 42px;
    max-width: none;
    margin-top: 0;
    padding: 0 12px;
    box-sizing: border-box;
    border: none;
    border-radius: 30px;
    background-color: rgba(52, 128, 85, 0.44);
    color: var(--text-main);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.download-btn--generate[hidden] {
    display: none;
}

.download-btn--generate:hover {
    filter: brightness(1.05);
}

.download-btn--generate:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.preview-table-scroll {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #ccc;
    background: #fff;
}

.preview-table--in-panel {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: var(--font-family);
    border: none;
    border-spacing: 0;
    table-layout: fixed;
}

.preview-table--in-panel thead th:first-child {
    border-top-left-radius: 12px;
}

.preview-table--in-panel thead th:last-child {
    border-top-right-radius: 12px;
}

.preview-table--in-panel tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.preview-table--in-panel tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

.preview-table--in-panel thead tr,
.preview-table--in-panel tbody tr {
    height: auto;
    min-height: 25px;
}

.preview-table--in-panel th,
.preview-table--in-panel td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    border-right: 1px solid #000000;
}

.preview-table--in-panel th:last-child,
.preview-table--in-panel td:last-child {
    border-right: none;
}

.preview-table--in-panel th {
    background: var(--toggle-active);
    font-weight: 600;
    color: var(--text-main);
    font-size: 16px;
    text-align: center;
}

.preview-table--in-panel tbody td {
    font-size: 14px;
    text-align: left;
}

.preview-table--in-panel tbody tr:last-child td {
    border-bottom: none;
}

.preview-panel__title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.download-btn {
    margin-top: 20px;
    width: 100%;
    max-width: 320px;
    height: 48px;
    border: none;
    border-radius: 30px;
    background-color: var(--dropdown-item);
    color: #fff;
    font-family: var(--font-family);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.download-btn[hidden] {
    display: none;
}

.download-btn:hover {
    filter: brightness(1.08);
}

.download-btn:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.btn-upload {
    flex-shrink: 0;
    width: 185px;
    height: 42px;
    padding: 0 8px;
    border-radius: 30px;
    border: none;
    box-sizing: border-box;
    background-color: rgba(52, 128, 85, 0.44);
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    color: var(--text-main);
    cursor: pointer;
    transition: filter 0.15s ease;
    margin-right: 223px;
}

.btn-upload:hover {
    filter: brightness(0.97);
}

.btn-upload:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px 10px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 0;
}

.btn-reset__icon {
    display: block;
    width: 22px;
    height: 22px;
}

.btn-main-action {
    width: min(961px, 100%);
    max-width: 100%;
    height: 58px;
    background-color: #8fb2b3;
    border: none;
    border-radius: 30px;
    padding: 0 20px;
    margin: 20px auto;
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
}

.btn-main-action:hover:not(:disabled) {
    filter: brightness(0.96);
}

.btn-main-action:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-main-action__loader {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(11, 36, 42, 0.25);
    border-top-color: var(--text-main);
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}

.btn-main-action--loading .btn-main-action__loader {
    display: inline-block;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.btn-download-final {
    display: none;
    width: min(961px, 100%);
    max-width: 100%;
    height: 58px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 0 20px;
    margin: 20px auto;
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    text-align: center;
}

.btn-download-final:hover {
    background-color: #218838;
}

.btn-download-final.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Generate Preview Section ===== */
.preview-section {
    width: min(961px, 100%);
    max-width: 100%;
    margin-top: 40px;
    padding: 24px;
    border-radius: 24px;
    box-sizing: border-box;
}

.preview-status {
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 1.45;
    color: var(--text-main);
}

.preview-status.preview-status--error {
    color: #850000;
    font-weight: 500;
}

.preview-heading {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.preview-table-wrap {
    display: none;
}

.preview-table-wrap[hidden=false] {
    display: block;
}

.preview-table-scroll {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #ccc;
    background: #fff;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: var(--font-family);
    border: none;
    border-spacing: 0;
    table-layout: fixed;
    border-radius: 12px;
}

.preview-table thead th:first-child {
    border-top-left-radius: 12px;
}

.preview-table thead th:last-child {
    border-top-right-radius: 12px;
}

.preview-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.preview-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

.preview-table thead tr,
.preview-table tbody tr {
    height: auto;
    min-height: 25px;
}

.preview-table th,
.preview-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    border-right: 1px solid #000000;
}

.preview-table th:last-child,
.preview-table td:last-child {
    border-right: none;
}

.preview-table th {
    background: var(--toggle-active);
    font-weight: 600;
    color: var(--text-main);
    font-size: 16px;
    text-align: center;
}

.preview-table tbody td {
    font-size: 14px;
    text-align: left;
}

.preview-table tbody tr:last-child td {
    border-bottom: none;
}

.preview-table tr:last-child td {
    border-bottom: none;
}

/* ===== Anonymize Page: Upload and Preview ===== */
.anonym-inner {
    align-self: stretch;
    width: 100%;
    max-width: 1100px;
    margin-top: 0;
    margin-left: auto;
    margin-right: auto;
    font-family: var(--font-family);
    box-sizing: border-box;
}

.upload-section {
    margin-top: 95px;
    margin-bottom: 24px;
    width: 100%;
}

.upload-row-scroll {
    display: flex;
    justify-content: center;
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.upload-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0;
    font-family: var(--font-family);
    width: min(961px, 100%);
}

.upload-label {
    margin: 0 16px 0 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 400;
    line-height: 36px;
    height: 36px;
    color: var(--text-main);
    flex-shrink: 0;
    white-space: nowrap;
    cursor: pointer;
}

.upload-feedback {
    flex-shrink: 0;
    width: 308px;
    height: 35px;
    margin-left: 0;
    padding: 0 14px;
    border-radius: 30px;
    box-sizing: border-box;
    background-color: #d9d9d9;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    line-height: 35px;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-feedback.upload-feedback--error {
    color: #850000;
    font-weight: 500;
}

.preview-panel[hidden],
.config-panel[hidden] {
    display: none !important;
}

.preview-panel {
    width: min(964px, 100%);
    margin: 0 auto 30px;
    padding: 10px 20px 12px;
    box-sizing: border-box;
    border-radius: 20px;
    background-color: rgba(143, 178, 179, 0.39);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.preview-panel__title {
    margin: 0;
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-main);
    text-align: center;
    flex-shrink: 0;
}

.preview-panel__table-clip {
    width: min(924px, 100%);
    border-radius: 20px;
    overflow: hidden;
    background-color: #f4f4f4;
    flex-shrink: 0;
}

/* ===== Config Panel (Anonymization Settings) ===== */
.config-panel {
    width: min(964px, 100%);
    margin: 0 auto 30px;
    padding: 16px 20px 20px;
    box-sizing: border-box;
    border-radius: 20px;
    background-color: rgba(143, 178, 179, 0.39);
    overflow: visible;
    position: relative;
    z-index: 1;
}

.config-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.config-panel__title {
    margin: 0;
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--text-main);
}

.config-panel__table-clip {
    width: 100%;
    border-radius: 20px;
    overflow: visible;
    background-color: #f4f4f4;
}

.config-table {
    width: 100%;
    border: none;
    border-collapse: separate;
    border-spacing: 0;
    background-color: #f4f4f4;
    font-family: var(--font-family);
    table-layout: fixed;
    border-radius: 20px;
}

.config-table thead th:first-child {
    border-top-left-radius: 20px;
}

.config-table thead th:last-child {
    border-top-right-radius: 20px;
}

.config-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 20px;
}

.config-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 20px;
}

.config-table thead tr {
    height: auto;
    min-height: 25px;
}

.config-table tbody tr {
    min-height: 25px;
}

.config-table th,
.config-table td {
    border: none;
    border-right: 1px solid #000000;
    border-bottom: 1px solid #000000;
    padding: 5px 8px;
    box-sizing: border-box;
    font-weight: 500;
    color: var(--text-main);
    vertical-align: middle;
    font-family: var(--font-family);
    width: 25%;
    min-width: 0;
}

.config-table th:last-child,
.config-table td:last-child {
    border-right: none;
}

.config-table thead th {
    font-size: 16px;
    text-align: center;
    line-height: 1.25;
    height: auto;
    min-height: 25px;
}

.config-table tbody td {
    font-size: 14px;
    text-align: center;
    line-height: 1.25;
    min-height: 25px;
    height: auto;
}

.config-table tbody tr:last-child td {
    border-bottom: none;
}

.config-table td.example {
    text-align: center;
}

.config-table .method-cell-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    min-height: 25px;
}

.config-table .params-cell-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

/* ===== Custom Select in Config Table ===== */
.config-table .custom-select--cell {
    position: relative;
    display: block;
}

.config-table .custom-select--method-only {
    width: 100%;
    max-width: var(--method-select-w);
    margin-left: auto;
    margin-right: auto;
}

.config-table .custom-select--param {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.config-table .custom-select--cell .custom-select__bar {
    display: flex;
    align-items: center;
    height: var(--method-select-h);
    padding-left: 8px;
    padding-right: 2px;
    border-radius: var(--method-field-radius);
    background-color: var(--method-field-bg);
    cursor: pointer;
    outline: none;
}

.config-table .custom-select--cell:not(.custom-select--error).is-open .custom-select__bar {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.config-table .custom-select--cell .custom-select__bar:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 2px;
}

.config-table .custom-select--cell.custom-select--error .custom-select__bar {
    outline: 2px solid #850000;
    outline-offset: 2px;
}

.config-table .custom-select--cell.custom-select--error .custom-select__bar:focus-visible {
    outline: 2px solid #850000;
    outline-offset: 2px;
}

.config-table .custom-select--cell.custom-select--error.is-open .custom-select__bar {
    outline: 2px solid #850000;
    outline-offset: 2px;
}

.config-table .custom-select--cell .custom-select__value {
    flex: 1;
    min-width: 0;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
    text-align: center;
}

.config-table .custom-select--cell.has-value .custom-select__value {
    color: var(--text-main);
}

.config-table .custom-select--cell .custom-select__toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 100%;
    pointer-events: none;
}

.config-table .custom-select--cell .custom-select__bird {
    display: block;
    width: 17px;
    height: auto;
    transition: transform 0.25s ease;
}

.config-table .custom-select--cell.is-open .custom-select__bird {
    transform: rotate(180deg);
}

.config-table .custom-select--cell .custom-select__list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 50;
    overflow: hidden;
}

.config-table .custom-select--cell .custom-select__list li {
    margin: 0;
    padding: 0;
}

.config-table .custom-select--cell .custom-select__option {
    width: 100%;
    margin: 0;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    color: var(--dropdown-item);
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.config-table .custom-select--cell .custom-select__option:hover {
    background-color: var(--dropdown-hover-bg);
    color: var(--dropdown-hover-fg);
}

.config-table .custom-select--cell .custom-select__option:focus-visible {
    outline: 2px solid var(--dropdown-item);
    outline-offset: -2px;
}

.select-method {
    font-family: var(--font-family);
    font-size: 12px;
}

.required {
    color: #850000;
    margin-left: 5px;
}

/* ===== Actions and Feedback ===== */
.actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 20px;
}

@media (max-width: 940px) {
    .upload-row {
        justify-content: flex-start;
        width: max-content;
    }
}

.feedback-large {
    background-color: #d9d9d9;
    border-radius: 30px;
    padding: 16px 24px;
    margin: 20px 0;
    font-size: 16px;
    color: var(--text-main);
    text-align: center;
    font-family: var(--font-family);
    display: none;
}

.feedback-large.show {
    display: block;
}

.feedback-large.feedback-large--error {
    background-color: #ffe0e0;
    color: #850000;
}

.feedback-large.feedback-large--success {
    background-color: #d4edda;
    color: #155724;
}

.feedback-large.feedback-large--loading {
    background-color: #e0e0e0;
    color: #666;
}

/* ===== Footer ===== */
.footer {
    font-family: var(--font-family);
    background-color: var(--footer-bg);
    color: #ffffff;
    text-align: center;
    padding: 80px 20px;
    margin-top: auto;
}

.footer h2,
.footer-title {
    margin: 0;
    font-size: 48px;
    font-weight: 500;
    letter-spacing: 1px;
}

[data-theme="dark"] .preview-panel__table-clip,
[data-theme="dark"] .config-panel__table-clip,
[data-theme="dark"] .config-table,
[data-theme="dark"] .preview-table-scroll {
    background-color: #202d33;
}

[data-theme="dark"] .upload-feedback,
[data-theme="dark"] .feedback-large {
    background-color: #2a363c;
    color: var(--text-main);
}

[data-theme="dark"] .feedback-large.feedback-large--error {
    background-color: #4a2528;
    color: #ffbdbd;
}

[data-theme="dark"] .feedback-large.feedback-large--success {
    background-color: #214232;
    color: #c7f5d7;
}

[data-theme="dark"] .feedback-large.feedback-large--loading {
    background-color: #2d3a40;
    color: #d2dde0;
}

[data-theme="dark"] .question-mark {
    background-color: #223038;
}

[data-theme="dark"] .question-mark:hover {
    background-color: #2a3942;
}

[data-theme="dark"] .custom-select__list,
[data-theme="dark"] .config-table .custom-select--cell .custom-select__list {
    background: #24323a;
    border: 1px solid #3a4a50;
}

@media (max-width: 768px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .nav {
        height: auto;
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 10px;
    }

    .nav a,
    .header .nav .nav-dropdown__trigger,
    .nav .nav-link {
        font-size: 18px;
    }

    .tabs {
        margin-top: 80px;
    }

    .tab {
        font-size: 16px;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 14px;
        overflow: visible;
        padding-bottom: 0;
        margin-top: 56px;
    }

    .field-wrap {
        width: 100%;
        flex: 1 1 auto;
        max-width: 100%;
    }

    .submit-btn,
    .btn-main-action {
        height: 52px;
        font-size: 20px;
    }

    .upload-section {
        margin-top: 56px;
    }

    .upload-row-scroll {
        overflow: visible;
    }

    .upload-row {
        width: 100%;
        justify-content: flex-start;
        align-items: stretch;
        flex-direction: column;
    }

    .upload-label {
        margin: 0;
        font-size: 18px;
        line-height: 1.3;
        height: auto;
    }

    .btn-upload {
        width: 100%;
        margin-right: 0;
    }

    .upload-feedback {
        width: 100%;
    }

    .preview-panel,
    .config-panel {
        padding-left: 10px;
        padding-right: 10px;
    }

    .preview-panel__title,
    .config-panel__title {
        font-size: 18px;
    }

    .config-table th,
    .config-table td,
    .preview-table th,
    .preview-table td,
    .preview-table--in-panel th,
    .preview-table--in-panel td {
        font-size: 12px;
        padding: 8px 10px;
    }

    .generate-download-wrap--anonym,
    .generate-download-wrap {
        margin-top: 16px;
    }

    .download-btn--generate {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .hero {
        margin-top: 92px;
    }

    .hero h1 {
        font-size: 34px;
        line-height: 1.15;
    }

    .hero p {
        font-size: 15px;
    }

    .feature-btn {
        height: 56px;
        font-size: 28px;
    }

    .feature-card {
        height: auto;
        min-height: 420px;
    }

    .question-mark {
        width: 44px;
        height: 44px;
        font-size: 26px;
    }

    .tabs {
        height: 46px;
        border-radius: 24px;
    }

    .tab {
        font-size: 15px;
        padding: 0 4px;
    }
}
