/* ==================== БАЗА (общее для всех) ==================== */

:root {
    --ham-primary: #f47c20;
    --ham-primary-dark: #d4691a;
    --ham-primary-light: #fef3e8;
    --ham-accent: #1a8e9c;
    --ham-accent-dark: #146e79;
    --ham-accent-light: #e6f4f6;
    --ham-purple: #b184bb;
    --ham-text: #333;
    --ham-text-muted: #777;
    --ham-border: #e5e5e5;
    --ham-bg: #fafafa;
    --ham-white: #fff;
    --ham-success: #2e7d32;
    --ham-gold: #ffd54f;
}

* {
    box-sizing: border-box;
}

/* ==================== УВЕДОМЛЕНИЯ / СООБЩЕНИЯ ==================== */

.ham-success {
    background: #e0f7e0;
    border-left: 4px solid var(--ham-success);
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ham-message {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 18px 22px;
    border-radius: 8px;
}

.ham-field-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--ham-text-muted);
    line-height: 1.4;
}

.ham-index-hint strong {
    color: var(--ham-primary-dark);
}

/* ==================== МОДАЛЬНЫЕ ОКНА ==================== */

body.ham-modal-open {
    overflow: hidden;
}

.ham-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.ham-modal-window {
    background: #fff;
    border-radius: 20px;
    max-width: 520px;
    width: 100%;
    padding: 30px 35px 25px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: ham-modal-appear 0.25s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes ham-modal-appear {
    from { opacity: 0; transform: translateY(-15px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ham-modal-window h3 {
    margin: 0 0 15px;
    color: var(--ham-primary);
    font-size: 1.35rem;
    padding-right: 30px;
}

.ham-modal-close {
    position: absolute;
    top: 12px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--ham-text-muted);
    cursor: pointer;
    padding: 0 8px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.ham-modal-close:hover {
    background: #f0f0f0;
    color: var(--ham-text);
}

.ham-modal-steps {
    margin: 0 0 20px;
    padding-left: 22px;
    color: var(--ham-text);
}

.ham-modal-steps li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.ham-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 0;
}

.ham-modal-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--ham-primary);
    color: #fff !important;
    text-decoration: none !important;
    padding: 12px 26px;
    border-radius: 30px;
    font-weight: 700;
    transition: background 0.3s, filter 0.2s;
    border: none;
    line-height: 1.2;
}

.ham-modal-open-btn:hover {
    background: var(--ham-primary-dark);
    filter: brightness(1.05);
}

.ham-modal-cancel-btn {
    background: transparent;
    border: 2px solid var(--ham-border);
    color: var(--ham-text-muted);
    padding: 10px 22px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.2;
}

.ham-modal-cancel-btn:hover {
    border-color: var(--ham-text-muted);
    color: var(--ham-text);
}

.ham-modal-cancel-btn:hover {
    border-color: var(--ham-text-muted);
    color: var(--ham-text);
}

/* ==================== ФАЙЛОВЫЕ ИНПУТЫ (общие) ==================== */

.ham-file-upload {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 4px 0;
}

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

.ham-avatar-preview {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--ham-primary-light);
    border: 2px dashed var(--ham-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.ham-avatar-preview.ham-has-image {
    border-style: solid;
}

.ham-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ham-avatar-placeholder {
    font-size: 1.8rem;
    line-height: 1;
    color: var(--ham-primary);
    opacity: 0.55;
    user-select: none;
}

.ham-avatar-preview.ham-has-image .ham-avatar-placeholder {
    display: none;
}

.ham-file-label {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--ham-primary);
    color: #fff !important;
    border: none;
    border-radius: 30px;
    padding: 12px 32px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s, box-shadow 0.2s;
    margin: 0 !important;
    user-select: none;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(244, 124, 32, 0.25);
    line-height: 1.2;
}

.ham-file-label:hover {
    background: var(--ham-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(244, 124, 32, 0.35);
}

.ham-file-label .ham-file-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.ham-file-name {
    color: var(--ham-text-muted);
    font-size: 0.85rem;
    font-style: italic;
    word-break: break-all;
    flex: 1;
    min-width: 100px;
}

.ham-file-name.ham-file-name-selected {
    color: var(--ham-success);
    font-style: normal;
    font-weight: 600;
}

#avatar_preview img {
    border-radius: 50%;
    object-fit: cover;
}

/* ==================== ПОДСКАЗКИ DADATA ==================== */

.ham-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fff;
    border: 2px solid var(--ham-primary);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    max-height: 260px;
    overflow-y: auto;
    margin-top: 4px;
}

.ham-suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--ham-text);
    line-height: 1.4;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.ham-suggestion-item:last-child {
    border-bottom: none;
}

.ham-suggestion-item:hover {
    background: var(--ham-primary-light);
    color: var(--ham-primary-dark);
}

.suggestions-wrapper,
.suggestions-suggestions {
    display: none !important;
}

/* ==================== РОЗЕТКИ ==================== */

.ham-rosette-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ccc;
    vertical-align: middle;
    margin-right: 6px;
}

/* ==================== АНИМАЦИИ, ОБЩИЕ ДЛЯ ВСЕХ ==================== */

@keyframes ham-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==================== МОДАЛКА (base-часть для мобильных) ==================== */

@media (max-width: 768px) {
    .ham-modal-window {
        padding: 24px 20px 20px;
        border-radius: 16px;
    }

    .ham-modal-window h3 {
        font-size: 1.15rem;
    }

    .ham-modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ham-modal-open-btn,
    .ham-modal-cancel-btn {
        width: 100%;
        text-align: center;
    }
}
/* ==================== ВСПЛЫВАЮЩИЕ УВЕДОМЛЕНИЯ ==================== */
.ham-notice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ham-notice-overlay.is-visible {
    display: flex;
    opacity: 1;
}

.ham-notice-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 30px 44px 28px;
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.5;
    animation: ham-notice-appear 0.3s ease-out;
}

@keyframes ham-notice-appear {
    from { transform: translateY(-15px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.ham-notice-box.ham-notice-success {
    border-top: 5px solid var(--ham-success);
}

.ham-notice-box.ham-notice-error {
    border-top: 5px solid #d63638;
}

.ham-notice-box.ham-notice-info {
    border-top: 5px solid #f0b849;
}

.ham-notice-icon {
    font-size: 2.6rem;
    line-height: 1;
    margin-bottom: 12px;
    display: block;
}

.ham-notice-box.ham-notice-success .ham-notice-icon {
    color: var(--ham-success);
}

.ham-notice-box.ham-notice-error .ham-notice-icon {
    color: #d63638;
}

.ham-notice-box.ham-notice-info .ham-notice-icon {
    color: #f0b849;
}

.ham-notice-text {
    color: #333;
    font-weight: 500;
}

.ham-notice-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.ham-notice-close:hover {
    background: #f0f0f0;
    color: #333;
}

@media (max-width: 600px) {
    .ham-notice-box {
        padding: 26px 22px 24px;
        font-size: 1rem;
    }
    .ham-notice-icon {
        font-size: 2.2rem;
    }
}
/* Состояние загрузки для кнопок-ссылок модалок */
.ham-modal-open-btn.ham-btn-loading {
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
/* ==================== КНОПКИ «ИЗБРАННОЕ» ==================== */

/* Базовая кнопка избранного — как .ham-modal-open-btn */
.ham-wishlist-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 26px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none !important;
    line-height: 1.2;
    border: none;
    transition: background 0.2s, filter 0.2s, box-shadow 0.2s, color 0.2s, border-color 0.2s;
    /* Сброс браузерных стилей button */
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-sizing: border-box;
    margin: 0;
}

.ham-wishlist-toggle:focus {
    outline: none;
}

/* Кнопка «В избранное» (жёлтая) */
.ham-wishlist-toggle[data-state="0"] {
    background: #f0b849;
    color: #fff !important;
}

.ham-wishlist-toggle[data-state="0"]:hover {
    background: #dba02e;
    filter: brightness(1.02);
    box-shadow: 0 4px 12px rgba(240, 184, 73, 0.35);
}

/* Кнопка «Убрать из избранного» (красная рамка) */
.ham-wishlist-toggle[data-state="1"] {
    background: transparent;
    color: #b32d2e !important;
    border: 2px solid #b32d2e;
    padding: 10px 24px; /* −2px по вертикали и горизонтали из-за бордера */
}

.ham-wishlist-toggle[data-state="1"]:hover {
    background: #b32d2e;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(179, 45, 46, 0.3);
}
/* ==================== ПОЛЕ ПАРОЛЯ С ИКОНКОЙ ГЛАЗ ==================== */

.ham-password-wrap {
    position: relative;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

/* Одинаковые стили для инпута вне зависимости от type, чтобы
   при переключении type="password" ↔ type="text" поле не дёргалось,
   не меняло высоту и не сдвигало блоки ниже. */
.ham-password-wrap input.ham-password-input,
.ham-login-form .ham-password-wrap input.ham-password-input,
.ham-register-form .ham-password-wrap input.ham-password-input,
.ham-login-form .ham-password-wrap input.ham-password-input[type="password"],
.ham-login-form .ham-password-wrap input.ham-password-input[type="text"],
.ham-register-form .ham-password-wrap input.ham-password-input[type="password"],
.ham-register-form .ham-password-wrap input.ham-password-input[type="text"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;

    /* Фиксируем высоту — иначе Chrome считает её по-разному для
       password и text, и страница прыгает. */
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    line-height: 44px !important;

    padding: 0 46px 0 12px !important;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
    font-size: 15px !important;
    letter-spacing: normal !important;

    transition: none !important;
    animation: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* Иконки в кнопке — SVG наследует currentColor. */
.ham-password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;

    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;

    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;

    color: #999 !important;
    font-size: 18px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-align: center !important;
    text-transform: none !important;
    letter-spacing: 0 !important;

    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    outline: none;

    transition: color 0.15s, background 0.15s !important;
}

.ham-password-toggle svg {
    display: block;
    width: 20px;
    height: 20px;
    pointer-events: none;
    fill: none;
    stroke: currentColor;
}

.ham-password-toggle:hover,
.ham-password-toggle:focus {
    color: #f47c20 !important;
    background: rgba(244, 124, 32, 0.1) !important;
    box-shadow: none !important;
}

.ham-password-toggle.is-visible {
    color: #f47c20 !important;
}

/* Жёсткие селекторы специально для формы входа и регистрации —
   тема Neve стилизует <button> в .ham-login-form как primary-кнопку
   и превращает наш глаз в оранжевую «пилюлю». */
.ham-login-form .ham-password-toggle,
.ham-register-form .ham-password-toggle {
    display: inline-flex !important;
    position: absolute !important;
    top: 50% !important;
    right: 8px !important;
    transform: translateY(-50%) !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    color: #999 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    text-transform: none !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.ham-login-form .ham-password-toggle:hover,
.ham-login-form .ham-password-toggle:focus,
.ham-register-form .ham-password-toggle:hover,
.ham-register-form .ham-password-toggle:focus {
    background: rgba(244, 124, 32, 0.1) !important;
    color: #f47c20 !important;
    box-shadow: none !important;
}

.ham-login-form .ham-password-toggle.is-visible,
.ham-register-form .ham-password-toggle.is-visible {
    color: #f47c20 !important;
}

/* Тёмная тема. */
html.ham-theme-dark .ham-password-toggle,
html.ham-theme-dark .ham-login-form .ham-password-toggle,
html.ham-theme-dark .ham-register-form .ham-password-toggle {
    color: #a8a8a8 !important;
}

html.ham-theme-dark .ham-password-toggle:hover,
html.ham-theme-dark .ham-password-toggle:focus,
html.ham-theme-dark .ham-password-toggle.is-visible,
html.ham-theme-dark .ham-login-form .ham-password-toggle:hover,
html.ham-theme-dark .ham-login-form .ham-password-toggle:focus,
html.ham-theme-dark .ham-login-form .ham-password-toggle.is-visible,
html.ham-theme-dark .ham-register-form .ham-password-toggle:hover,
html.ham-theme-dark .ham-register-form .ham-password-toggle:focus,
html.ham-theme-dark .ham-register-form .ham-password-toggle.is-visible {
    color: #ffa04d !important;
    background: rgba(255, 160, 77, 0.12) !important;
}

/* ============================================================
   ГРАДИЕНТНЫЙ ФОН ДЛЯ ФОРМ ВХОДА И РЕГИСТРАЦИИ
   ============================================================ */
/* Тот же градиент, что у секций ЛК: тёплый оранжевый → белый → бирюзовый.
   Применяется на странице /lichnyj-kabinet/, где выводится форма входа
   (для гостей) или форма регистрации (на #ham-register). */

.ham-login-form,
.ham-register-form {
    background: linear-gradient(135deg,
        var(--ham-primary-light) 0%,
        #ffffff 60%,
        var(--ham-accent-light) 100%);
    border-radius: 20px;
    padding: 30px 34px;
    box-shadow: 0 6px 20px rgba(244, 124, 32, 0.12);
    box-sizing: border-box;
}

/* Внутренние отступы не нужны, если форма вложена в .ham-register-form-wide
   (у вас там уже есть padding). Уточняем поведение для широкой формы. */
.ham-register-form.ham-register-form-wide {
    padding: 30px 34px;
}

/* Мобильный — компактнее. */
@media (max-width: 768px) {
    .ham-login-form,
    .ham-register-form {
        padding: 22px 18px;
        border-radius: 16px;
    }
    .ham-register-form.ham-register-form-wide {
        padding: 22px 18px;
    }
}