:root {
  --bg: #ffffff;
  --bg-secondary: #f5f7fa;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --z-sidebar: 900;
  --z-overlay: 890;
  --z-modal: 1000;
  --z-chat-mobile: 950;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
body { background: var(--bg-secondary); color: var(--text); height: 100vh; overflow: hidden; }
a { text-decoration: none; color: inherit; }
button, input, textarea, select { font-family: inherit; outline: none; }

/* 🌐 LAYOUT */
.app-layout { display: flex; height: 100vh; overflow: hidden; background: var(--bg-secondary); }

/* 📱 SIDEBAR */
.sidebar { position: fixed; top: 0; left: 0; width: 280px; height: 100%; background: var(--bg); border-right: 1px solid var(--border); transform: translateX(-100%); transition: transform 0.25s ease; z-index: var(--z-sidebar); display: flex; flex-direction: column; }
.sidebar.open { transform: translateX(0); }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: var(--z-overlay); opacity: 0; visibility: hidden; transition: 0.25s; }
.sidebar-overlay.show { opacity: 1; visibility: visible; }
.sidebar-header { padding: 20px 16px; border-bottom: 1px solid var(--border); }
.sidebar-avatar { width: 48px; height: 48px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; margin-bottom: 10px; }
.sidebar-name { font-weight: 600; font-size: 1rem; }
.sidebar-status { font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.status-dot.online { background: var(--success); }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: 0.95rem; transition: background 0.15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--bg-secondary); }
.sidebar-nav .icon { width: 20px; text-align: center; color: var(--text-muted); }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.sidebar-footer button { width: 100%; background: none; border: none; color: var(--danger); cursor: pointer; padding: 8px; text-align: left; }
.sidebar-footer button:hover { color: #dc2626; }

/* 📋 CHAT LIST PANEL */
.panel-chats { width: 360px; flex-shrink: 0; background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; z-index: 1; }
.panel-header { height: 60px; padding: 0 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); background: var(--bg); }
.icon-btn { background: none; border: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer; color: var(--text-muted); font-size: 1.2rem; transition: 0.2s; }
.icon-btn:hover { background: var(--bg-secondary); }
.search-box { flex: 1; position: relative; }
.search-box input { width: 100%; padding: 8px 12px 8px 36px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg-secondary); font-size: 0.9rem; }
.search-box input:focus { border-color: var(--primary); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.chat-list { flex: 1; overflow-y: auto; }
.chat-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid #f8fafc; }
.chat-item:hover { background: var(--bg-secondary); }
.chat-item.active { background: #e8f0fe; border-left: 3px solid var(--primary); }
.chat-avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.chat-info { flex: 1; min-width: 0; }
.chat-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.chat-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 0.75rem; color: var(--text-muted); }
.chat-preview { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--primary); color: #fff; font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; margin-left: auto; }

/* 💬 CHAT WINDOW */
.panel-chat { flex: 1 1 0%; display: flex; flex-direction: column; background: var(--bg-secondary); min-width: 0; position: relative; z-index: 2; }
.chat-header-bar { height: 60px; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 12px; }
.chat-header-info { flex: 1; }
.chat-header-name { font-weight: 600; }
.chat-header-status { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.messages-area { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.message { max-width: 75%; padding: 10px 14px; border-radius: 16px; line-height: 1.5; box-shadow: var(--shadow); }
.message.in { align-self: flex-start; background: var(--bg); border-bottom-left-radius: 4px; }
.message.out { align-self: flex-end; background: #dbeafe; border-bottom-right-radius: 4px; }
.msg-text { font-size: 0.95rem; word-break: break-word; }
.msg-time { font-size: 0.7rem; color: var(--text-muted); text-align: right; margin-top: 4px; }
.input-area { background: var(--bg); border-top: 1px solid var(--border); padding: 12px 16px; display: flex; align-items: flex-end; gap: 10px; }
.input-area textarea { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 24px; resize: none; max-height: 120px; min-height: 44px; font-size: 0.95rem; }
.input-area textarea:focus { border-color: var(--primary); }
.send-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: 0.2s; }
.send-btn:hover { background: var(--primary-hover); }

/* 🎤 Голосовые сообщения */
.voice-message { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg); border-radius: 12px; min-width: 200px; }
.voice-message.out { background: #bbdefb; }
.voice-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.voice-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.voice-wave { flex: 1; height: 24px; display: flex; align-items: center; gap: 2px; }
.voice-wave span { width: 3px; background: var(--text-muted); border-radius: 2px; animation: wave 0.5s ease-in-out infinite alternate; }
.voice-wave span:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.voice-wave span:nth-child(3) { animation-delay: 0.2s; height: 20px; }
.voice-wave span:nth-child(4) { animation-delay: 0.3s; height: 12px; }
.voice-time { font-size: 0.7rem; color: var(--text-muted); min-width: 35px; text-align: right; }
@keyframes wave { from { opacity: 0.4; } to { opacity: 1; } }

/* 🎙️ Кнопка записи */
.voice-record-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--bg-secondary); color: var(--text-muted); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; transition: 0.2s; margin-right: 8px; }
.voice-record-btn:hover { background: #e2e8f0; }
.voice-record-btn.recording { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); } 70% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); } }
#voiceInput { display: none; }

/* 📂 MODALS */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: var(--z-modal); display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--bg); border-radius: var(--radius); width: 340px; max-width: 90%; box-shadow: var(--shadow); overflow: hidden; }
.modal-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); }
.modal-options { padding: 8px; }
.modal-opt { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; border-radius: 8px; transition: background 0.15s; }
.modal-opt:hover { background: var(--bg-secondary); }
.modal-opt .ico { font-size: 1.3rem; width: 24px; text-align: center; }

/* 📱 MOBILE */
@media (max-width: 768px) {
  .panel-chats { width: 100%; }
  .panel-chat { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg); z-index: var(--z-chat-mobile); transform: translateX(100%); transition: transform 0.25s cubic-bezier(0.4,0,0.2,1); }
  .panel-chat.mobile-active { transform: translateX(0); }
  .back-btn { display: flex !important; }
  .sidebar { width: 85%; }
}
.back-btn { display: none; }

@media (min-width: 769px) {
  .panel-chat { transform: none !important; position: relative !important; width: auto !important; height: auto !important; }
}

/* 🔐 AUTH & SETTINGS & CONTACTS */
.page-container { display: flex; height: 100vh; }
.page-sidebar { width: 280px; background: var(--bg); border-right: 1px solid var(--border); padding: 20px 16px; display: flex; flex-direction: column; }
.page-content { flex: 1; padding: 24px; overflow-y: auto; background: var(--bg-secondary); }
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-secondary); }
.auth-box { background: var(--bg); padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; max-width: 380px; }
.auth-box h1 { margin-bottom: 8px; }
.auth-box p { color: var(--text-muted); margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.btn { padding: 10px 16px; border-radius: 8px; font-weight: 500; cursor: pointer; border: none; font-size: 0.95rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.alert { padding: 10px; border-radius: 8px; margin-bottom: 15px; font-size: 0.9rem; }
.alert.error { background: #fee2e2; color: #b91c1c; }
.alert.success { background: #d1fae5; color: #065f46; }
.settings-card { background: var(--bg); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.settings-card h3 { margin-bottom: 12px; font-size: 1rem; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 24px; transition: 0.3s; }
.toggle-slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }
.contact-list { background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.contact-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.contact-item:last-child { border-bottom: none; }
.contact-info { flex: 1; }
.contact-name { font-weight: 600; font-size: 0.95rem; }
.contact-email { font-size: 0.8rem; color: var(--text-muted); }
.invite-box { background: var(--bg); padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.invite-box label { font-size: 0.85rem; color: var(--text-muted); display: block; margin-bottom: 6px; }
.invite-input-row { display: flex; gap: 8px; }
.invite-input-row input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; }
/* 📦 TOAST NOTIFICATIONS (замена alert) */
.toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); padding:10px 16px; background:#1e293b; color:#fff; border-radius:8px; font-size:0.9rem; z-index:9999; animation:fadeIn 0.2s; box-shadow:0 4px 12px rgba(0,0,0,0.2); }
.toast-error { background:#dc2626; }
.toast-success { background:#16a34a; }

/* 📦 MODAL IMPROVEMENTS */
.user-result { display:flex; justify-content:space-between; align-items:center; padding:10px; border-bottom:1px solid var(--border); }
.user-result:last-child { border-bottom:none; }
.btn-small { padding:6px 10px; border-radius:6px; border:none; background:var(--primary); color:#fff; cursor:pointer; font-size:0.85rem; }
.btn-small:disabled { background:#94a3b8; cursor:wait; }
.btn-small:hover:not(:disabled) { background:var(--primary-hover); }

/* 📷 AVATAR STYLES */
.chat-avatar { background-size:cover; background-position:center; }
.chat-header-avatar { width:36px; height:36px; border-radius:50%; }
#avatarUploadInput { display:none; }
/* 🔥 Гарантируем кликабельность пунктов меню */
.modal-opt {
    cursor: pointer !important;
    user-select: none;
    position: relative;
    z-index: 10;
}

.modal-opt:hover {
    background: #f8fafc !important;
}

/* Убираем возможные блокировки */
.modal-overlay {
    pointer-events: none;
}
.modal-overlay.show {
    pointer-events: auto;
}
.modal-box {
    pointer-events: auto;
}
/* GIF Picker Button */
.gif-picker-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.gif-picker-btn:hover {
    background: rgba(0,0,0,0.05);
}

/* GIF Picker Modal */
.gif-picker-modal {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 70vh;
    overflow: hidden;
}

.gif-picker-modal.active {
    display: block;
    animation: slideUp 0.3s ease;
}

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

.gif-picker-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 70vh;
}

.gif-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.gif-picker-tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #3b82f6;
    color: white;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
}

/* GIF Section */
.gif-section {
    display: none;
    overflow-y: auto;
    padding: 16px;
}

.gif-section.active {
    display: block;
}

.gif-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.gif-search-box input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.gif-search-box button {
    padding: 10px 16px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    cursor: pointer;
}

.gif-category {
    margin-bottom: 24px;
}

.gif-category h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: #475569;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.view-all-btn {
    padding: 4px 12px;
    border: none;
    background: #3b82f6;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.recent-gifs-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.recent-gif-item {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.recent-gif-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gifs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.gif-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.gif-item:hover {
    transform: scale(1.05);
}

.gif-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Stickers */
.sticker-packs-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.create-pack-btn {
    grid-column: 1 / -1;
    padding: 12px;
    border: 2px dashed #cbd5e1;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 8px;
}

.sticker-pack-item {
    text-align: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.sticker-pack-item:hover {
    background: #f1f5f9;
}

.sticker-pack-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 4px;
}

.sticker-pack-item span {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
}

.sticker-pack-item small {
    color: #64748b;
}

.sticker-pack-view {
    padding: 0;
}

.back-btn {
    padding: 12px 16px;
    border: none;
    background: #f1f5f9;
    cursor: pointer;
    font-weight: 500;
    width: 100%;
    text-align: left;
}

.stickers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    padding: 16px;
}

.sticker-item {
    aspect-ratio: 1;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.sticker-item:hover {
    transform: scale(1.1);
}

.sticker-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.no-recent {
    text-align: center;
    color: #64748b;
    padding: 20px;
}

/* Mobile */
@media (max-width: 768px) {
    .gif-picker-modal {
        max-height: 80vh;
    }
    
    .gifs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stickers-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
/* 🎬 GIF Picker Button */
.gif-picker-btn { background: none; border: none; font-size: 1.4rem; cursor: pointer; padding: 6px; border-radius: 6px; transition: 0.2s; }
.gif-picker-btn:hover { background: #f0f2f5; }

/* GIF Modal */
.gif-picker-modal { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-radius: 12px 12px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,0.15); z-index: 1000; max-height: 70vh; }
.gif-picker-modal.active { display: block; animation: slideUp 0.25s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.gif-picker-content { display: flex; flex-direction: column; height: 100%; }
.gif-picker-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid #eee; }
.gif-tabs { display: flex; gap: 10px; }
.tab { padding: 6px 12px; border: none; background: #f1f5f9; border-radius: 6px; cursor: pointer; font-weight: 500; }
.tab.active { background: #3b82f6; color: #fff; }
.close-gif { background: none; border: none; font-size: 1.3rem; cursor: pointer; }
.gif-body { padding: 12px; overflow-y: auto; flex: 1; }
#gifSearch { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 6px; margin-bottom: 12px; }
.gif-section h3 { margin: 10px 0 6px; font-size: 0.9rem; color: #666; }
.gif-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.gif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.gif-item, .sticker-item { aspect-ratio: 1; border-radius: 6px; overflow: hidden; cursor: pointer; transition: 0.2s; }
.gif-item:hover, .sticker-item:hover { transform: scale(1.03); }
.gif-item img, .sticker-item img { width: 100%; height: 100%; object-fit: cover; }
.sticker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; margin-top: 10px; }
.sticker-pack { text-align: center; cursor: pointer; padding: 8px; border-radius: 8px; }
.sticker-pack:hover { background: #f8fafc; }
.sticker-pack img { width: 60px; height: 60px; object-fit: contain; margin-bottom: 4px; }
.create-pack-btn { grid-column: 1/-1; padding: 10px; border: 2px dashed #cbd5e1; background: none; border-radius: 8px; cursor: pointer; margin-bottom: 8px; }
.back-pack-btn { padding: 8px; background: #f1f5f9; border: none; border-radius: 6px; cursor: pointer; margin-bottom: 10px; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
/* GIF Picker Button */
.gif-picker-btn { background: none; border: none; font-size: 1.4rem; cursor: pointer; padding: 6px; border-radius: 6px; transition: 0.2s; }
.gif-picker-btn:hover { background: #f0f2f5; }

/* GIF Modal */
.gif-picker-modal { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-radius: 12px 12px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,0.15); z-index: 1000; max-height: 70vh; }
.gif-picker-modal.active { display: block; animation: slideUp 0.25s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.gif-picker-content { display: flex; flex-direction: column; height: 100%; }
.gif-picker-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid #eee; }
.gif-tabs { display: flex; gap: 10px; }
.tab { padding: 6px 12px; border: none; background: #f1f5f9; border-radius: 6px; cursor: pointer; font-weight: 500; }
.tab.active { background: #3b82f6; color: #fff; }
.close-gif { background: none; border: none; font-size: 1.3rem; cursor: pointer; }
.gif-body { padding: 12px; overflow-y: auto; flex: 1; }
#gifSearch { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 6px; margin-bottom: 12px; }
.gif-section h3 { margin: 10px 0 6px; font-size: 0.9rem; color: #666; }
.gif-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.gif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.gif-item, .sticker-item { aspect-ratio: 1; border-radius: 6px; overflow: hidden; cursor: pointer; transition: 0.2s; }
.gif-item:hover, .sticker-item:hover { transform: scale(1.03); }
.gif-item img, .sticker-item img { width: 100%; height: 100%; object-fit: cover; }
.sticker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; margin-top: 10px; }
.sticker-pack { text-align: center; cursor: pointer; padding: 8px; border-radius: 8px; }
.sticker-pack:hover { background: #f8fafc; }
.sticker-pack img { width: 60px; height: 60px; object-fit: contain; margin-bottom: 4px; }
.back-pack-btn { padding: 8px; background: #f1f5f9; border: none; border-radius: 6px; cursor: pointer; margin-bottom: 10px; width: 100%; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.giphy-attribution { text-align: center; padding: 8px; border-top: 1px solid #eee; margin-top: 10px; font-size: 10px; }
.giphy-attribution a { color: #888; text-decoration: none; }
.gif-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 6px 10px; font-size: 0.85rem; }
/* 4 вкладки */
.gif-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 6px 10px; font-size: 0.8rem; }

/* Telegram стикеры */
.sticker-list { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); 
    gap: 10px; 
    margin-top: 10px; 
}
.sticker-pack { 
    text-align: center; 
    cursor: pointer; 
    padding: 8px; 
    border-radius: 8px; 
    transition: 0.2s;
}
.sticker-pack:hover { background: #f8fafc; }
.sticker-pack img { 
    width: 60px; 
    height: 60px; 
    object-fit: contain; 
    margin-bottom: 4px; 
}
.sticker-pack span { 
    display: block; 
    font-size: 0.75rem; 
    color: #666;
}
.back-pack-btn { 
    padding: 8px; 
    background: #f1f5f9; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    margin-bottom: 10px; 
    width: 100%;
}