* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Темная тема */
    --bg-primary: #111111;
    --bg-secondary: #13131a;
    --bg-tertiary: #1c1c1c;
    --bg-card: rgba(25, 25, 35, 0.6);
    --bg-input: rgba(30, 30, 40, 0.8);
    
    --text-primary: #ffffff;
    --text-secondary: #e5e5e5;
    --text-tertiary: #6e6e73;
    
    --accent: #a855f7;
    --accent-hover: #9333ea;
    --accent-glow: rgba(168, 85, 247, 0.4);
    
    --gradient-1: #667eea;
    --gradient-2: #764ba2;
    --gradient-3: #f093fb;
    --gradient-4: #a855f7;
    
    --border: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.3);
}

* {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Глобально убираем все подсветки для интерактивных элементов */
button, input, a, select, textarea {
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    outline: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

button:focus, button:active, button:focus-visible,
input:focus, input:active, input:focus-visible,
a:focus, a:active, a:focus-visible,
select:focus, select:active, select:focus-visible,
textarea:focus, textarea:active, textarea:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: inherit !important;
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

a {
    text-decoration: none;
}

/* Убираем зону клика для всех интерактивных элементов */
a, button, input, textarea, select, [onclick], [role="button"], .clickable, 
.chat-item, .suggestion-chip, .attach-btn, .send-btn, .model-icon-btn,
.new-chat-btn, .subscription-btn, .chat-item-image, .message-image,
img, .attached-image-preview, .chat-item-content, 
.scroll-to-btn, .nav-back-btn, .close-sidebar-btn, .message-action-btn {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
    outline: none !important;
    -webkit-focus-ring-color: transparent;
    box-shadow: none;
}

/* Убираем outline и подсветку для всех состояний фокуса и активности */
a:focus, a:active, a:visited,
button:focus, button:active, button:focus-visible,
input:focus, input:active, input:focus-visible,
textarea:focus, textarea:active, textarea:focus-visible,
select:focus, select:active, select:focus-visible,
[onclick]:focus, [onclick]:active,
[role="button"]:focus, [role="button"]:active,
.clickable:focus, .clickable:active,
.chat-item:focus, .chat-item:active, .chat-item *:focus, .chat-item *:active,
.suggestion-chip:focus, .suggestion-chip:active,
.attach-btn:focus, .attach-btn:active,
.send-btn:focus, .send-btn:active,
.model-icon-btn:focus, .model-icon-btn:active,
.new-chat-btn:focus, .new-chat-btn:active,
.subscription-btn:focus, .subscription-btn:active,
.chat-item-image:focus, .chat-item-image:active,
.message-image:focus, .message-image:active,
.attached-image-preview:focus, .attached-image-preview:active,
.chat-item-content:focus, .chat-item-content:active,
.scroll-to-btn:focus, .scroll-to-btn:active,
.nav-back-btn:focus, .nav-back-btn:active,
.close-sidebar-btn:focus, .close-sidebar-btn:active,
.message-action-btn:focus, .message-action-btn:active,
img:focus, img:active, img:focus-visible {
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
    tap-highlight-color: transparent !important;
    -webkit-focus-ring-color: transparent !important;
    box-shadow: none !important;
    border-color: inherit !important;
}

/* Sidebar initially hidden on mobile */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: var(--bg-primary);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 199;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Collaba: скрытый DOM чата/медиа для app-web.js (модели, лимиты, списки) */
.collaba-legacy-ui {
    display: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

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

.app-container {
    display: flex;
    height: 100vh;
    position: relative;
    width: 100%;
}

 
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    width: 100%;
    background: var(--bg-tertiary);
}

 

.chat-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    padding: 0 16px;
    backdrop-filter: blur(2px) ;
    -webkit-backdrop-filter: blur(2px)  ;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
    background: linear-gradient(to bottom, #111111 0%, #11111100 100%);
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px
}

.nav-back-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 55px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.nav-back-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-back-btn:hover::before {
    opacity: 1;
}

.nav-back-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.05);
 
}

.nav-back-btn svg {
    position: relative;
    z-index: 1;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.nav-back-btn:hover svg {
    color: var(--accent);
}

.header-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
    pointer-events: none;
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.2); }
}

.chat-header .chat-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
    letter-spacing: -0.3px;
}

/* Limits Indicator */
.limits-indicator {
    position: relative;
    width: 24px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.limits-indicator:hover {
    transform: scale(1.1);
}

.progress-ring {
    transform: rotate(-90deg);
    width: 24px;
    height: 24px;
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}

.crown-icon {
    width: 24px;
    height: 24px;
 
    transition: all 0.3s ease;
 
}

.crown-icon:hover {
   
  
    transform: scale(1.05);
}

/* Limits Tooltip */
.limits-tooltip {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--bg-tertiary);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 240px;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
}

.limits-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.tooltip-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.tooltip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
 
}

.tooltip-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.tooltip-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.tooltip-btn {
    width: 100%;
    padding: 12px;
    background: #FFF;
    border: none;
    border-radius: 55px;
    color: var(--bg-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tooltip-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 80px 16px 100px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.chat-messages::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('bg_cht.png');
    background-position: center;
 display: none;
    filter: saturate(0.2) opacity(0.12);
    z-index: -1;
    pointer-events: none;
}

.chat-messages::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Empty State with Animated Gradient */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    position: relative;
    padding: 0px 20px 96px 20px;
}

 

.empty-icon {
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.empty-icon img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.empty-state h2 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 700;
    position: relative;
    z-index: 1;
    letter-spacing: -0.5px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

.empty-state--auth-quick {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.empty-chat-quick-actions {
    margin-top: 22px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    position: relative;
    z-index: 1;
}

.empty-chat-action-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-radius: 16px;
    background: #1e1e28cc;
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 12px 0px 33px -17px rgb(168 85 247 / 32%) inset;
}

.empty-chat-action-row:hover {
    background: #242424;
}

.empty-chat-action-row:active {
    transform: scale(0.99);
}

.empty-chat-action-thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: #111111;
}

.empty-chat-action-thumb img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    display: block;
}

.empty-chat-action-thumb--still img {
    object-position: 65% 45%;
}

.empty-chat-action-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.empty-chat-action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.empty-chat-action-desc {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.guest-feature-carousel-wrap--single {
    margin-top: 10px;
    margin-bottom: 4px;
}

.guest-feature-carousel--single {
    position: relative;
    padding-top: 40px;
}

.guest-feature-carousel-dismiss {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #f5f5f5);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.guest-feature-carousel-dismiss:hover {
    background: rgba(255, 255, 255, 0.2);
}

.guest-feature-carousel-track--single {
    width: 100% !important;
    transform: none !important;
    transition: none !important;
}

.guest-feature-slide--single {
    flex: 0 0 100% !important;
    max-width: 100%;
    box-sizing: border-box;
}

/* Messages */
.message {
    word-wrap: break-word;
    animation: messageAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent), #9333ea);
    color: #ffffff;
    border-radius: 20px 20px 2px 20px;
    max-width: 60%;
    padding: 10px 12px 12px 12px;
    position: relative;
}

.message-user::after {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message-user:hover::after {
    opacity: 1;
}

.message-user .message-content {
    font-size: 14px;
    line-height: 1.5;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 8px;

}

.message-retry-btn {
    margin-top: 6px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

.message-retry-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.message-retry-btn:active {
    transform: translateY(0);
}

.message-actions {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    margin-left: 8px;
}

.message-action-btn {
    padding: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.message-action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.message-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.message-action-btn:active {
    transform: translateY(0);
}

.message-image {
    display: block;
    margin-top: 8px;
    border-radius: 8px;
    max-width: 240px;
    max-height: 240px;
    object-fit: cover;
}

.message-assistant {
    align-self: flex-start;
  padding: 12px 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);

    max-width: 90%;
    
     
    position: relative;
    
}

.message.message-assistant.message-assistant-error .message-content {
    border-left: 3px solid #c62828;
    padding-left: 10px;
    margin-left: 2px;
}

.message-assistant .message-content h3  {

    margin-bottom: 12px;
}

.message-assistant .message-content hr  {

    margin: 12px 0;
    border: 1px solid var(--border);
}

.message-title {
 
    font-size: 14px;
    color: var(--text-primary);
 
  
}

.message-content {
    line-height: 1.5;
    font-size: 14px;
}

.message-assistant .message-content {
    color: var(--text-primary);
}

.message-assistant .message-content p {
    margin-bottom: 12px;
}

.message-assistant .message-content p:last-child {
    margin-bottom: 0;
}

.message-assistant .message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 14px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 12px 0;
    font-size: 13px;
    border: 1px solid var(--border);
}

.message-assistant .message-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--accent);
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.message-assistant .message-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.message-assistant .message-content ul,
.message-assistant .message-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.message-assistant .message-content li {
    margin: 6px 0;
}

/* Loading indicator */
.message.loading {
    background: transparent;
}

.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: typing 1.4s infinite;
    box-shadow: 0 0 8px var(--accent-glow);
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-12px) scale(1.2);
        opacity: 1;
    }
}

.dropdown-divider {
    border-top: 1px solid var(--border);
    margin: 8px 0;
}
 
.prompt-suggestions {
    position: fixed;
    bottom: 100px;
    left: 0;
    right: 0;
    padding: 0px 16px;
    display: none;
    gap: 8px;
    overflow-x: auto;
    z-index: 96;
    pointer-events: auto;
    touch-action: pan-x;
    scrollbar-width: none;
    -ms-overflow-style: none;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

 
@media (max-width: 480px) {
    .prompt-suggestions {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        padding: 12px 12px 2px 12px;
    }
}

.prompt-suggestions.with-attachments {
    bottom: 172px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.prompt-suggestions::-webkit-scrollbar {
    display: none;
}

.suggestion-chip {
    flex-shrink: 0;
    min-width: 108px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.01);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    text-align: left;
}

.suggestion-chip::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.suggestion-chip:hover::before {
    left: 100%;
}

.suggestion-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-3px) scale(1.02);
    border-color: var(--border);
}

.suggestion-chip:active {
    transform: translateY(-1px) scale(0.98);
}

.chip-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.9;
    color: var(--text-secondary);
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.2));
}

.chip-text {
    font-weight: 500;
    letter-spacing: -0.2px;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
    text-align: left;
    color: var(--text-secondary);
}

 
.attached-images-preview {
    position: fixed;
    bottom: 92px;
    left: 0;
    right: 0;
    padding: 0 24px 8px 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    z-index: 95;
    max-height: 240px;
    overflow-y: auto;
}

.attached-image-preview {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: 0 4px 12px var(--shadow);
}

.attached-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attached-image-preview .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: all 0.3s ease;
}

.attached-image-preview .remove-image:hover {
    background: #ff3b30;
    transform: scale(1.1);
}

/* Chat Input Container */
.chat-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background:linear-gradient(to top, #111111 0%, #11111100 100%);
    z-index: 100;
    padding: 12px 16px 8px 16px;
}

/* Выпадающий список моделей выше полосы промптов (промпты — отдельный слой в форме) */
.chat-input-form .input-wrapper {
    position: relative;
    z-index: 120;
}

/* Веб на узком экране: пункт «Процессы» в сайдбаре скрыт (отдельные мобильные клиенты не используют этот layout) */
@media (max-width: 768px) {
    body.chattix-web #workflowBtn {
        display: none !important;
    }
}

/* Кнопка прокрутки к началу/концу чата */
.scroll-to-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: rgba(36, 36, 36, 0.8) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #e5e5e5 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 101;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    margin: 0;
    padding: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Fallback для браузеров без backdrop-filter */
@supports not (backdrop-filter: blur(24px)) {
    .scroll-to-btn {
        background: rgba(36, 36, 36, 1);
    }
}

.scroll-to-btn.visible {
    opacity: 1;
    pointer-events: all;
}

.scroll-to-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #a855f7;
    transform: scale(1.1);
 
}

.scroll-to-btn:active {
    transform: scale(1);
}

.scroll-to-btn svg {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    transition: transform 0.3s ease;
    display: block;
    flex-shrink: 0;
}

.scroll-to-btn.scroll-to-top svg {
    transform: rotate(180deg);
}

.chat-input-form {
    width: 100%;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    background: rgb(36 36 36 / 80%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 28px;
    padding: 6px 6px 6px 6px;
    min-height: 50px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
    box-shadow: 0 0.5px 0px rgb(255 255 255 / 6%), inset 0 0.5px 0px rgba(255, 255, 255, 0.06);
}

.chat-char-counter {
    position: absolute;
    right: 56px; /* место под send button */
    bottom: 8px;
    font-size: 11px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.10);
    padding: 4px 8px;
    border-radius: 999px;
    pointer-events: none;
    user-select: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chat-char-counter.is-over {
    color: #ffb4b4;
    border-color: rgba(255, 0, 0, 0.25);
    background: rgba(120, 0, 0, 0.25);
}

.input-wrapper::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(to bottom right, #b8a1ff8f, #9840ebff);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.input-wrapper:focus-within::before {
    opacity: 0.15;
}

.input-wrapper:focus-within {

    transform: translateY(-2px);
}

.model-icon-btn {
    width: 102px;
    height: 38px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: start;
    border-radius: 55px;
    transition: all 0.3s 
cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
    overflow: visible;
    padding: 0 10px;
    gap: 6px;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.model-icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 55px;
}

.model-icon-btn:hover::before {
    opacity: 1;
}

.model-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.02);
    
}

.model-icon-btn.compact {
    width: 38px;
    padding: 0;
    border-radius: 55px;
    justify-content: center;
}

.model-icon-btn.compact .model-type-label {
    display: none;
}

.model-icon-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.model-icon-btn svg path {
    fill: var(--text-secondary);
    transition: fill 0.3s ease;
}

.model-icon-btn:hover svg path {
    fill: var(--accent);
}

.model-type-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    max-width: 80px;
    font-weight: 500;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.input-mode-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    margin-top: 6px;
    padding: 2px 8px;
}

.chat-input-form textarea {
    flex: 1;
    padding: 8px 4px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 200px;
    line-height: 22px;
    -webkit-text-size-adjust: 100%;
}

.chat-input-form textarea::placeholder {
    color: var(--text-tertiary);
}

.chat-input-form textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attach-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.attach-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.attach-btn:hover::before {
    opacity: 1;
}

.attach-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.1);
   
}

.attach-btn svg {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
}

.attach-btn svg path {
    fill: var(--text-secondary);
    transition: fill 0.3s ease;
}

.attach-btn:hover svg path {
    fill: var(--accent);
}

.send-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: #FFF;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2), inset 0 1px 1px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.send-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.input-wrapper:focus-within .send-btn:not(:disabled)::before {
    transition: none;
}

.send-btn:not(:disabled):hover::before {
    left: 100%;
}

.send-btn:not(:disabled):focus {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(192, 138, 242, 0.2), 0 0 30px rgba(168, 86, 248, 0.2);
}

.send-btn:not(:disabled):active {
    transform: scale(0.95) rotate(5deg);;
}

/* Эффекты когда инпут активен и кнопка отправки тоже активна */
.input-wrapper:focus-within .send-btn:not(:disabled) {
    transform: scale(1.1) rotate(5deg);
  
}

.input-wrapper:focus-within .send-btn:not(:disabled)::before {
    animation: shimmer 0.5s ease-in-out;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
    100% {
        left: -100%;
    }
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.send-btn svg {
    width: 28px;
    height: 28px;
    position: relative;
    z-index: 1;
}

/* Model Selector Dropdown */
.model-selector-dropdown {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    background: var(--bg-tertiary);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 220px;
    max-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.model-selector-dropdown.show {
    display: block;
    animation: dropdownAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.model-selector-hint {
    position: absolute;
    left: 10px;
    bottom: calc(100% + 10px);
    width: min(320px, calc(100vw - 32px));
    min-width: 220px;
    display: none;
    z-index: 1001;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.model-selector-hint.show {
    display: block;
}

.model-selector-hint::after {
    content: '';
    position: absolute;
    left: 26px;
    bottom: -8px;
    width: 14px;
    height: 14px;
    background: #fff;
    transform: rotate(45deg);
    border-radius: 2px;
}

.model-selector-hint-close {
    z-index: 2;
}

.model-selector-hint.chattix-onboarding-popover {
    background: #fff;
    color: #1b1b1b;
}

.model-selector-hint .chattix-onboarding-meta {
    color: #5b6472;
}

.model-selector-hint .chattix-onboarding-text {
    color: #1b1b1b;
}

.model-selector-hint .model-selector-hint-close {
    color: #5b6472;
}

.model-selector-hint .model-selector-hint-close:hover {
    background: rgba(0, 0, 0, 0.08);
}

@keyframes dropdownAppear {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 768px) {
    .model-selector-hint {
        left: 0;
        width: min(300px, calc(100vw - 24px));
    }
}

 

.dropdown-list {
    padding: 8px;
}

.dropdown-item {
    padding: 12px 12px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    text-align: left;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

a.dropdown-item {
    display: block;
    text-decoration: none;
    color: inherit;
}

a.dropdown-item:hover {
    color: var(--text-primary);
}

.dropdown-item.active {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent);
    font-weight: 600;
}

.dropdown-item--locked {
    opacity: 0.55;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dropdown-item--locked:hover {
    background: rgba(255, 255, 255, 0.03);
}

.dropdown-item__lock {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-left: auto;
}

 
.dropdown-item--locked[data-tooltip] {
    position: relative;
}

.dropdown-item--locked[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: rgba(20, 20, 30, 0.96);
    color: #e0e0e0;
    font-size: 11px;
    line-height: 1.4;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.dropdown-item--locked[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateY(0);
}

.dropdown-separator {
    padding: 12px 12px 8px 12px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

/* Sidebar Header */
.sidebar-header {
    padding: 16px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
 
}

.sidebar-header-content {
    display: flex;
    align-items: center;
    gap: 4px;
}



.sidebar-header h1,
.sidebar-brand {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    margin: 0;
}

.sidebar-logo-img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: block;
}

/* Sidebar nav (пункты с иконками) */
.sidebar-nav {
    padding: 2px 16px 16px;
    flex-shrink: 0;
}

.sidebar-nav-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 36px;
    padding: 9px 0;
    border: none;
    border-radius: 55px;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
    text-decoration: none;
}

.sidebar-nav-item:hover {
    color: #fff;
}

.sidebar-nav-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sidebar-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(229, 229, 229, 1);
}

.sidebar-nav-icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-nav-label {
    flex: 1;
    min-width: 0;
}

.sidebar-nav-plus-btn {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.sidebar-nav-plus-btn:hover {
    opacity: 0.9;
}

.sidebar-nav-plus-btn svg {
    width: 16px;
    height: 16px;
}

.sidebar-nav-badge {
    flex-shrink: 0;
    padding: 2px 5px;
    border-radius: 55px;
    background: rgba(121, 61, 252, 1);
    color: rgba(229, 229, 229, 1);
    font-size: 10px;
    font-weight: 400;
}

.sidebar-nav-divider {
    height: 1px;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.08);
}



.close-sidebar-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.1);
}

.close-sidebar-btn svg {
    color: var(--text-primary);
}

/* Subscription Section (legacy / reused for other modals) */
.subscription-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 55px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.subscription-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
    transform: translateY(-1px);
}

.subscription-btn:active {
    transform: translateY(0);
}


/* Chats Section */
.chats-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 16px;
}

.chats-section-header {
    padding: 12px 0 12px 0;
    flex-shrink: 0;
}

.chats-section-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: -0.5px;
    margin: 0;
}

/* Chats List */
.chats-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 12px;
}

.chats-list::-webkit-scrollbar {
    width: 6px;
}

.chats-list::-webkit-scrollbar-track {
    background: transparent;
}

.chats-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.chats-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}


.guest-feature-carousel-mount {
    flex-shrink: 0;
}

.guest-feature-carousel-wrap {
    margin-top: 10px;
    margin-bottom: 4px;
}

.guest-feature-carousel {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 12px 12px 14px;
    overflow: hidden;
    margin: 16px;
}

.guest-feature-carousel-viewport {
    overflow: hidden;
    width: 100%;
    border-radius: 12px;
}

.guest-feature-carousel-track {
    display: flex;
    width: 300%;
    transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

.guest-feature-slide {
    flex: 0 0 33.333333%;
    box-sizing: border-box;
    padding: 0 2px;
}

.guest-feature-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 15t0px;
    border-radius: 10px;
    overflow: hidden;
    background: #111111;
    margin-bottom: 16px;
}

.guest-feature-gif {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.guest-feature-title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--bg-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.guest-feature-desc {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--bg-primary);
}

.guest-feature-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 2px;
}

.guest-feature-dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--text-secondary);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.guest-feature-dot:hover {
    background: rgba(255, 255, 255, 0.4);
}

.guest-feature-dot.is-active {
    background: var(--bg-primary);
    transform: scale(1.25);
}

.chat-item {
    padding: 2px 0px 2px 0px;
    margin-bottom: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}


.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item-title:hover {
    color: var(--accent);
 
}

.chat-item-title:active {
    color: var(--accent);
 
}

.chat-item-delete {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 55px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-item:hover .chat-item-delete {
    opacity: 1;
}

.chat-item-delete:hover {
    background: rgba(255, 59, 48, 0.15);
}

.chat-item-delete svg {
    color: var(--text-tertiary);
}

.chat-item-delete:hover svg {
    color: #ff3b30;
}

 
.sidebar-user-block {
    padding: 12px 16px;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.logout-icon-btn {
    opacity: 1;
}

.user-info-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.copy-user-id-btn {
    width: 12px;
    height: 12px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.copy-user-id-btn:hover {
    opacity: 1;
}

.copy-user-id-btn svg {
    width: 12px;
    height: 12px;
    color: var(--text-tertiary);
}

.user-id {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Кнопка выхода (иконка) */
.logout-icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 1;
}

.logout-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
}

.logout-icon-btn:active {
    transform: scale(0.95);
}

.logout-icon-btn svg {
    color: #6e6e73;
}

.settings-btn-wrapper {
    position: relative;
}

.settings-dropdown {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background: var(--bg-tertiary);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 200px;
    max-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.settings-dropdown.show {
    display: block;
    animation: dropdownAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Кнопка входа в блоке пользователя */
.user-login-btn {
    flex: 1;
    padding: 10px 16px;
    background: #fff;
    border: none;
    border-radius: 55px;
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.user-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.user-login-btn:active {
    transform: translateY(0);
}

/* Стили для SVG иконки в заглушке аватара */
.user-avatar svg {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
}

/* Responsive - убираем все media queries для десктопа */
@media (max-width: 480px) {
    .chat-header {
        padding: 0 16px;
    }
    
    .empty-icon img {
        width: 64px;
        height: 64px;
    }
    
    .empty-state h2 {
        font-size: 20px;
    }
    
    .empty-state p {
        font-size: 14px;
    }
    
    .suggestion-chip {
        font-size: 11px;
        padding: 10px 10px;
        min-width: 104px;
        gap: 8px;
        align-items: center;
    }
    
    .chip-icon {
        width: 16px;
        height: 16px;
        color: var(--text-secondary);
    }
}

/* Paywall */
.paywall {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.paywall.show {
    opacity: 1;
    visibility: visible;
}

.paywall-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.paywall-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUpFade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.paywall-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.paywall-close:hover {
    background: rgba(255, 59, 48, 0.2);
    transform: scale(1.1);
}

.paywall-close svg {
    color: var(--text-primary);
}

.paywall-header {
    text-align: center;
    margin-bottom: 32px;
}

.paywall-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.paywall-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--accent), var(--gradient-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.paywall-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Pricing Cards */
.pricing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.pricing-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.pricing-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(168, 85, 247, 0.3);
}

.pricing-card.popular {
    border-color: var(--accent);
    box-shadow: 0 8px 32px rgba(168, 85, 247, 0.2);
}

.card-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.popular-badge {
    background: linear-gradient(135deg, var(--accent), #9333ea);
    color: white;
    border: none;
}

.save-badge {
    background: linear-gradient(135deg, #ff9500, #ff6b35);
    color: white;
    border: none;
}

.pricing-card h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    margin-top: 8px;
}

.card-price {
    margin-bottom: 24px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.card-price .price {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-price .period {
    font-size: 14px;
    color: var(--text-secondary);
}

.card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    flex: 1;
}

.card-features li {
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-features li:last-child {
    border-bottom: none;
}

.card-btn {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
}

.card-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.card-btn.primary {
    background: linear-gradient(135deg, var(--accent), #9333ea);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.card-btn.primary:hover {
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
}

.card-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.card-btn.disabled:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.06);
}

 

.promocode-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.promocode-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.promocode-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.promocode-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.promocode-apply-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.promocode-message:empty {
    display: none;
}

.promocode-section {
    margin-top: 32px;
    padding-top: 24px;
}

.promocode-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.promocode-divider::before,
.promocode-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.promocode-divider span {
    padding: 0 16px;
}

.promocode-input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.promocode-input {
    flex: 1;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
}

.promocode-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.promocode-input::placeholder {
    color: var(--text-secondary);
}

.promocode-apply-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.promocode-apply-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.promocode-apply-btn:active {
    transform: scale(0.98);
}

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

.promocode-message {
    display: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    animation: slideDown 0.3s ease;
}

.promocode-message.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.promocode-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive для пейвола */
@media (max-width: 768px) {
    .paywall-content {
        padding: 24px 16px;
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .pricing-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .paywall-header h2 {
        font-size: 24px;
    }
    
    .paywall-icon {
        font-size: 48px;
    }
}

/* Dark mode optimization */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--bg-primary);
    }
}

/* Image Viewer Modal */
.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-viewer.show {
    opacity: 1;
    visibility: visible;
}

.image-viewer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.image-viewer-content {
    position: relative;
    width: 95%;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    animation: imageViewerAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes imageViewerAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-viewer-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.image-viewer-close svg {
    color: var(--text-primary);
}

#imageViewerImg {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.image-viewer-actions {
    margin-top: 32px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.image-viewer-save {
    padding: 12px 32px;
    background: #FFF;
    border: none;
    border-radius: 55px;
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.image-viewer-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.image-viewer-save:active {
    transform: translateY(0);
}

.image-viewer-save svg {
    width: 20px;
    height: 20px;
}

.image-viewer-share {
    padding: 12px 32px;
    background: #FFF;
    border: none;
    border-radius: 55px;
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.image-viewer-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.image-viewer-share:active {
    transform: translateY(0);
}

.image-viewer-share svg {
    width: 20px;
    height: 20px;
}

.message-image {
    cursor: pointer;
    transition: all 0.3s ease;
}

.message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Responsive для просмотра изображений */
@media (max-width: 768px) {
    .image-viewer-close {
        top: 8px;
        width: 36px;
        height: 36px;
    }
    
    #imageViewerImg {
        max-height: 75vh;
    }
    
    .image-viewer-save,
    .image-viewer-share {
        padding: 12px 44px;
        font-size: 14px;
    }
}

/* ==================== МОДАЛЬНОЕ ОКНО АВТОРИЗАЦИИ ==================== */

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.auth-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-modal-content {
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 24px;
    padding: 40px 32px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: slideUp 0.3s ease;
    z-index: 10001;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-modal-icon {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.auth-modal-icon img {
    width: 72px;
    height: 72px;
}

.auth-modal-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px 0;
    background: linear-gradient(135deg, #fff 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-modal-header p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.5;
}

.auth-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Стили для Telegram Login Widget */
.auth-modal-body iframe {
    border-radius: 12px !important;
    overflow: hidden;
}

/* Дополнительная информация */
.auth-modal-info {
    margin-top: 20px;
    padding: 16px;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 12px;
    text-align: center;
}

.auth-modal-info p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.5;
}

/* New Auth Modal Styles (в стиле paywall) */
.auth-modal-content-new {
    position: relative;
    background: #000;
    border-radius: 20px 20px 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 95vh;
    width: 100%;
    z-index: 1001;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    animation: paywallSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-modal:has(.auth-modal-content-new) {
    align-items: flex-end;
}

.auth-modal-header-img {
    height: 280px;
    background-size: cover;
    background-position: center;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex-shrink: 0;
    overflow: hidden;
}

.auth-modal-header-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(17,17,17,1));
    z-index: 1;
}

.auth-slider {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.auth-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.auth-slide.active {
    opacity: 1;
}

.auth-modal-content-new .auth-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(5px);
    z-index: 100;
    flex-shrink: 0;
}

.auth-modal-title-container {
    position: relative;
    z-index: 10;
    text-align: center;
}

.auth-modal-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 16px 0;
    padding: 0px 82px;
    line-height: 1.2;
}

.auth-modal-subtitle {
    font-size: 15px;
    opacity: 0.8;
    margin: 0;
    padding: 0px 32px;
    line-height: 1.5;
}

.auth-modal-body {
    padding: 32px 20px 20px 20px;
    background: #111;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#ahemlk .VkIdWebSdk__button_ahemlk {
    border-radius: 55px !important;
        height: 40px;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.auth-btn-wrap {
    width: 100%;
    height: 40px;
    border-radius: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-btn-wrap .telegram-login-widget,
.auth-btn-wrap .vkid-login-container {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-btn-wrap iframe {
    max-height: 100%;
}

.telegram-login-widget,
.vkid-login-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.auth-btn {
    width: 100%;
    height: 40px;
    padding: 0 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 55px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.auth-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn-white {
    background: #fff;
    color: #111;
    border: none;
}

.auth-btn-white:hover {
    background: rgba(255, 255, 255, 0.95);
    border: none;
}

.auth-btn svg {
    flex-shrink: 0;
}

.auth-modal-consent {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 24px 0;
    line-height: 1.5;
    text-align: center;
        padding: 0px 64px;
}

.auth-modal-consent a {
    color: rgba(255, 255, 255, 0.85);
 
}

.auth-modal-consent a:hover {
    color: #fff;
}

.auth-modal-footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px 44px;
    margin-top: 0;
    padding-top: 24px;
}

.auth-modal-footer-links a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s;
}

.auth-modal-footer-links a:hover {
    color: #fff;
}

@media (min-width: 768px) {
    .auth-modal:has(.auth-modal-content-new) {
        align-items: center;
    }
    .auth-modal-content-new {
        max-width: 450px;
        border-radius: 24px;
        max-height: 85vh;
    }
    .auth-modal-header-img {
        height: 320px;
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 640px) {
    .auth-modal {
        padding: 0;
    }
    
    .auth-modal-content {
        padding: 32px 24px;
        border-radius: 20px;
    }
    
    .auth-modal-header h2 {
        font-size: 24px;
    }
    
    .auth-modal-header p {
        font-size: 14px;
    }
    
    .auth-modal-icon img {
        width: 64px;
        height: 64px;
    }
}

/* Разделитель "или" */
.auth-divider {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 8px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.auth-divider span {
    padding: 0 16px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 500;
    text-transform: lowercase;
}

/* Кнопка входа через Яндекс ID - теперь использует .auth-btn */

/* Адаптивность кнопки Яндекс для мобильных */
@media (max-width: 640px) {
    .yandex-login-btn {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Desktop Layout - Всегда открытая панель для веб-версии */
@media (min-width: 1024px) {
    .app-container {
        display: flex;
    }
    
    .sidebar {
        width: 320px;
        transform: translateX(0);
        position: relative;
        flex-shrink: 0;
    }
    
    .sidebar-overlay {
        display: none;
    }
    
    .close-sidebar-btn {
        display: none;
    }
    
    .chat-main {
        flex: 1;
        margin-left: 0;
        min-width: 0;
    }
    
    .nav-back-btn {
        display: none;
    }
    
 
    .chat-header {
        left: 320px;
    }
    
    .chat-input-container {
        left: 320px;
    }
    
    .prompt-suggestions {
        left: 320px;
    }
    
    .attached-images-preview {
        left: 320px;
    }
    
 
    .prompt-suggestions {
        padding: 8px 132px;
    }
    
    .chat-messages {
        padding: 80px 132px 100px 132px;
    }
    
    .chat-input-container {
        padding: 12px 132px 8px 132px;
    }

    .attached-images-preview {
    padding: 0 132px 8px 132px;
    }
}

/* Tablet & Desktop - wider sidebar on mobile landscape */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar {
        width: 360px;
    }
}

body.workflow-screen-active .sidebar {
    transform: translateX(-100%) !important;
    position: fixed !important;
    width: 320px;
    max-width: 85vw;
}
body.workflow-screen-active .sidebar.open {
    transform: translateX(0) !important;
}
body.workflow-screen-active .sidebar.open ~ #workflowMain {
    margin-left: 320px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
body.workflow-screen-active #workflowMain .nav-back-btn {
    display: flex;
}

/* Collaba / воркфлоу: оверлей чат-сайдбара не используется и не должен перекрывать канвас */
body.workflow-screen-active .sidebar-overlay,
body.workflow-share-view .sidebar-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Payment Modal */
.payment-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.payment-modal.show {
    opacity: 1;
    visibility: visible;
}

.payment-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.payment-modal-content {
    position: relative;
    background: #FFF;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUpFade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.payment-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.payment-modal-close:hover {
    background: rgba(255, 59, 48, 0.2);
    transform: scale(1.1);
}

.payment-modal-close svg {
    color: var(--text-primary);
}

.payment-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.payment-modal-header h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.payment-widget-container {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#payment-form {
    width: 100%;
    min-height: 400px;
}

/* Responsive для payment modal */
@media (max-width: 768px) {
    .payment-modal-content {
        width: 95%;
        padding: 24px 16px;
        max-height: 95vh;
    }
    
    .payment-modal-header h3 {
        font-size: 20px;
    }
    
    .payment-widget-container {
        min-height: 350px;
    }
}

/* Attachment Menu */
.attach-wrapper {
    position: relative;
    display: flex;
}

.attach-menu {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    background: var(--bg-tertiary);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 160px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
}

.attach-menu.show {
    display: flex;
    animation: menuAppear 0.2s ease-out;
}

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.attach-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.attach-menu-item svg {
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}

.attach-menu-item:hover svg {
    color: var(--accent);
}
/* New Paywall Styles */
.paywall-content-new {
    position: relative;
    background: #000;
    border-radius: 20px 20px 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 95vh;
    width: 100%;
    z-index: 1001;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    animation: paywallSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes paywallSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.paywall:has(.paywall-content-new) {
    align-items: flex-end;
}

.paywall-header-img {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex-shrink: 0;
    border-radius: 16px 16px 0px 0px;
}

.paywall-header-img::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(17,17,17,1));
}

.paywall-content-new .paywall-close {
    position: sticky;
    top: 15px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(5px);
    z-index: 100;
    align-self: flex-end;
    margin: 15px 15px 0 0;
    flex-shrink: 0;
}

.paywall-title-container {
    position: relative;
    z-index: 2;
    text-align: center;
}

.paywall-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.paywall-subtitle {
    font-size: 14px;
    opacity: 0.8;
    margin: 0;
    line-height: 1.4;
    padding: 0 12px;
}

.paywall-body {
    padding: 24px;
    padding-bottom: 0;
    background: #111;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.plan-selectors {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
}

.plan-selector {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.plan-selector.selected {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.plan-selector input[type="radio"] {
    display: none;
}

.plan-selector-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.plan-selector.selected .plan-selector-check {
    background: #fff;
    border-color: #fff;
}

.check-icon {
    color: #000;
    display: none;
}

.plan-selector.selected .check-icon {
    display: block;
}

.plan-selector-info {
    flex: 1;
}

.plan-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.plan-meta {
    display: block;
    font-size: 13px;
    opacity: 0.5;
}

.plan-selector-price {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.price {
    font-size: 16px;
    font-weight: 700;
}

.best-value {
    background: #9333ea;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.plan-features-header {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.plan-features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-features-note {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    margin: 0 0 20px 0;
    padding: 0;
    line-height: 1.4;
}

.plan-features-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.feature-icon {
    color: #fff;
    font-weight: bold;
    flex-shrink: 0;
    width: 14px;
    display: flex;
    justify-content: center;
}

.feature-text {
    opacity: 0.9;
}

.get-access-btn {
    background: #fff;
    color: #000;
    border: none;
    border-radius: 55px;
    padding: 16px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s;
    margin-bottom: 20px;
    width: 100%;
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    margin-top: auto;
}


.get-access-btn:active {
    transform: scale(0.98);
}

.paywall-footer-links {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: auto;
    padding-bottom: 12px;
}

.paywall-footer-links a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s;
}

.paywall-footer-links a:hover {
    color: #fff;
}

.paywall-tokens-explanation {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
}

.paywall-tokens-explanation-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    gap: 8px;
}

.paywall-tokens-explanation-toggle:hover {
    color: #fff;
}

.paywall-tokens-explanation-toggle .toggle-icon {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.paywall-tokens-explanation-toggle.open .toggle-icon {
    transform: rotate(180deg);
}

.paywall-tokens-explanation-content {
    padding: 12px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.paywall-tokens-explanation-content p {
    margin: 0 0 8px;
}

.paywall-tokens-explanation-content p:last-of-type {
    margin-bottom: 0;
}

.paywall-tokens-explanation-content ul {
    margin: 4px 0 8px;
    padding-left: 18px;
}

.paywall-tokens-explanation-content li {
    margin-bottom: 4px;
}

.paywall-tokens-note {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8px;
    padding-bottom: 16px;
}


.tokens-note-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tokens-note-list li {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
    padding-left: 12px;
    position: relative;
}

.tokens-note-list li::before {
    content: '-';
    position: absolute;
    left: 0;
    color: rgba(255, 255, 255, 0.3);
}

@media (min-width: 768px) {
    .paywall:has(.paywall-content-new) {
        align-items: center;
    }
    .paywall-content-new {
        max-width: 480px;
        border-radius: 24px;
        max-height: 95vh;
    }
}


.video-container {
    display: block;
    height: calc(100vh - 0px);
    overflow-y: auto;
    background: var(--bg-tertiary);
}

.video-list-container {
    padding: 0;
}

.video-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.video-list-sentinel {
    grid-column: 1 / -1;
    height: 1px;
    visibility: hidden;
    pointer-events: none;
}

.empty-video-list {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
    font-size: 14px;
}

 
.video-card {
    background: var(--bg-primary);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.video-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: var(--bg-secondary);
    overflow: hidden;
    border-radius: 16px;
    cursor: pointer;
}

.video-card-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-card-thumb-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2;
    transition: opacity 0.2s ease;
}

.video-card-thumb-loader.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.video-card-thumb-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.video-card-play-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
}

.video-card-thumb:hover .video-card-play-icon,
.video-card-thumb:focus-within .video-card-play-icon {
    opacity: 0.9;
}

.video-card-icon-play,
.video-card-icon-pause {
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-card-icon-pause {
    display: none;
}
.video-card-thumb.is-playing .video-card-icon-play {
    display: none;
}
.video-card-thumb.is-playing .video-card-icon-pause {
    display: flex;
}

.video-card-play-icon svg {
    width: 20px;
    height: 20px;
}
.video-card-icon-play svg {
    margin-left: 2px;
}

.video-card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 13px;
}

.video-card-placeholder--processing .spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.video-card-placeholder--error {
    color: var(--text-tertiary);
}

.video-card-placeholder--error svg,
.video-card-load-error svg {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.video-card-placeholder--error .video-card-placeholder-text,
.video-card-load-error .video-card-placeholder-text {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
    max-width: 90%;
    color: var(--text-tertiary);
}

.video-card-load-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    font-size: 13px;
}

.video-card-placeholder--no-preview svg {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.video-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    min-height: 44px;
}

.video-card-model {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.video-card-download {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-card-download svg {
    width: 24px;
    height: 24px;
}

.video-card-download:hover {
    opacity: 0.9;
}

.video-card-download:active {
    transform: scale(0.98);
}

/* Legacy: оставляем для любых оставшихся ссылок на старые классы */
.video-item-status.processing { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.video-item-status.completed { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.video-item-status.error { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.video-download-btn {
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    background: #ffffff;
    color: var(--bg-primary);
    border: none;
    cursor: pointer;
}
.video-processing { display: flex; flex-direction: column; align-items: center; padding: 24px; gap: 12px; }
.video-processing .spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.video-processing p { margin: 0; font-size: 14px; color: var(--text-secondary); text-align: center; }
.video-error { padding: 12px; background: rgba(239, 68, 68, 0.1); border-radius: 8px; color: #f87171; font-size: 14px; }

.video-options-container {
    display: none;
    flex-direction: row;
    gap: 10px;
    margin-top: 8px;
    width: 100%;
    padding: 0 8px;
}

.video-option-group {
    flex: 1;
    min-width: 0;
}

.video-option-group label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.video-option-group select {
    width: 100%;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    padding: 0 10px;
    font-size: 13px;
    cursor: pointer;
}

.video-option-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.message-video {
    max-width: 320px;
    max-height: 320px;
    border-radius: 8px;
    margin-top: 8px;
}

@media (max-width: 1100px) {
    .video-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .video-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .video-container {
        padding: 44px 8px 16px 8px;
    }
    
    .video-list-container {
        padding: 0;
    }
    
    .video-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .video-card-footer {
        padding: 8px 10px;
    }
}

.images-container {
    display: block;
    height: calc(100vh - 0px);
    overflow-y: auto;
 
    background: var(--bg-tertiary);
}

.image-list-container {
    padding: 0;
}

.image-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.image-list-sentinel {
    grid-column: 1 / -1;
    height: 1px;
    visibility: hidden;
    pointer-events: none;
}

.empty-image-list {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-primary);
    font-size: 14px;
}

.image-card {
    background: var(--bg-primary);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.image-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--bg-primary);
    overflow: hidden;
    border-radius: 16px;
    cursor: pointer;
}

.image-card-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s ease;
}

.image-card-thumb-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2;
    transition: opacity 0.2s ease;
}

.image-card-thumb-loader.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.image-card-thumb-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.image-card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 13px;
}

.image-card-placeholder--no-preview svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    opacity: 0.4;
}

.image-card-load-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    font-size: 13px;
}

.image-card-load-error svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    opacity: 0.5;
}

.image-card-placeholder-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
    max-width: 90%;
    color: var(--text-tertiary);
}

.image-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 12px;
    min-height: 44px;
}

.image-card-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.image-card-insert {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.45);
    border: none;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-card-insert svg {
    width: 24px;
    height: 24px;
    display: block;
}

.image-card-insert:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.65);
    opacity: 0.95;
}

.image-card-insert:active:not(:disabled) {
    transform: scale(0.98);
}

.image-card-insert:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.image-card-download {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-card-download svg {
    width: 24px;
    height: 24px;
}

.image-card-download:hover {
    opacity: 0.9;
}

.image-card-download:active {
    transform: scale(0.98);
}

@media (max-width: 1100px) {
    .image-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .image-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .images-container {
        padding: 44px 8px 16px 8px;
    }

    .image-list-container {
        padding: 0;
    }

    .image-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .image-card-footer {
        padding: 8px 10px;
    }
}

.image-source-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-source-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.image-source-modal-content {
    position: relative;
    width: min(720px, calc(100vw - 24px));
    max-height: min(80vh, 720px);
    background: #151515;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-source-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 10px;
}

.image-source-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.image-source-modal-close {
    border: none;
    background: transparent;
    color: #b9b9b9;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.image-source-modal-actions {
    display: flex;
    gap: 8px;
    padding: 0 14px 12px;
}

.image-source-action-btn {
    border: 1px solid #2f2f2f;
    background: #1d1d1d;
    color: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
}

.image-source-gallery {
    padding: 0 14px 14px;
    overflow: hidden;
}

.image-source-gallery-inner {
    max-height: min(56vh, 560px);
    min-height: 320px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding-right: 2px;
}

.image-source-item {
    border: 1px solid #2f2f2f;
    background: #1d1d1d;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    color: #fff;
    text-align: left;
}

.image-source-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.image-source-item-skeleton {
    border: 1px solid #2f2f2f;
    background: #1d1d1d;
    cursor: default;
}

.image-source-item-skeleton-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(90deg, #1f1f1f 25%, #2a2a2a 37%, #1f1f1f 63%);
    background-size: 400% 100%;
    animation: image-source-skeleton-shimmer 1.2s ease-in-out infinite;
}

@keyframes image-source-skeleton-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

.image-source-empty {
    grid-column: 1 / -1;
    color: #9f9f9f;
    text-align: center;
    padding: 20px 0;
    font-size: 13px;
}

@media (max-width: 640px) {
    .image-source-gallery-inner {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Animate Photo Modal — по макету Figma */
.animate-photo-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.animate-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.animate-photo-content {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: #1b1b1b;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.animate-photo-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 16px 24px;
    flex-shrink: 0;
}

.animate-photo-title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #fff;
}

.animate-photo-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: background 0.2s;
}

.animate-photo-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.animate-photo-body {
    padding: 0 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.animate-photo-upload {
    position: relative;
    min-height: 200px;
    border-radius: 16px;
    background: #252525;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
}

.animate-photo-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: #6e6e73;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
}

.animate-photo-upload-icon {
    flex-shrink: 0;
}

.animate-photo-media-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #252525;
}

.animate-photo-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.animate-photo-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.animate-photo-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: background 0.2s;
}

.animate-photo-play-overlay:hover {
    background: rgba(0, 0, 0, 0.5);
}

.animate-photo-play-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #101010;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.animate-photo-play-icon svg {
    width: 40px;
    height: 40px;
    margin-left: 4px;
}

.animate-photo-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 16px;
}

.animate-photo-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.animate-photo-prompts {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    justify-content: center;
}

.animate-photo-prompt-chip {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #252525;
    color: #6e6e73;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.animate-photo-prompt-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.animate-photo-prompt-chip:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.animate-photo-prompt-label {
    padding: 4px;
}

.animate-photo-input-row {
    flex-shrink: 0;
    padding: 0 16px 16px;
}

.animate-photo-input-wrap {
    position: relative;
    height: 112px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #252525;
    overflow: hidden;
}

.animate-photo-input {
    position: absolute;
    left: 16px;
    right: 56px;
    top: 16px;
    width: calc(100% - 72px);
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    outline: none;
    resize: none;
}

.animate-photo-input::placeholder {
    color: #6e6e73;
}

.animate-photo-submit-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #000;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.animate-photo-submit-btn:hover:not(:disabled) {
    opacity: 0.9;
}

.animate-photo-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.animate-photo-submit-btn svg {
    width: 28px;
    height: 28px;
}

.animate-photo-actions {
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    padding: 0 16px 16px;
}

.animate-photo-action-btn {
    flex: 1;
    padding: 14px 20px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
}

.animate-photo-action-btn:first-child {
    background: var(--accent);
    color: #fff;
}

.animate-photo-action-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.animate-photo-action-btn:hover {
    opacity: 0.9;
}

@media (max-width: 480px) {
    .animate-photo-modal {
        padding: 12px;
       
    }
    .animate-photo-content {
        max-height: 85vh;
        border-radius: 20px 20px 20px 20px;
    }
    .animate-photo-body {
        padding: 16px;
    }
    .animate-photo-upload {
        min-height: 180px;
    }
}

/* Edit Photo Modal — тот же дизайн, что и Оживить фото; пресеты: иконки + разделитель + превью */
.edit-photo-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.edit-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.edit-photo-content {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: #1b1b1b;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}
.edit-photo-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 16px 24px;
    flex-shrink: 0;
}
.edit-photo-title { margin: 0; font-size: 18px; font-weight: 500; color: #fff; }
.edit-photo-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.edit-photo-close:hover { background: rgba(255, 255, 255, 0.25); }
.edit-photo-body {
    padding: 0 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.edit-photo-upload {
    position: relative;
    min-height: 200px;
    border-radius: 16px;
    background: #252525;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
}
.edit-photo-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: #6e6e73;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
}
.edit-photo-upload-icon { flex-shrink: 0; }
.edit-photo-media-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #252525;
}
.edit-photo-preview, .edit-photo-result {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.edit-photo-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 16px;
}
.edit-photo-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.edit-photo-prompts-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
    padding-bottom: 16px;
}
.edit-photo-prompts-arrow {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 55px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.edit-photo-prompts-arrow:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.edit-photo-prompts-arrow:disabled,
.edit-photo-prompts-arrow.hidden {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
.edit-photo-prompts-arrow svg {
    width: 20px;
    height: 20px;
}
.edit-photo-prompts {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
    align-items: center;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.edit-photo-prompts::-webkit-scrollbar {
    display: none;
}
.edit-photo-prompt-chip {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #252525;
    color: #6e6e73;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}
.edit-photo-prompt-chip-icon {
    padding: 6px 4px;
}
.edit-photo-prompt-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.edit-photo-prompt-icon svg {
    width: 28px;
    height: 28px;
}
.edit-photo-prompt-label {
    padding: 2px 0 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.edit-photo-prompt-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.edit-photo-prompt-chip-preview {
    padding: 0;
}
.edit-photo-prompt-chip-preview img {
    display: block;
}
.edit-photo-prompt-chip:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.edit-photo-prompts-divider {
    flex-shrink: 0;
    width: 1px;
    height: 64px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 4px;
}
@media (max-width: 767px) {
    .edit-photo-prompts-arrow {
        display: none;
    }
}
.edit-photo-input-row {
    flex-shrink: 0;
    padding: 0 16px 16px;
}
.edit-photo-input-wrap {
    position: relative;
    height: 112px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #252525;
    overflow: hidden;
}
.edit-photo-input {
    position: absolute;
    left: 16px;
    right: 56px;
    top: 16px;
    bottom: 16px;
    width: calc(100% - 72px);
    height: calc(100% - 32px);
    padding: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    resize: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    font-family: inherit;
}
.edit-photo-input::placeholder { color: #6e6e73; }
.edit-photo-submit-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #000;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s;
}
.edit-photo-submit-btn:hover:not(:disabled) { opacity: 0.9; }
.edit-photo-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.edit-photo-submit-btn svg { width: 28px; height: 28px; }
.edit-photo-actions {
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    padding: 24px 16px 16px;
}
.edit-photo-action-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 55px;
    border: none;
    font-size: 14px;
    letter-spacing: -0.3px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
}
.edit-photo-action-btn:first-child { background: #fff; color: var(--bg-tertiary); }
.edit-photo-action-btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border); }
.edit-photo-action-btn:hover { opacity: 0.9; }
@media (max-width: 480px) {
    .edit-photo-modal { padding: 12px;   }
    .edit-photo-content { max-height: 85vh; border-radius: 20px 20px 20px 20px; }
    .edit-photo-body { padding: 0 16px; }
    .edit-photo-upload { min-height: 180px; }
}

/* Удалить объект — обводка поверх превью */
.remove-object-canvas-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.remove-object-canvas-wrap .edit-photo-preview {
    position: relative;
    z-index: 0;
    pointer-events: none;
}
.remove-object-draw-canvas {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    pointer-events: auto;
    touch-action: none;
    cursor: crosshair;
    box-sizing: border-box;
}
.remove-object-brush-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 0 4px;
}
.remove-object-brush-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 400;
}
.remove-object-brush-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    accent-color: #fff;
    cursor: pointer;
}
.remove-object-submit-row {
    flex-shrink: 0;
    display: flex;
    gap: 12px;
    padding: 24px 16px 16px;
    align-items: stretch;
}
.remove-object-secondary-btn {
    flex: 0 0 auto;
    padding: 12px 14px;
    border-radius: 55px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.remove-object-secondary-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
}
.remove-object-secondary-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.remove-object-primary-btn {
    flex: 1;
    min-width: 0;
    padding: 12px 20px;
    border-radius: 55px;
    border: none;
    background: #fff;
    color: #111;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.remove-object-primary-btn:hover:not(:disabled) {
    opacity: 0.92;
}
.remove-object-primary-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
