/* Эффект жидкого стекла (iOS style) */
.glass-effect {
    background: rgba(26, 31, 58, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.chat-main {
    min-height: calc(100vh - 80px);
    padding: 2rem;
}

.chat-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 120px);
    max-width: 1600px;
    margin: 0 auto;
}

/* Сайдбар */
.chat-sidebar {
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-tabs {
    display: flex;
    padding: 0.5rem;
    gap: 0.5rem;
    background: rgba(10, 14, 39, 0.5);
}

.chat-tab {
    flex: 1;
    padding: 0.75rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.chat-tab:hover {
    background: rgba(0, 212, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.chat-tab.active {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.chat-search {
    margin: 1rem;
    border-radius: 15px;
    padding: 0.5rem;
}

.chat-search input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(10, 14, 39, 0.5);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.chat-search input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.create-buttons {
    padding: 0 1rem 1rem;
}

.create-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 12px;
    border: none;
    color: #00d4ff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.create-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

.chat-list::-webkit-scrollbar {
    width: 6px;
}

.chat-list::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 10px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 15px;
    background: rgba(26, 31, 58, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-item:hover {
    background: rgba(0, 212, 255, 0.15);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.chat-item.active {
    background: rgba(0, 212, 255, 0.25);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.4);
}

.chat-item-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #fff;
}

.chat-item-last {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-badge {
    background: #00d4ff;
    color: #0a0e27;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Контент чата */
.chat-content {
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-card {
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
}

.empty-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #00d4ff;
}

.empty-card p {
    color: rgba(255, 255, 255, 0.6);
}

.chat-active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 20px 20px 0 0;
}

.chat-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.chat-user-info {
    flex: 1;
}

.chat-user-info h3 {
    margin-bottom: 0.25rem;
    color: #fff;
}

.chat-user-status {
    font-size: 0.85rem;
    color: #00d4ff;
}

.chat-info-btn {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.chat-info-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(10, 14, 39, 0.3);
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 10px;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 70%;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.message-content {
    background: rgba(26, 31, 58, 0.7);
    backdrop-filter: blur(15px);
    padding: 0.75rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.message.own .message-content {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(0, 153, 255, 0.3));
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.message-author {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: #00d4ff;
}

.message.own .message-author {
    display: none;
}

.message-text {
    word-wrap: break-word;
    color: #fff;
}

.message-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
}

.message-file {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 212, 255, 0.15);
    border-radius: 10px;
    font-size: 0.9rem;
}

.message-file a {
    color: #00d4ff;
    text-decoration: none;
}

.chat-input-container {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 0 0 20px 20px;
}

.chat-attach-btn {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.chat-attach-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: scale(1.1);
}

.chat-input-container input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(10, 14, 39, 0.5);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.chat-input-container input[type="text"]:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 212, 255, 0.5);
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    padding: 2rem;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: #00d4ff;
}

.glass-input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(10, 14, 39, 0.5);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.glass-input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

textarea.glass-input {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.glass-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
}

.glass-checkbox input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.user-select-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(10, 14, 39, 0.3);
    border-radius: 12px;
}

.user-select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(26, 31, 58, 0.5);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-select-item:hover {
    background: rgba(0, 212, 255, 0.15);
}

.user-select-item.selected {
    background: rgba(0, 212, 255, 0.25);
    border: 1px solid rgba(0, 212, 255, 0.5);
}

.user-select-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid rgba(0, 212, 255, 0.5);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        display: none;
    }
    
    .chat-sidebar.mobile-show {
        display: flex;
    }
}


/* ========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ ЧАТА
   ======================================== */

@media (max-width: 1024px) {
    .chat-container {
        grid-template-columns: 320px 1fr;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .chat-main {
        padding: 0.5rem;
    }
    
    .chat-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 80px);
    }
    
    /* Сайдбар на весь экран на мобильных */
    .chat-sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .chat-sidebar.mobile-show {
        transform: translateX(0);
    }
    
    /* Кнопка возврата к списку чатов */
    .back-to-chats {
        display: block;
        position: fixed;
        top: 70px;
        left: 1rem;
        z-index: 101;
        padding: 0.75rem 1rem;
        background: rgba(26, 31, 58, 0.9);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(0, 212, 255, 0.5);
        border-radius: 12px;
        color: #00d4ff;
        cursor: pointer;
        font-size: 1.2rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
    
    .back-to-chats:active {
        transform: scale(0.95);
    }
    
    /* Скрываем сайдбар когда открыт чат */
    .chat-active-mobile .chat-sidebar {
        display: none;
    }
    
    /* Контент чата на весь экран */
    .chat-content {
        border-radius: 0;
    }
    
    .chat-header {
        border-radius: 0;
        padding: 1rem;
    }
    
    .chat-input-container {
        border-radius: 0;
        padding: 0.75rem;
    }
    
    /* Вкладки */
    .chat-tabs {
        padding: 0.25rem;
    }
    
    .chat-tab {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
    
    /* Поиск */
    .chat-search {
        margin: 0.75rem;
    }
    
    /* Кнопки создания */
    .create-buttons {
        padding: 0 0.75rem 0.75rem;
    }
    
    /* Элементы чата */
    .chat-item {
        padding: 0.75rem;
        margin: 0.25rem;
    }
    
    .chat-item-avatar {
        width: 40px;
        height: 40px;
    }
    
    /* Сообщения */
    .message {
        max-width: 85%;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
    }
    
    /* Модальные окна */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .user-select-list {
        max-height: 150px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-buttons button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 0.75rem;
    }
    
    .chat-user-avatar {
        width: 40px;
        height: 40px;
    }
    
    .chat-user-info h3 {
        font-size: 1rem;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-input-container {
        gap: 0.5rem;
    }
    
    .chat-input-container input[type="text"] {
        font-size: 0.9rem;
    }
    
    .btn-primary {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}
