/* ============================================
   Reusable Components Styles
   Переиспользуемые компоненты для всех страниц
   ============================================ */

/* ============================================
   Creator Badge Component
   Унифицированный компонент для отображения создателя
   ============================================ */

.creator-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.creator-badge-avatar {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.creator-badge-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Model Selector Component
   Горизонтальный слайдер выбора моделей
   ============================================ */

.models-selector-section {
    margin: 16px 0;
    padding: 16px;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    will-change: transform;
}

/* Кнопка создать внутри блока селектора - ГЛОБАЛЬНО */
.models-selector-section .buttons-container {
    margin-top: 12px;
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    bottom: auto !important;
    left: auto !important;
    display: flex;
    justify-content: center;
    width: 100%;
}

.models-selector-section .btn-action-primary {
    position: relative !important;
    left: auto !important;
    transform: none !important;
    padding: 12px 40px;
    min-width: 200px;
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    z-index: 1;
}

/* Удалено: Пульсирующий градиент ::before (вызывал смещение кнопки) */

.models-slider {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
    padding-bottom: 14px; /* Увеличен для бейджей которые накладываются на border */
}

.models-slider::-webkit-scrollbar {
    display: none;
}

.models-selector-label {
    font-size: 11px;
    color: #8A8FA3;
    margin-bottom: 8px;
    padding-left: 4px;
}

/* ============================================
   Model Selector Alerts Container
   Контейнер для алертов (абсолютное позиционирование)
   ============================================ */

.model-selector-alerts {
    position: fixed;
    bottom: calc(var(--bottom-nav-gap) + var(--bottom-nav-height) + 20px + 140px); /* Над блоком селектора */
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(var(--container-max-width) - 32px); /* Container - padding */
    width: calc(100% - 32px);
    z-index: 1000; /* Поверх селектора */
    pointer-events: none; /* Не блокирует клики */
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

/* Алерты кликабельны */
.model-selector-alerts > * {
    pointer-events: auto;
}

/* ============================================
   Model Selector Alerts
   Облачные алерты над селектором моделей
   ============================================ */

/* Алерт минимального выбора (error) */
.min-model-warning {
    display: none;
    font-size: 12px;
    font-weight: 500;
    color: #FF3B30;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 12px;
    padding: 10px 16px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.min-model-warning.show {
    display: block;
    animation: alertFadeIn 0.5s ease-out forwards;
}

.min-model-warning.hide {
    animation: alertFadeOut 0.8s ease-in forwards;
}

/* Алерт множественного выбора (info, glassmorphism) */
.multi-model-alert {
    display: none;
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    background: rgba(15, 15, 25, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(106, 44, 255, 0.4);
    border-radius: 12px;
    padding: 10px 18px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(106, 44, 255, 0.3);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.multi-model-alert.show {
    display: block;
    animation: alertFadeIn 0.5s ease-out forwards;
}

.multi-model-alert.hide {
    animation: alertFadeOut 0.8s ease-in forwards;
}

/* Плавное появление */
@keyframes alertFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    50% {
        transform: translateY(-2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Плавное исчезновение */
@keyframes alertFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
        display: none;
    }
}

.model-card {
    flex: 0 0 auto;
    width: 180px;
    padding: 8px 12px 18px 12px; /* Уменьшен bottom padding - бейдж названия накладывается на border */
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid #2a2a3e;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    scroll-snap-align: start;
    position: relative;
    min-height: 46px; /* Компактная карточка */
}

.model-card.selected {
    border-color: #6A2CFF;
    background: rgba(106, 44, 255, 0.15);
}

.model-card:active {
    transform: scale(0.97);
}

/* Контейнер для описания (цена теперь абсолютная) */
.model-card-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 30px; /* Отступ для бейджа цены справа */
}

/* Контейнер инфо модели (только описание) */
.model-info {
    text-align: left;
    flex: 1;
}

/* Описание модели - компактный текст по левому краю */
.model-description {
    font-size: 12px;
    color: #F5F7FA;
    line-height: 1.3;
    font-weight: 500;
}

/* ✅ Название модели - накладывается НА BORDER снизу (слева) */
.model-name {
    position: absolute;
    bottom: -10px;  /* Половина на карточке, половина снаружи */
    left: 10px;
    font-size: 8px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(26, 26, 46, 0.95);
    padding: 3px 7px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid #2a2a3e;
    z-index: 2;
}

/* ✅ Бейдж цены - АБСОЛЮТНО позиционированный (верхний правый угол) */
.model-price-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 5px;
    background: #FFD700;
    border-radius: 6px;
    font-size: 9px;
    color: #000000;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
    border: 1px solid #FFC700;
    z-index: 3;
}

.model-price-badge .price-icon {
    width: 8px;
    height: 8px;
    filter: brightness(0);
}

/* ============================================
   Profiles Selector Component
   Простой горизонтальный селектор профилей
   ============================================ */

.profiles-selector {
    display: flex !important;
    gap: 8px;
    overflow-x: auto;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 10px 8px;
    margin: 12px 0;
    min-height: 90px !important;
}

.profiles-selector::-webkit-scrollbar {
    display: none;
}

.profile-card {
    min-width: 70px;
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: visible;
    cursor: pointer;
    position: relative;
    border: none;
    transition: all 0.3s ease;

    /* ЯВНО убираем свечение и transform для базового состояния */
    filter: none;
    box-shadow: none;
    transform: none;
}

.profile-card img {
    border-radius: 12px;
    overflow: hidden;
}

.profile-card.selected {
    outline: 2px solid #6A2CFF;
    outline-offset: 2px;
    animation: outlinePulse 2s ease-in-out infinite;

    /* ЯВНО убираем свечение и transform - ТОЛЬКО outline */
    filter: none;
    box-shadow: none;
    transform: none;
}

/* ЯВНО убираем галочку и рамку - НЕТ ::after и ::before для selected */
.profile-card.selected::after {
    display: none;
    content: none;
}

.profile-card.selected::before {
    display: none;
    content: none;
}

@keyframes outlinePulse {
    0%, 100% {
        outline-color: #6A2CFF;
    }
    50% {
        outline-color: #00C8FF;
    }
}

.profile-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card .photo-count {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.profile-card .photo-count svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
}

.upload-profile-card {
    min-width: 70px;
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #6A2CFF 0%, #00C8FF 100%);
    border: none;
    outline: 2px dashed rgba(255, 255, 255, 0.8);
    outline-offset: -4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    gap: 2px;
}

.upload-profile-card:active {
    transform: scale(0.95);
}

.upload-profile-card svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.upload-profile-card .upload-text {
    font-size: 9px;
    color: white;
    text-align: center;
    line-height: 1.1;
    font-weight: 600;
}

/* ============================================
   Rotating Word Animation
   Анимация смены слов по вертикали
   ============================================ */

.rotating-word {
    display: inline-block;
    font-weight: 700;
    color: #CFFF00;
    min-width: 100px;
    text-align: left;
}

@keyframes wordFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-15px) scale(0.9);
    }
}

@keyframes wordFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rotating-word.fade-out {
    animation: wordFadeOut 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.rotating-word.fade-in {
    animation: wordFadeIn 0.2s cubic-bezier(0, 0, 0.2, 1) forwards;
}

/* ============================================
   Profile Card Shimmer Loading
   Shimmer для загружающихся карточек профилей
   ============================================ */

.profile-card.shimmer {
    background: linear-gradient(
        90deg,
        #6A2CFF 0%,
        #00C8FF 50%,
        #6A2CFF 100%
    ) !important;
    background-size: 200% 100% !important;
    animation: shimmerAnimation 1.5s infinite !important;
    position: relative !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    outline: 2px solid #FFFFFF !important;
    outline-offset: -2px !important;
}

.profile-card.shimmer .photo-count {
    display: none !important;
}

.profile-card.shimmer img {
    display: none !important;
}

.profile-card.shimmer::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    z-index: 10;
}

/* @keyframes spin moved to loader.css - special version for upload card spinner */
@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes shimmerAnimation {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   Profile Badge Component (Tiptap Node)
   Бейджи @person в Tiptap редакторе
   ============================================ */

.profile-badge {
    display: inline-flex !important;
    vertical-align: middle;
    width: auto !important;
    max-width: fit-content;
    padding: 4px 10px 4px 4px;
    background: linear-gradient(135deg, rgba(106, 44, 255, 0.15), rgba(106, 44, 255, 0.25));
    border: 1px solid rgba(106, 44, 255, 0.4) !important;
    border-radius: 16px;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
    user-select: none;
    white-space: nowrap;
    margin: 0 4px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
    align-items: center;
    gap: 6px;
}

.profile-badge:hover {
    background: linear-gradient(135deg, rgba(106, 44, 255, 0.25), rgba(106, 44, 255, 0.35));
    border-color: rgba(106, 44, 255, 0.6);
    transform: translateY(-1px);
}

.profile-badge-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.profile-badge-text {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* Tiptap specific overrides */
.tiptap p:has(.profile-badge) {
    display: inline;
}

.tiptap .profile-badge {
    display: inline-flex !important;
    width: auto !important;
    max-width: fit-content;
}

.profile-badge:focus {
    outline: none;
}

/* Badge animations */
@keyframes badgeInsert {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes badgeShake {
    0% { transform: translateY(0); }
    10% { transform: translateY(-4px); }
    20% { transform: translateY(0); }
    30% { transform: translateY(-3px); }
    40% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
    60% { transform: translateY(0); }
    70% { transform: translateY(-1px); }
    100% { transform: translateY(0); }
}

.profile-badge {
    animation: badgeInsert 0.15s ease-out;
}

.profile-badge.badge-shake {
    animation: badgeShake 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

