* {
    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);
}

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

/* Sidebar initially hidden on mobile */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    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;
}

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

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
 
    overflow: hidden;
    position: relative;
    width: 100%;
}

 

.chat-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    padding: 0 12px;
    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;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 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;
    letter-spacing: -0.5px;
    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 12px 100px 12px;
    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: 64px;
    height: 64px;
    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;
}

/* 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: 85%;
    padding: 10px 12px 10px 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-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;
    }
}

/* Prompt Suggestions */
.prompt-suggestions {
    position: fixed;
    bottom: 100px;
    left: 0;
    right: 0;
    padding: 12px 12px;
    display: none;
    gap: 8px;
    overflow-x: auto;
    z-index: 90;
    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);
    
}

.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;
    max-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: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    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.3;
    word-wrap: break-word;
    max-width: 100%;
    text-align: left;
    color: var(--text-secondary);
}

/* Attached Images Preview */
.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 12px 12px 12px;
}

/* Динамический padding-bottom в зависимости от платформы */
.platform-ios .chat-input-container {
    padding-bottom: 24px;
}

.platform-android .chat-input-container {
    padding-bottom: 12px;
}

.platform-web .chat-input-container {
    padding-bottom: 12px;
}

/* Кнопка прокрутки к началу/концу чата */
.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: 1px solid var(--border);
    border-radius: 28px;
    padding: 4px 6px 6px 6px;
    min-height: 52px;
    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);
}

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

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

 

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

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

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

.dropdown-item.premium-locked {
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.6;
}

.dropdown-item.premium-locked:hover {
    background: rgba(255, 59, 48, 0.1);
}

.lock-icon {
    font-size: 14px;
    margin-left: 8px;
}

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

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



.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

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

/* New Chat Button */
.new-chat-btn {
    margin: 12px 12px 0 12px;
    padding: 12px 20px;
    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;
}

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

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

/* Subscription Section */
.subscription-section {
    padding: 12px 12px 24px 12px;
    flex-shrink: 0;
}

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

.chats-section-header {
    padding: 12px 0 8px 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);
}

.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: 8px;
    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 (фиксированный блок внизу) */
.sidebar-user-block {
    padding: 12px;
    background: var(--bg-primary);
    flex-shrink: 0;
}

.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 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* Статус подписки */
.subscription-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.subscription-status-icon:hover {
    transform: scale(1.1);
}


.subscription-status-icon .crown-icon {
    transition: all 0.3s ease;
}

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

/* Обертка для статуса подписки */
.subscription-status-wrapper {
    position: relative;
}

/* Тултип подписки в сайдбаре */
.sidebar-subscription-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    left: auto;
    transform-origin: bottom right;
    min-width: 240px;
    max-width: 280px;
    top: auto;
}

.sidebar-subscription-tooltip.show {
    transform: translateY(0) scale(1);
}

@media (max-width: 480px) {
    .sidebar-subscription-tooltip {
        right: 0;
        transform-origin: bottom left;
    }
}

/* Кнопка выхода (иконка) */
.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: 0;
}

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

/* Responsive - убираем все media queries для десктопа */
@media (max-width: 480px) {
    .chat-header {
        padding: 0 12px;
    }
    
    .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;
        max-width: 104px;
        gap: 8px;
        align-items: flex-start;
    }
    
    .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);
}

/* 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 33px;
    background: linear-gradient(135deg, var(--accent), #9333ea);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

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

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