/* styles.css — стили страницы получения данных по ссылке */

:root {
    --color-primary: #3B82F6;
    --color-primary-hover: #2563EB;
    --color-secondary: #10B981;
    --color-secondary-hover: #059669;
    --color-bg: #F9FAFB;
    --color-surface: #FFFFFF;
    --color-border: #E5E7EB;
    --color-text-primary: #111827;
    --color-text-secondary: #4B5563;
    --color-text-muted: #6B7280;

    --color-info-bg: #EFF6FF;
    --color-info-border: #BFDBFE;
    --color-info-text: #1E40AF;
    --color-success-bg: #ECFDF5;
    --color-success-border: #A7F3D0;
    --color-success-text: #065F46;
    --color-error-bg: #FEF2F2;
    --color-error-border: #FECACA;
    --color-error-text: #991B1B;
}

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

body {
    margin: 0;
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, p, dl, dd { margin: 0; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }

.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;
}

.container { max-width: 56rem; margin: 0 auto; padding: 2rem 1rem; }
@media (min-width: 640px) { .container { padding: 2rem 1.5rem; } }

.page-header { text-align: center; margin-bottom: 3rem; }
.page-title { font-size: 2.25rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.2; }
.page-subtitle { font-size: 1.25rem; color: var(--color-text-secondary); max-width: 42rem; margin: 0 auto; }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.5rem;
}

.card-title { font-size: 1.5rem; font-weight: 600; }

.form-row { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 640px) { .form-row { flex-direction: row; } }

.input {
    flex: 1; padding: 0.75rem 1rem;
    border: 1px solid #D1D5DB; border-radius: 8px;
    font-size: 1rem; font-family: inherit;
    background: var(--color-surface); color: var(--color-text-primary);
    transition: border-color 150ms, box-shadow 150ms; outline: none; min-width: 0;
}
.input:focus { border-color: transparent; box-shadow: 0 0 0 2px var(--color-primary); }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.75rem 1.5rem; border: none; border-radius: 8px;
    font-size: 1rem; font-weight: 500; white-space: nowrap;
    transition: background-color 150ms, opacity 150ms;
}
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--color-primary); color: #fff; padding: 0.75rem 2rem; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }

.btn-secondary { background: var(--color-secondary); color: #fff; padding: 0.5rem 1.5rem; }
.btn-secondary:hover:not(:disabled) { background: var(--color-secondary-hover); }

.btn-ghost { background: #F3F4F6; color: #374151; padding: 0.5rem 1.5rem; }
.btn-ghost:hover:not(:disabled) { background: #E5E7EB; }
.btn-ghost.is-success { background: #D1FAE5; color: var(--color-success-text); }

.card-actions { display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 640px) { .card-actions { flex-direction: row; } }

.status { margin-bottom: 2rem; }
.status-inner {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1rem; border: 1px solid; border-radius: 8px;
}
.status-icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.status-text { font-weight: 500; }
.status--loading .status-inner { background: var(--color-info-bg); border-color: var(--color-info-border); }
.status--loading .status-text { color: var(--color-info-text); }
.status--success .status-inner { background: var(--color-success-bg); border-color: var(--color-success-border); }
.status--success .status-text { color: var(--color-success-text); }
.status--error .status-inner { background: var(--color-error-bg); border-color: var(--color-error-border); }
.status--error .status-text { color: var(--color-error-text); }

.spinner {
    width: 1.25rem; height: 1.25rem;
    border: 2px solid var(--color-primary); border-top-color: transparent;
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-icon-circle {
    width: 1.25rem; height: 1.25rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.status-icon-circle--success { background: var(--color-secondary); }
.status-icon-circle--error { background: #EF4444; }
.status-icon-circle svg { width: 0.75rem; height: 0.75rem; color: #fff; }

/* ---------- Summary блок ---------- */
.prop-title {
    font-size: 1.75rem; font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem; line-height: 1.3;
}
.prop-location {
    color: var(--color-text-secondary);
    font-size: 1rem; margin-bottom: 1rem;
}
.prop-price {
    font-size: 1.5rem; font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
}
.prop-price .deal-type {
    display: inline-block;
    margin-left: 0.5rem; padding: 0.125rem 0.625rem;
    background: #DBEAFE; color: #1E40AF;
    border-radius: 999px; font-size: 0.75rem;
    font-weight: 500; text-transform: uppercase;
    vertical-align: middle;
}
.prop-specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
}
@media (min-width: 640px) { .prop-specs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.prop-specs > div {
    border-left: 3px solid var(--color-border);
    padding-left: 0.75rem;
}
.prop-specs dt {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}
.prop-specs dd {
    font-size: 1rem; font-weight: 600;
    color: var(--color-text-primary);
}

/* ---------- Amenities ---------- */
.amenities-list {
    list-style: none; margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
@media (min-width: 640px) { .amenities-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.amenities-list li {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #F3F4F6; border-radius: 6px;
    font-size: 0.875rem; color: #374151;
}
.amenities-list li::before {
    content: "✓"; color: var(--color-secondary);
    font-weight: 700; flex-shrink: 0;
}

/* ---------- Фото ---------- */
.photos-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem;
}
@media (min-width: 768px) { .photos-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .photos-grid { grid-template-columns: repeat(4, 1fr); } }

.photo {
    aspect-ratio: 1 / 1; border-radius: 8px;
    overflow: hidden; background: #F3F4F6;
}
.photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

/* ---------- Описание ---------- */
.description p {
    color: #374151; line-height: 1.7;
    margin-bottom: 1rem;
}
.description p:last-child { margin-bottom: 1.5rem; }
.description.empty { color: var(--color-text-muted); font-style: italic; }

/* ---------- Лайтбокс ---------- */

/* Курсор-«лупа» на превью фото — подсказывает, что можно кликнуть */
.photo { cursor: zoom-in; }

/*
   Полупрозрачный оверлей поверх всей страницы.
   !important нужны, потому что position:fixed может «ломаться» под
   родительскими элементами с transform/filter/will-change/perspective.
   В app.js мы также перемещаем элемент в <body> для надёжности.
*/
.lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lightbox-fade 200ms ease-out;
}

@keyframes lightbox-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Сама картинка — центрируется и вписывается в экран */
.lightbox__stage {
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.lightbox__image {
    max-width: 95vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    -webkit-user-drag: none;
    user-select: none;
    display: block;
}

/* Закрывающая «крестиком» кнопка в правом верхнем углу.
   Стилистика синхронизирована с основными кнопками сайта (синий primary). */
.lightbox__close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 8px;
    background: var(--color-primary);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background 150ms, transform 100ms;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
    background: var(--color-primary-hover);
    outline: none;
}

.lightbox__close:active {
    transform: scale(0.95);
}

/* Стрелки ←/→ по бокам экрана — синие, скруглённые, в стиле формы */
.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3.5rem;
    height: 3.5rem;
    border: none;
    border-radius: 8px;
    background: var(--color-primary);
    color: #fff;
    font-size: 2rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background 150ms, transform 100ms;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 4px;
}

.lightbox__nav:hover,
.lightbox__nav:focus-visible {
    background: var(--color-primary-hover);
    outline: none;
}

.lightbox__nav:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox__nav--prev { left: 1.5rem; }
.lightbox__nav--next { right: 1.5rem; }

/* Скрываем стрелки, когда фото всего одно (выставляется через JS) */
.lightbox--single .lightbox__nav { display: none; }

/* Счётчик «3 / 22» внизу — тоже в синей стилистике */
.lightbox__counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--color-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* На узких экранах — уменьшаем элементы, чтобы не перекрывали фото */
@media (max-width: 640px) {
    .lightbox__nav {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }
    .lightbox__nav--prev { left: 0.75rem; }
    .lightbox__nav--next { right: 0.75rem; }
    .lightbox__close {
        top: 0.75rem;
        right: 0.75rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }
    .lightbox__counter {
        bottom: 0.75rem;
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Когда лайтбокс открыт — блокируем прокрутку страницы под ним */
body.lightbox-open {
    overflow: hidden;
}

/* ---------- Cleanup: кнопка + прогресс + переключатель оригинал/чистое ---------- */

/* Группа кнопок в шапке блока фото */
.card-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Полоса прогресса под шапкой блока фото */
.cleanup-progress {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-info-bg);
    border: 1px solid var(--color-info-border);
    color: var(--color-info-text);
    border-radius: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cleanup-progress .spinner {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.cleanup-progress.is-error {
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: var(--color-error-text);
}

.cleanup-progress.is-done {
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
    color: var(--color-success-text);
}

/* Бейдж «обработано» в углу фото */
.photo {
    position: relative;
    cursor: zoom-in;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-card-bg);
}

.photo:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Бейдж «✓ Чистое» в правом верхнем углу обработанного фото */
.photo__badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.2rem 0.6rem;
    background: rgba(16, 185, 129, 0.95); /* зелёный */
    color: #fff;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Чекбокс выбора фото — в левом верхнем углу */
.photo__checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Скрываем нативный input, отображаем кастомный квадратик */
}

.photo__checkbox input[type="checkbox"] {
    /* Прячем нативный input, оставляя его кликабельным */
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    z-index: 1;
}

.photo__checkbox-box {
    display: block;
    width: 1.5rem;
    height: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: background 120ms, border-color 120ms;
    position: relative;
}

/* Состояние checked: меняем фон на синий, рисуем галочку через ::after */
.photo__checkbox input[type="checkbox"]:checked + .photo__checkbox-box {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.photo__checkbox input[type="checkbox"]:checked + .photo__checkbox-box::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Hover-эффект на чекбоксе */
.photo__checkbox:hover .photo__checkbox-box {
    border-color: var(--color-primary);
}

/* Подсветка плитки целиком, когда выбрана — синий ободок */
.photo:has(.photo__checkbox input:checked) {
    outline: 3px solid var(--color-primary);
    outline-offset: -3px;
}

/* Маленькая кнопка-переключатель оригинал/обработанное в углу фото */
.photo__toggle {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.6rem;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transition: opacity 150ms;
}

.photo:hover .photo__toggle,
.photo:focus-within .photo__toggle {
    opacity: 1;
}

.photo__toggle:hover {
    background: rgba(0, 0, 0, 0.85);
}

/* Пометка обрабатываемого фото — лёгкое затемнение */
.photo.is-processing img {
    opacity: 0.5;
    filter: grayscale(60%);
}

/* ========================================
   Индикатор источника данных (используется внутри tech-panel)
   ======================================== */
.data-source-badge {
    margin: 0;
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Дефолтное состояние «нет данных» */
.data-source-badge {
    background: #F3F4F6;
    color: #6B7280;
    border: 1px solid #E5E7EB;
    font-style: italic;
}

.data-source-badge.source-rapidapi {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
    font-style: normal;
}

.data-source-badge.source-scraper {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
    font-style: normal;
}

.data-source-badge.source-cache {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #E5E7EB;
    font-style: normal;
}

/* ========================================
   ТЕХНИЧЕСКАЯ ПАНЕЛЬ ВНИЗУ СТРАНИЦЫ
   ======================================== */
.tech-panel {
    margin-top: 3rem;
    padding: 1.25rem 1.5rem;
    border: 1px dashed #D1D5DB;
    border-radius: 0.75rem;
    background: #FAFAFA;
}

.tech-panel__header {
    margin-bottom: 1rem;
}

.tech-panel__title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #6B7280;
    margin: 0 0 0.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tech-panel__hint {
    font-size: 0.8125rem;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}

.tech-panel__section {
    padding: 0.75rem 0;
    border-top: 1px solid #E5E7EB;
}

.tech-panel__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #4B5563;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.tech-panel__buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.tech-panel__status {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: #4B5563;
    min-height: 1.2rem;
}

.tech-panel__status.is-success {
    color: #047857;
}

.tech-panel__status.is-error {
    color: #B91C1C;
}

.tech-btn {
    font-size: 0.8125rem;
    padding: 0.4rem 0.875rem;
}

.tech-btn.is-active {
    background: #3B82F6;
    color: #fff;
}

.tech-btn.is-active:hover:not(:disabled) {
    background: #2563EB;
}

/* Опасная операция — очистка всего кеша */
.tech-btn--danger:not(:disabled) {
    color: #B91C1C;
    border: 1px solid transparent;
}
.tech-btn--danger:hover:not(:disabled) {
    background: #FEE2E2;
    border-color: #FCA5A5;
}

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

/* ========================================
   Переключатель языка — фиксированно в правом верхнем углу
   ======================================== */
.lang-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    gap: 0;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 0.4rem 0.7rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6B7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1;
}

.lang-btn:hover:not(.is-active) {
    background: #F3F4F6;
    color: #111827;
}

.lang-btn.is-active {
    background: #3B82F6;
    color: #fff;
    cursor: default;
}

.lang-btn + .lang-btn {
    border-left: 1px solid #E5E7EB;
}

/* ========================================
   Индикатор сохранённой ручной маски (в шапке галереи)
   ======================================== */
.mask-status-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem 0;
    padding: 0.5rem 0.875rem;
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    color: #3730A3;
}

.mask-status-bar__text {
    font-weight: 500;
}

.mask-status-bar__clear {
    background: transparent;
    border: none;
    color: #4338CA;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.8125rem;
    font-family: inherit;
    margin-left: auto;
    text-decoration: underline;
}

.mask-status-bar__clear:hover {
    background: #C7D2FE;
    text-decoration: none;
}

/* Бейдж "Ручная" вместо "Чистое" когда фото обработано по маске */
.photo__badge--manual {
    background: #6366F1;
}

/* ========================================
   Редактор ручного выделения областей
   ======================================== */
.manual-editor {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
}

.manual-editor.hidden {
    display: none;
}

.manual-editor__header {
    color: #fff;
    text-align: center;
    margin-bottom: 0.75rem;
    flex: 0 0 auto;
}

.manual-editor__title {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.manual-editor__hint {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.85;
}

.manual-editor__stage {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

/* Контейнер canvas-ов (image + overlay) — точно по размеру отображаемого фото */
.manual-editor__canvas-wrap {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.manual-editor__canvas-wrap canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

/* Overlay-canvas для прямоугольников — поверх image-canvas */
.manual-editor__canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    touch-action: none; /* отключаем pinch-zoom при рисовании на тач */
}

.manual-editor__footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1rem;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}

.manual-editor__spacer {
    flex: 1 1 auto;
    min-width: 1rem;
}

/* Внутри редактора у ghost-кнопок белый фон для контраста с тёмным оверлеем */
.manual-editor__footer .btn-ghost {
    background: rgba(255, 255, 255, 0.9);
    color: #1F2937;
}
.manual-editor__footer .btn-ghost:hover:not(:disabled) {
    background: #fff;
}

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

/* Состояние "обработка идёт" — затемняем canvas и блокируем взаимодействие */
.manual-editor.is-processing .manual-editor__canvas-overlay {
    pointer-events: none;
    cursor: wait;
}

.manual-editor.is-processing .manual-editor__canvas-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.manual-editor.is-processing .manual-editor__canvas-wrap::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 11;
}

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

/* ========================================
   Шапка карточки "Фотографии" — особый лейаут:
   слева заголовок + группа кнопок, справа "Выбрать все" отдельно
   ======================================== */
.card-header--photos {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-header--photos .card-title {
    flex: 0 0 auto;
}

.card-header--photos .card-header-actions {
    flex: 1 1 auto;
    margin-right: 0.5rem;
}

.photos-select-all {
    flex: 0 0 auto;
    margin-left: auto;
}

/* ========================================
   Кнопка перевода описания в шапке карточки
   ======================================== */
.translate-btn {
    margin-left: auto;
}

.translate-btn.is-loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

/* ========================================
   Карточка "Экспорт" — содержит кнопки PDF/DOCX/Copy.
   Сейчас минимальная, потом сюда же поедет карточка брокера.
   ======================================== */
#exportBlock .card-actions {
    margin-top: 0;
}

/* ========================================
   Футер карточки "Фотографии" — кнопка "Скачать фото" справа под сеткой
   ======================================== */
.photos-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
}

/* ========================================
   Шапка карточки "Описание" — группа кнопок справа
   (Перевести / Редактировать / Сохранить / Отмена)
   ======================================== */
/* ========================================
   Кнопки в шапке блока "Описание"
   (Перевести / Убрать агентства / Редактировать / Сохранить / Отмена)
   Компактный размер чтобы все 3 кнопки помещались в один ряд рядом с заголовком.
   ======================================== */
.description-header-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-left: auto;
    flex-wrap: nowrap;
}
.description-header-actions .btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.8125rem;
    white-space: nowrap;
    line-height: 1.2;
}

/* На узких экранах разрешаем перенос но кнопки тогда занимают всю ширину */
@media (max-width: 720px) {
    .description-header-actions {
        flex-wrap: wrap;
        width: 100%;
        margin-left: 0;
    }
}

/* Подсказка под шапкой в режиме редактирования */
.description-edit-hint {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
    border-radius: 0.5rem;
    padding: 0.5rem 0.875rem;
    margin: 0 0 0.75rem 0;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Textarea для редактирования описания.
   Когда .description содержит textarea, она занимает всё доступное место. */
.description textarea.description__editor {
    width: 100%;
    min-height: 12rem;
    max-height: 30rem;
    padding: 0.75rem;
    border: 2px solid #3B82F6;
    border-radius: 0.5rem;
    font: inherit;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1F2937;
    background: #fff;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.description textarea.description__editor:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
