/* ===== TELEGRAM-STYLE INPUT AREA ===== */
.chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    /* Safe area for new iPhones */
    background: var(--bg-chat);
    position: relative;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    /* Prevent shrinking */
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: none;
    outline: none;
    background: var(--bg-darker);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s;
}

.chat-input input:focus {
    background: var(--bg-dark);
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.3);
}

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

.send-btn {
    background: var(--telegram-blue);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.send-btn:hover {
    background: var(--telegram-blue-light);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.4);
}

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

.file-btn,
.emoji-btn,
.mic-btn {
    background: rgba(255, 255, 255, 0.05);
    /* Subtle glass */
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
}

.file-btn:hover,
.emoji-btn:hover,
.mic-btn:hover {
    background: rgba(0, 136, 204, 0.2);
    border-color: var(--telegram-blue);
    color: var(--telegram-blue);
    transform: translateY(-2px);
    box-shadow: 0 0 8px rgba(0, 136, 204, 0.3);
}

/* Hover styles merged above */

@media (max-width: 768px) {
    .chat-input {
        padding: 10px 12px;
        gap: 6px;
    }

    .chat-input input {
        padding: 10px 12px;
        font-size: 14px;
        min-width: 0;
        /* Allow shrinking */
    }

    .file-btn,
    .emoji-btn,
    .mic-btn {
        width: 36px;
        height: 36px;
        margin-right: 2px;
        font-size: 18px;
    }

    .send-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

.typing {
    padding: 8px 20px;
    font-size: 13px;
    color: var(--telegram-blue-light);
    font-style: italic;
}

/* ===== TELEGRAM-STYLE MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-chat);
    padding: 28px;
    border-radius: 16px;
    width: 420px;
    color: white;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    animation: modalSlideIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--telegram-blue);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-input {
    width: 100%;
    padding: 14px;
    margin: 12px 0;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-darker);
    color: white;
    font-size: 15px;
    transition: all 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: var(--telegram-blue);
    background: var(--bg-dark);
}

.modal-btn {
    width: 100%;
    padding: 14px;
    background: var(--telegram-blue);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 600;
}

.modal-btn:hover {
    background: var(--telegram-blue-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
}

/* ===== SEARCH BAR ===== */
.search-bar {
    padding: 12px 20px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
}

.search-bar input {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 20px;
    background: var(--bg-chat);
    color: white;
    outline: none;
    font-size: 14px;
    transition: all 0.2s;
}

.search-bar input:focus {
    background: var(--bg-dark);
    box-shadow: 0 0 0 2px rgba(0, 136, 204, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

/* ===== USER ITEM STYLES ===== */
.user-item:hover {
    background: var(--bg-chat) !important;
    transform: translateX(4px);
}

.user-item .chat-avatar {
    flex-shrink: 0;
}