/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

/* Контейнер чата */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .chat-container {
        height: 95vh;
        margin: 2.5vh auto;
        border-radius: 16px;
    }
}

/* Заголовок чата */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 16px 16px 0 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-left: 8px;
    flex: 1;
}

.header-content i {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.mobile-connect-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 14px;
    margin-top: 4px;
}

.mobile-connect-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.share-chat-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.share-chat-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.qr-quick-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    text-decoration: none;
    margin-left: 8px;
}

.qr-quick-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    color: #fbbf24;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.online-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    opacity: 0.9;
}

.online-dot {
    color: #4ade80;
    font-size: 0.6rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Область сообщений */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Сообщения */
.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

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

.message.own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.message.own .message-content {
    text-align: right;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message.own .message-header {
    justify-content: flex-end;
}

.message-author {
    font-weight: 500;
    font-size: 0.85rem;
    color: #374151;
}

.message-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.message-text {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.own .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

/* Системные сообщения */
.system-message {
    text-align: center;
    margin: 8px 0;
}

.system-message .message-text {
    background: rgba(0, 0, 0, 0.05);
    color: #6b7280;
    font-size: 0.8rem;
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
}

/* Индикатор печатания */
.typing-indicator {
    padding: 0 20px 10px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #6b7280;
}

.typing-indicator.show {
    display: flex;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s ease-in-out infinite both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Поле ввода сообщений */
.message-input-container {
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 24px;
    padding: 4px 4px 4px 20px;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#messageInput {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 12px 8px;
    font-size: 1rem;
    font-family: inherit;
}

#messageInput::placeholder {
    color: #9ca3af;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.emoji-btn, .send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.emoji-btn {
    background: none;
    font-size: 1.2rem;
}

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

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:disabled {
    background: #d1d5db;
    transform: none;
    cursor: not-allowed;
    box-shadow: none;
}

/* Селектор эмодзи */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1000;
}

.emoji-picker.show {
    display: block;
    animation: slideUp 0.2s ease-out;
}

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

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.emoji {
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-size: 1.2rem;
    transition: background-color 0.2s ease;
}

.emoji:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 16px;
    text-align: center;
}

.modal-content p {
    color: #6b7280;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

#nameInput {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 16px;
}

#nameInput:focus {
    border-color: #667eea;
}

.random-names p {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 8px;
    margin-top: 16px;
}

.name-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.name-suggestion {
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.name-suggestion:hover {
    background: #667eea;
    color: white;
}

.modal-actions {
    margin-top: 20px;
    text-align: center;
}

.join-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.join-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

/* Уведомления */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #10b981;
    animation: notificationSlideIn 0.3s ease-out;
    max-width: 300px;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification.error {
    border-left-color: #ef4444;
}

.notification.warning {
    border-left-color: #f59e0b;
}

/* Улучшенная мобильная поддержка */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        height: 100dvh; /* Динамическая высота viewport для мобильных */
        margin: 0;
        border-radius: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    .chat-header {
        border-radius: 0;
        padding: max(env(safe-area-inset-top), 16px) 20px 16px 20px;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .header-content h1 {
        font-size: 1.1rem;
    }
    
    .user-info {
        font-size: 0.8rem;
    }
    
    .chat-messages {
        padding: 16px;
        padding-bottom: max(env(safe-area-inset-bottom), 16px);
        /* Прокрутка с инерцией на iOS */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message-text {
        font-size: 0.9rem;
        padding: 10px 14px;
        border-radius: 12px;
        /* Улучшенная читаемость на мобильных */
        line-height: 1.4;
    }
    
    .message-input-container {
        padding: 16px;
        padding-bottom: max(env(safe-area-inset-bottom), 16px);
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        position: sticky;
        bottom: 0;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .input-wrapper {
        border-radius: 24px;
        padding: 4px 4px 4px 16px;
        min-height: 48px; /* Минимальная высота для удобного нажатия */
    }
    
    #messageInput {
        font-size: 16px; /* Предотвращает зум на iOS */
        padding: 12px 8px;
        min-height: 24px;
    }
    
    .emoji-btn, .send-btn {
        width: 44px;
        height: 44px;
        /* Улучшенная область нажатия */
        touch-action: manipulation;
    }
    
    .emoji-picker {
        right: 16px;
        left: 16px;
        width: auto;
        bottom: 80px;
        max-height: 40vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 4px;
    }
    
    .emoji {
        padding: 12px 8px;
        font-size: 1.1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        /* Улучшенная область нажатия */
        touch-action: manipulation;
    }
    
    .modal {
        margin: 16px;
        width: calc(100% - 32px);
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content {
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #nameInput {
        font-size: 16px; /* Предотвращает зум на iOS */
        min-height: 48px;
    }
    
    .join-btn {
        min-height: 48px;
        font-size: 16px;
        touch-action: manipulation;
    }
    
    .name-suggestion {
        min-height: 36px;
        font-size: 0.85rem;
        padding: 8px 16px;
        touch-action: manipulation;
    }
    
    .mobile-connect-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
        touch-action: manipulation;
    }
}

/* Поддержка iPhone X и новых моделей */
@supports (padding: max(0px)) {
    .chat-header {
        padding-top: max(env(safe-area-inset-top), 16px);
    }
    
    .message-input-container {
        padding-bottom: max(env(safe-area-inset-bottom), 16px);
    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 480px) {
    .header-content {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .user-info {
        flex-direction: row;
        gap: 12px;
        font-size: 0.75rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }
    
    .message-text {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Горизонтальная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-container {
        height: 100vh;
    }
    
    .chat-messages {
        padding: 12px 16px;
    }
    
    .message-input-container {
        padding: 12px 16px;
    }
    
    .emoji-picker {
        max-height: 50vh;
        bottom: 70px;
    }
    
    .modal {
        max-height: 85vh;
    }
}

/* Темная тема для мобильных устройств */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .message-input-container {
        background: rgba(30, 30, 30, 0.95);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .input-wrapper {
        background: #374151;
        border-color: rgba(255, 255, 255, 0.1);
    }
}

/* Анимации для пустого состояния */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.empty-state p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Дополнительные анимации для PWA */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* PWA специфичные стили */
.install-btn {
    animation: pulse 2s infinite;
    transition: all 0.3s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.install-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* Splash screen для PWA */
.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pwa-splash.show {
    opacity: 1;
    pointer-events: all;
}

.pwa-splash-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s infinite;
}

.pwa-splash-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

/* Keyboard awareness */
body[data-keyboard-visible="true"] {
    padding-bottom: var(--keyboard-height, 0);
}

/* Enhanced mobile optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Увеличиваем размеры для touch устройств */
    .message-input button,
    .emoji-btn,
    .send-btn,
    .share-chat-btn,
    .qr-quick-btn {
        min-height: 48px;
        min-width: 48px;
    }
    
    /* Мобильные кнопки шаринга */
    .share-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .share-btn {
        min-height: 50px;
        font-size: 16px;
    }
    
    /* Убираем hover эффекты на touch устройствах */
    .message:hover {
        transform: none;
    }
    
    .emoji-btn:hover {
        transform: none;
        background: rgba(102, 126, 234, 0.1);
    }
    
    /* Improved button feedback */
    .message-input button:active,
    .emoji-btn:active,
    .send-btn:active {
        transform: scale(0.95);
        background: rgba(102, 126, 234, 0.2);
    }
}

/* Orientation changes */
@media (orientation: landscape) and (max-height: 500px) {
    .chat-header {
        padding: 0.5rem 1rem;
    }
    
    .chat-header h1 {
        font-size: 1.2rem;
    }
    
    .chat-messages {
        height: calc(100vh - 130px);
    }
    
    .message-input-container {
        padding: 0.5rem 1rem;
    }
}

/* Модальное окно шаринга */
.share-modal-content {
    max-width: 500px;
    width: 90%;
}

.share-url-container {
    display: flex;
    margin: 20px 0;
    gap: 10px;
}

.share-url-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fafb;
    color: #374151;
}

.copy-url-btn {
    padding: 12px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 50px;
}

.copy-url-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 44px;
}

.whatsapp-btn {
    background: #25d366;
    color: white;
}

.whatsapp-btn:hover {
    background: #128c7e;
    transform: translateY(-2px);
}

.telegram-btn {
    background: #0088cc;
    color: white;
}

.telegram-btn:hover {
    background: #006699;
    transform: translateY(-2px);
}

.facebook-btn {
    background: #1877f2;
    color: white;
}

.facebook-btn:hover {
    background: #166fe5;
    transform: translateY(-2px);
}

.twitter-btn {
    background: #1da1f2;
    color: white;
}

.twitter-btn:hover {
    background: #0d8bd9;
    transform: translateY(-2px);
}

.native-share-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.native-share-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
}

.qr-section {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid #e5e7eb;
    margin-top: 20px;
}

.qr-code-container {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    min-height: 60px;
    align-items: center;
}

.qr-generator-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.qr-generator-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #5a67d8;
}

/* Notch support for iPhone X and newer */
@supports (padding: max(0px)) {
    .chat-header {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .message-input-container {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .message {
        border: 1px solid #000;
    }
    
    .message-input {
        border: 2px solid #000;
    }
    
    .send-btn {
        border: 1px solid #000;
    }
}

/* Мобильная навигация и меню */
.mobile-nav-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mobile-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.2);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-menu-header h3 {
    color: white;
    margin: 0;
    font-size: 1.2rem;
}

.mobile-menu-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-menu-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
}

.mobile-menu-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.mobile-menu-item.info {
    background: rgba(255, 255, 255, 0.05);
    cursor: default;
    opacity: 0.7;
}

.mobile-menu-item.info:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Мобильная панель быстрого доступа */
.mobile-quick-panel {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

.quick-panel-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.quick-panel-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.quick-panel-btn:active {
    transform: scale(0.95);
}

/* Показываем мобильные элементы только на мобильных устройствах */
@media (max-width: 768px) {
    .mobile-quick-panel {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
}

/* Очень маленькие экраны - упрощаем интерфейс */
@media (max-width: 480px) {
    .mobile-menu {
        width: 100%;
        right: -100%;
    }
    
    .mobile-nav-buttons {
        gap: 6px;
    }
    
    .mobile-connect-btn,
    .qr-quick-btn,
    .share-chat-btn,
    .mobile-menu-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .quick-panel-btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .mobile-quick-panel {
        bottom: 15px;
        right: 15px;
        gap: 10px;
    }
}

/* Анимации */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}